fix(系统设置): 进行路由权限校验时参数会被忽略掉

This commit is contained in:
shiziyuan9527 2022-09-19 19:11:16 +08:00 committed by lyh
parent fd1d8e79ef
commit f4889b7636
1 changed files with 10 additions and 4 deletions

View File

@ -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");
}