From 0148a0b45e263b1ee92fdbd41776d602f2f70133 Mon Sep 17 00:00:00 2001 From: JEECG <445654970@qq.com> Date: Fri, 12 Jul 2024 14:16:09 +0800 Subject: [PATCH] =?UTF-8?q?#6861=20=E8=B7=B3=E8=BD=AC=E5=88=B0=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E9=A6=96=E9=A1=B5=E6=AD=BB=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jeecgboot-vue3/src/router/guard/permissionGuard.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jeecgboot-vue3/src/router/guard/permissionGuard.ts b/jeecgboot-vue3/src/router/guard/permissionGuard.ts index 6774977e..deb36d3c 100644 --- a/jeecgboot-vue3/src/router/guard/permissionGuard.ts +++ b/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; }