From 1595d987ed6dad5eb50efc66987d522c79eb842c Mon Sep 17 00:00:00 2001 From: Jason <5340635+wen-jason@user.noreply.gitee.com> Date: Thu, 13 Oct 2022 17:00:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E9=AA=8C=E6=9D=83=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/permission.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/src/permission.ts b/admin/src/permission.ts index b3e1cfa9..ca7017ad 100644 --- a/admin/src/permission.ts +++ b/admin/src/permission.ts @@ -26,7 +26,10 @@ router.beforeEach(async (to, from, next) => { document.title = to.meta.title ?? config.title const userStore = useUserStore() const tabsStore = useTabsStore() - if (userStore.token) { + if (whiteList.includes(to.path)) { + // 在免登录白名单,直接进入 + next() + } else if (userStore.token) { // 获取用户信息 const hasGetUserInfo = Object.keys(userStore.userInfo).length !== 0 if (hasGetUserInfo) { @@ -71,9 +74,6 @@ router.beforeEach(async (to, from, next) => { next({ path: loginPath, query: { redirect: to.fullPath } }) } } - } else if (whiteList.includes(to.path)) { - // 在免登录白名单,直接进入 - next() } else { next({ path: loginPath, query: { redirect: to.fullPath } }) }