fix(移动端): 公共链接删除路径并登录提示路径异常

This commit is contained in:
dataeaseShu
2025-04-09 15:17:02 +08:00
committed by xuwei-fit2cloud
parent 1eceeef35b
commit 253e39d06c

View File

@@ -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') // 否则全部重定向到登录页
}
}