From f4889b76360707c2259ca57b6fd427cb7badb457 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 19 Sep 2022 19:11:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):=20?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E8=B7=AF=E7=94=B1=E6=9D=83=E9=99=90=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E6=97=B6=E5=8F=82=E6=95=B0=E4=BC=9A=E8=A2=AB=E5=BF=BD?= =?UTF-8?q?=E7=95=A5=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/components/common/router/router.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/frontend/src/business/components/common/router/router.js b/frontend/src/business/components/common/router/router.js index ea20ac8552..3e366dab05 100644 --- a/frontend/src/business/components/common/router/router.js +++ b/frontend/src/business/components/common/router/router.js @@ -78,10 +78,16 @@ function redirectLoginPath(originPath, next) { if (!defaultMenuRoute) { // 记录标识,防止死循环 sessionStorage.setItem('defaultMenuRoute', 'sign'); - originPath = getDefaultSecondLevelMenu(originPath); - next({path: originPath}); - if (router.currentRoute.fullPath === originPath) { - sessionStorage.setItem('redirectUrl', originPath); + let changedPath = getDefaultSecondLevelMenu(originPath); + if (changedPath === originPath) { + // 通过了权限校验,保留路由相关信息,直接放行 + next(); + } else { + // 未通过校验,放行至有权限路由 + next({path: changedPath}); + } + if (router.currentRoute.fullPath === changedPath) { + sessionStorage.setItem('redirectUrl', changedPath); // 路径相同时,移除标识 sessionStorage.removeItem("defaultMenuRoute"); }