feat: 优化登录后的页面重定向逻辑

- 在路由守卫中,将重定向参数改为完整的编码路径
- 在登录成功后,根据重定向参数跳转到原请求页面
- 优化了账户、邮箱和手机登录后的重定向逻辑

Closes #IC42TM
Closes #1
This commit is contained in:
2025-07-07 21:11:20 +08:00
parent 3b3b35e0cb
commit aaefb7f8e4
5 changed files with 43 additions and 21 deletions

View File

@@ -110,7 +110,7 @@ export const setupRouterGuard = (router: Router) => {
} catch (error: any) {
// 过程中发生任何错误,都直接重置 Token并重定向到登录页面
await userStore.logoutCallBack()
next(`/login?redirect=${to.path}`)
next(`/login?redirect=${encodeURIComponent(to.fullPath)}`)
}
} else {
next()
@@ -123,7 +123,7 @@ export const setupRouterGuard = (router: Router) => {
next()
} else {
// 其他没有访问权限的页面将被重定向到登录页面
next('/login')
next(`/login?redirect=${encodeURIComponent(to.fullPath)}`)
}
}