路由验权调整
This commit is contained in:
parent
35cec2a64c
commit
1595d987ed
|
|
@ -26,7 +26,10 @@ router.beforeEach(async (to, from, next) => {
|
||||||
document.title = to.meta.title ?? config.title
|
document.title = to.meta.title ?? config.title
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const tabsStore = useTabsStore()
|
const tabsStore = useTabsStore()
|
||||||
if (userStore.token) {
|
if (whiteList.includes(to.path)) {
|
||||||
|
// 在免登录白名单,直接进入
|
||||||
|
next()
|
||||||
|
} else if (userStore.token) {
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
const hasGetUserInfo = Object.keys(userStore.userInfo).length !== 0
|
const hasGetUserInfo = Object.keys(userStore.userInfo).length !== 0
|
||||||
if (hasGetUserInfo) {
|
if (hasGetUserInfo) {
|
||||||
|
|
@ -71,9 +74,6 @@ router.beforeEach(async (to, from, next) => {
|
||||||
next({ path: loginPath, query: { redirect: to.fullPath } })
|
next({ path: loginPath, query: { redirect: to.fullPath } })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (whiteList.includes(to.path)) {
|
|
||||||
// 在免登录白名单,直接进入
|
|
||||||
next()
|
|
||||||
} else {
|
} else {
|
||||||
next({ path: loginPath, query: { redirect: to.fullPath } })
|
next({ path: loginPath, query: { redirect: to.fullPath } })
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue