mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-08 17:12:28 +08:00
#6861 跳转到自定义首页死循环问题
This commit is contained in:
@ -34,13 +34,20 @@ const whitePathList: PageEnum[] = [LOGIN_PATH, OAUTH2_LOGIN_PAGE_PATH,SYS_FILES_
|
|||||||
export function createPermissionGuard(router: Router) {
|
export function createPermissionGuard(router: Router) {
|
||||||
const userStore = useUserStoreWithOut();
|
const userStore = useUserStoreWithOut();
|
||||||
const permissionStore = usePermissionStoreWithOut();
|
const permissionStore = usePermissionStoreWithOut();
|
||||||
|
|
||||||
|
// 自定义首页跳转次数
|
||||||
|
let homePathJumpCount = 0;
|
||||||
|
|
||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
if (
|
if (
|
||||||
|
// 【#6861】跳转到自定义首页的逻辑,只跳转一次即可
|
||||||
|
homePathJumpCount < 1 &&
|
||||||
from.path === ROOT_PATH &&
|
from.path === ROOT_PATH &&
|
||||||
to.path === PageEnum.BASE_HOME &&
|
to.path === PageEnum.BASE_HOME &&
|
||||||
userStore.getUserInfo.homePath &&
|
userStore.getUserInfo.homePath &&
|
||||||
userStore.getUserInfo.homePath !== PageEnum.BASE_HOME
|
userStore.getUserInfo.homePath !== PageEnum.BASE_HOME
|
||||||
) {
|
) {
|
||||||
|
homePathJumpCount++;
|
||||||
next(userStore.getUserInfo.homePath);
|
next(userStore.getUserInfo.homePath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user