From f4d3a468d151ce6ff4ef6b2158c2b13ebae18d43 Mon Sep 17 00:00:00 2001 From: zhengyiming <540361168@qq.com> Date: 星期三, 19 三月 2025 18:05:13 +0800 Subject: [PATCH] fix: 三期需求 --- apps/taro/src/hooks/user.ts | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/taro/src/hooks/user.ts b/apps/taro/src/hooks/user.ts index a652bd0..67a64fe 100644 --- a/apps/taro/src/hooks/user.ts +++ b/apps/taro/src/hooks/user.ts @@ -65,7 +65,7 @@ // userStore.getCurrentUserInfo(); } if (needAuth && !isLogin.value) { - Taro.navigateTo({ + RouteHelper.navigateTo({ url: `${RouterPath.loginByForm}?redirect=${router.path}&${object2query(router.params)}`, }); } @@ -87,8 +87,10 @@ Taro.useReady(async () => { try { //@ts-ignore - if (!code && isInWeChat && !wxCode.value) { - location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf940ff1d35a98493&redirect_uri=${location.href}&response_type=code&scope=snsapi_base#wechat_redirect`; + if (!code && isInWeChat && !wxCode.value && location?.replace) { + location.replace( + `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf940ff1d35a98493&redirect_uri=${location.href}&response_type=code&scope=snsapi_base#wechat_redirect` + ); } if (!!code && !wxCode.value) { userStore.setWxCode(router.params.code ?? ''); @@ -115,11 +117,11 @@ const router = Taro.useRouter(); const { redirectParams } = useLoginedJump(); function goLoginFn() { - // Taro.navigateTo({ + // RouteHelper.navigateTo({ // url: `${RouterPath.authorization}?redirect=${router.path}&${object2query(router.params)}`, // }); - Taro.navigateTo({ + RouteHelper.navigateTo({ url: `${RouterPath.loginByForm}?redirect=${redirectParams.value}&tab=${LoginFormTabs.VerificationCodeLogin}`, }); } -- Gitblit v1.9.1