Skip to content

Commit 84a3c3b

Browse files
author
piexlMax(奇淼
committed
fix: 修复redirect跳转的bug
1 parent 90c8a24 commit 84a3c3b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Diff for: web/src/permission.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ router.beforeEach(async (to, from) => {
115115

116116
return {
117117
name: 'Login',
118-
query: { redirect: to.href }
118+
query: { redirect: to.fullPath }
119119
}
120120
}
121121

@@ -126,7 +126,7 @@ router.beforeEach(async (to, from) => {
126126
return {
127127
name: 'Login',
128128
query: {
129-
redirect: document.location.hash
129+
redirect: to.fullPath
130130
}
131131
}
132132
})

Diff for: web/src/pinia/modules/user.js

+5
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ export const useUserStore = defineStore('user', () => {
8888
router.addRoute(asyncRouter)
8989
})
9090

91+
if(router.currentRoute.value.query.redirect) {
92+
await router.replace(router.currentRoute.value.query.redirect)
93+
return true
94+
}
95+
9196
if (!router.hasRoute(userInfo.value.authority.defaultRouter)) {
9297
ElMessage.error('请联系管理员进行授权')
9398
} else {

0 commit comments

Comments
 (0)