提示优化

This commit is contained in:
a0049873 2022-10-10 14:53:30 +08:00
parent 8940dc4e24
commit 6203566058
1 changed files with 2 additions and 2 deletions

View File

@ -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')