fix(router): 修复登录跳转时路径参数丢失的问题

使用新的fullPath变量保存原始路径,避免在拼接查询参数时修改原始path变量
This commit is contained in:
feige996
2025-08-25 14:57:19 +08:00
parent 70b628b7ea
commit aef66ee6df

View File

@@ -39,11 +39,12 @@ export const navigateToInterceptor = {
console.log('命中了 LOGIN_PAGE_LIST')
return
}
let fullPath = path
if (myQuery) {
path += `?${Object.keys(myQuery).map(key => `${key}=${myQuery[key]}`).join('&')}`
fullPath += `?${Object.keys(myQuery).map(key => `${key}=${myQuery[key]}`).join('&')}`
}
const redirectUrl = `${LOGIN_PAGE}?redirect=${encodeURIComponent(path)}`
const redirectUrl = `${LOGIN_PAGE}?redirect=${encodeURIComponent(fullPath)}`
const tokenStore = useTokenStore()
console.log('tokenStore.hasLogin:', tokenStore.hasLogin)