提示优化
This commit is contained in:
parent
8940dc4e24
commit
6203566058
|
@ -575,13 +575,13 @@ router.beforeEach((to, from, next) => {
|
||||||
// 定义失效时间
|
// 定义失效时间
|
||||||
const timeOver = 2 * 60 * 60 * 1000
|
const timeOver = 2 * 60 * 60 * 1000
|
||||||
let date = new Date().getTime()
|
let date = new Date().getTime()
|
||||||
if (date - tokenStartTime > timeOver) {
|
if (date - tokenStartTime > timeOver && token) {
|
||||||
|
message.warning('登录失效,请重新登录!')
|
||||||
token = null
|
token = null
|
||||||
}
|
}
|
||||||
console.log('判断token失效', token, date - tokenStartTime > timeOver)
|
console.log('判断token失效', token, date - tokenStartTime > timeOver)
|
||||||
if (!token) {
|
if (!token) {
|
||||||
if (to.path == '/login') return next()
|
if (to.path == '/login') return next()
|
||||||
message.warning('登录失效,请重新登录!')
|
|
||||||
return next('/login')
|
return next('/login')
|
||||||
} else if (to.path == '/login') {
|
} else if (to.path == '/login') {
|
||||||
return next('/home')
|
return next('/home')
|
||||||
|
|
Loading…
Reference in New Issue