fix: 修复redirect跳转的bug

This commit is contained in:
piexlMax(奇淼
2025-04-15 18:01:01 +08:00
parent 90c8a240a1
commit 84a3c3ba7c
2 changed files with 7 additions and 2 deletions

View File

@@ -115,7 +115,7 @@ router.beforeEach(async (to, from) => {
return {
name: 'Login',
query: { redirect: to.href }
query: { redirect: to.fullPath }
}
}
@@ -126,7 +126,7 @@ router.beforeEach(async (to, from) => {
return {
name: 'Login',
query: {
redirect: document.location.hash
redirect: to.fullPath
}
}
})

View File

@@ -88,6 +88,11 @@ export const useUserStore = defineStore('user', () => {
router.addRoute(asyncRouter)
})
if(router.currentRoute.value.query.redirect) {
await router.replace(router.currentRoute.value.query.redirect)
return true
}
if (!router.hasRoute(userInfo.value.authority.defaultRouter)) {
ElMessage.error('请联系管理员进行授权')
} else {