From aef66ee6df2c91a2674c2eb9985c523ac7ca0344 Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Mon, 25 Aug 2025 14:57:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(router):=20=E4=BF=AE=E5=A4=8D=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E8=B7=B3=E8=BD=AC=E6=97=B6=E8=B7=AF=E5=BE=84=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E4=B8=A2=E5=A4=B1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用新的fullPath变量保存原始路径,避免在拼接查询参数时修改原始path变量 --- src/router/interceptor.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/router/interceptor.ts b/src/router/interceptor.ts index 38ef0ea..bd30736 100644 --- a/src/router/interceptor.ts +++ b/src/router/interceptor.ts @@ -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)