Browse Source

#6861 跳转到自定义首页死循环问题

pull/6912/head
JEECG 4 months ago
parent
commit
0148a0b45e
  1. 7
      jeecgboot-vue3/src/router/guard/permissionGuard.ts

7
jeecgboot-vue3/src/router/guard/permissionGuard.ts

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

Loading…
Cancel
Save