修改登录页
This commit is contained in:
@@ -18,22 +18,22 @@ router.beforeEach((to, from, next) => {
|
||||
window.existLoading = true
|
||||
}
|
||||
console.log(to)
|
||||
// if (to.path == '/login' || to.path == '/404') {
|
||||
// // 登录或者注册才可以往下进行
|
||||
// next()
|
||||
// } else {
|
||||
// // 获取 token
|
||||
// const token = localStorage.getItem('toKen')
|
||||
// // token 不存在
|
||||
// if (token === null || token === '') {
|
||||
// ElMessage.error('您还没有登录,请先登录')
|
||||
// next('/login')
|
||||
// } else {
|
||||
// next()
|
||||
// }
|
||||
// }
|
||||
if (to.path == '/login' || to.path == '/404') {
|
||||
// 登录或者注册才可以往下进行
|
||||
next()
|
||||
} else {
|
||||
// 获取 token
|
||||
const token = localStorage.getItem('token')
|
||||
// token 不存在
|
||||
if (token === null || token === '') {
|
||||
ElMessage.error('您还没有登录,请先登录')
|
||||
next('/login')
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
}
|
||||
|
||||
next()
|
||||
// next()
|
||||
})
|
||||
|
||||
// 路由加载后
|
||||
|
||||
Reference in New Issue
Block a user