|
|
|
@ -26,7 +26,7 @@ const whiteList = ['/login'] // 不重定向白名单
|
|
|
|
router.beforeEach(async (to, from, next) => {
|
|
|
|
router.beforeEach(async (to, from, next) => {
|
|
|
|
start()
|
|
|
|
start()
|
|
|
|
loadStart()
|
|
|
|
loadStart()
|
|
|
|
if (!wsCache.get(appStore.getUserInfo)) {
|
|
|
|
// if (!wsCache.get(appStore.getUserInfo)) {
|
|
|
|
if (to.path === '/login') {
|
|
|
|
if (to.path === '/login') {
|
|
|
|
next({ path: '/' })
|
|
|
|
next({ path: '/' })
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -65,13 +65,13 @@ router.beforeEach(async (to, from, next) => {
|
|
|
|
permissionStore.setIsAddRouters(true)
|
|
|
|
permissionStore.setIsAddRouters(true)
|
|
|
|
next(nextData)
|
|
|
|
next(nextData)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// } else {
|
|
|
|
if (whiteList.indexOf(to.path) !== -1) {
|
|
|
|
// if (whiteList.indexOf(to.path) !== -1) {
|
|
|
|
next()
|
|
|
|
// next()
|
|
|
|
} else {
|
|
|
|
// } else {
|
|
|
|
next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页
|
|
|
|
// next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
router.afterEach((to) => {
|
|
|
|
router.afterEach((to) => {
|
|
|
|
|