Skip to content

Commit

Permalink
#6861 跳转到自定义首页死循环问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangdaiscott committed Jul 12, 2024
1 parent 7049e99 commit 0148a0b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions jeecgboot-vue3/src/router/guard/permissionGuard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,20 @@ const whitePathList: PageEnum[] = [LOGIN_PATH, OAUTH2_LOGIN_PAGE_PATH,SYS_FILES_
export function createPermissionGuard(router: Router) {
const userStore = useUserStoreWithOut();
const permissionStore = usePermissionStoreWithOut();

// 自定义首页跳转次数
let homePathJumpCount = 0;

router.beforeEach(async (to, from, next) => {
if (
// 【#6861】跳转到自定义首页的逻辑,只跳转一次即可
homePathJumpCount < 1 &&
from.path === ROOT_PATH &&
to.path === PageEnum.BASE_HOME &&
userStore.getUserInfo.homePath &&
userStore.getUserInfo.homePath !== PageEnum.BASE_HOME
) {
homePathJumpCount++;
next(userStore.getUserInfo.homePath);
return;
}
Expand Down

0 comments on commit 0148a0b

Please sign in to comment.