diff --git a/src/permission.ts b/src/permission.ts index aa9f520..b461e2e 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -102,10 +102,17 @@ router.beforeEach(async (to, from, next) => { } else { if(import.meta.env.VITE_DEFAULT_SSO =='true'){ authUtil.setTenantId("1") + // 正确构造包含查询参数的重定向URL + let redirectUrl = to.fullPath; + if (Object.keys(to.query).length > 0) { + const queryParams = new URLSearchParams(to.query as Record).toString(); + redirectUrl = `${to.path}?${queryParams}`; + } + const redirectUri = location.origin + '/social-login?' + - `type=100&redirect=${to.fullPath}` + `type=100&redirect=${encodeURIComponent(redirectUrl)}` // 进行跳转 const res = await LoginApi.socialAuthRedirect(100, encodeURIComponent(redirectUri))