fix: 修复redirect跳转的bug
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user