From 487c3fd53589cee6c05480f080db56d20c45f0a5 Mon Sep 17 00:00:00 2001 From: limengnan <420004014@qq.com> Date: Tue, 24 Jun 2025 11:01:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=89=8D=E7=AB=AFsrc?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/permission.ts | 11 ++++++++++- core/core-frontend/src/permissionMobile.ts | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/core-frontend/src/permission.ts b/core/core-frontend/src/permission.ts index f116bfd..9d3d68e 100644 --- a/core/core-frontend/src/permission.ts +++ b/core/core-frontend/src/permission.ts @@ -48,7 +48,16 @@ router.beforeEach(async (to, from, next) => { linkQuery = '?' + tempQuery } } - window.location.href = window.origin + '/mobile.html#' + to.path + linkQuery + let pathname = window.location.pathname + pathname = pathname.replace('casbi/', '') + pathname = pathname.replace('oidc/', '') + pathname = pathname.substring(0, pathname.length - 1) + const prefix = window.origin + pathname + let toPath = to.fullPath + if (toPath.includes('?')) { + toPath = to.fullPath.substring(0, to.fullPath.lastIndexOf('?')) + } + window.location.href = prefix + '/mobile.html#' + toPath + linkQuery } else if ( wsCache.get('user.token') || isDesktop || diff --git a/core/core-frontend/src/permissionMobile.ts b/core/core-frontend/src/permissionMobile.ts index a482159..a72d486 100644 --- a/core/core-frontend/src/permissionMobile.ts +++ b/core/core-frontend/src/permissionMobile.ts @@ -7,11 +7,13 @@ import { getRoleRouters } from '@/api/common' import { usePermissionStoreWithOut } from '@/store/modules/permission' import { interactiveStoreWithOut } from '@/store/modules/interactive' import { useAppearanceStoreWithOut } from '@/store/modules/appearance' +import { useLinkStoreWithOut } from '@/store/modules/link' const appearanceStore = useAppearanceStoreWithOut() const permissionStore = usePermissionStoreWithOut() const { wsCache } = useCache() const userStore = useUserStoreWithOut() +const linkStore = useLinkStoreWithOut() const { start, done } = useNProgress() const interactiveStore = interactiveStoreWithOut() @@ -26,6 +28,7 @@ router.beforeEach(async (to, _, next) => { if (to.name === 'link') { next() } else if (wsCache.get('user.token')) { + linkStore.setLinkToken('') if (!userStore.getUid) { await userStore.setUser() } @@ -44,6 +47,7 @@ router.beforeEach(async (to, _, next) => { if (whiteList.includes(to.path) || to.name === 'link') { next() } else { + linkStore.setLinkToken('') next('/login') // 否则全部重定向到登录页 } }