Feat:寻看点和抽奖
This commit is contained in:
+45
-4
@@ -85,6 +85,47 @@ export function formatDateTime(time, format) {
|
||||
});
|
||||
}
|
||||
|
||||
export function timeNow(updateTime) {
|
||||
if (updateTime === null) {
|
||||
return ''
|
||||
}
|
||||
let now = new Date().getTime()
|
||||
let second = Math.floor((now - updateTime) / (1000))
|
||||
let minute = Math.floor(second / 60)
|
||||
let hour = Math.floor(minute / 60)
|
||||
let day = Math.floor(hour / 24)
|
||||
let month = Math.floor(day / 31)
|
||||
let year = Math.floor(month / 12)
|
||||
|
||||
console.log(hour);
|
||||
console.log(minute);
|
||||
if (year > 0) {
|
||||
return year + '年前'
|
||||
} else if (month > 0) {
|
||||
return month + '月前'
|
||||
} else if (day > 0) {
|
||||
let ret = day + '天前'
|
||||
if (day >= 7 && day < 14) {
|
||||
ret = '1周前'
|
||||
} else if (day >= 14 && day < 21) {
|
||||
ret = '2周前'
|
||||
} else if (day >= 21 && day < 28) {
|
||||
ret = '3周前'
|
||||
} else if (day >= 28 && day < 31) {
|
||||
ret = '4周前'
|
||||
}
|
||||
return ret
|
||||
} else if (hour > 0) {
|
||||
return hour + '小时前'
|
||||
} else if (minute > 0) {
|
||||
return minute + '分钟前'
|
||||
} else if (second > 0) {
|
||||
return second + '秒前'
|
||||
} else {
|
||||
return '刚刚'
|
||||
}
|
||||
}
|
||||
|
||||
export function diffDay(start, end) {
|
||||
var dateBegin = new Date(start.replace(/-/g, "/"));
|
||||
var dateEnd = new Date(end.replace(/-/g, "/"));
|
||||
@@ -426,7 +467,7 @@ export const handleGetUserInfo = () => {
|
||||
}
|
||||
|
||||
if (url == '/pages/home/index' || url == '/pages/shop/GoodsClass/index' || url ==
|
||||
'/pages/shop/ShoppingCart/index' || url == '/pages/user/User/index') {
|
||||
'/pages/cart' || url == '/pages/user/User/index') {
|
||||
switchTab({
|
||||
path: `${url}`,
|
||||
query
|
||||
@@ -559,7 +600,7 @@ export const handleLoginStatus = (location, complete, fail, success) => {
|
||||
})
|
||||
// if (isAuth) {
|
||||
// // 有token
|
||||
// if (path == '/pages/home/index' || path == '/pages/shop/GoodsClass/index' || path == '/pages/shop/ShoppingCart/index' || path == '/pages/user/User/index') {
|
||||
// if (path == '/pages/home/index' || path == '/pages/shop/GoodsClass/index' || path == '/pages/cart' || path == '/pages/user/User/index') {
|
||||
// // switchTab({
|
||||
// // path: parseUrl(location),
|
||||
// // })
|
||||
@@ -612,7 +653,7 @@ export async function routerPermissions(url, type) {
|
||||
login(loginInfo).then(res => {
|
||||
// 登录成功,跳转到需要跳转的页面
|
||||
store.commit("updateAuthorizationPage", false);
|
||||
if (path == '/pages/shop/ShoppingCart/index' || path == '/pages/user/User/index') {
|
||||
if (path == '/pages/cart' || path == '/pages/user/User/index') {
|
||||
return
|
||||
}
|
||||
if (type == 'reLaunch') {
|
||||
@@ -646,7 +687,7 @@ export async function routerPermissions(url, type) {
|
||||
})
|
||||
} else {
|
||||
// 跳转到登录页面或者授权页面
|
||||
// path == '/pages/shop/ShoppingCart/index' ||
|
||||
// path == '/pages/cart' ||
|
||||
if ( path == '/pages/user/User/index') {
|
||||
switchTab({
|
||||
path,
|
||||
|
||||
Reference in New Issue
Block a user