From da784a6d8ee91a6170b7b03c780a0f725660c1d9 Mon Sep 17 00:00:00 2001 From: zhengyiming <540361168@qq.com> Date: 星期五, 21 二月 2025 14:48:16 +0800 Subject: [PATCH] fix: 页面 --- apps/taro/src/hooks/user.ts | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/taro/src/hooks/user.ts b/apps/taro/src/hooks/user.ts index 7373103..29a6ef4 100644 --- a/apps/taro/src/hooks/user.ts +++ b/apps/taro/src/hooks/user.ts @@ -5,11 +5,13 @@ import { useQuery } from '@tanstack/vue-query'; import { MaybeRef } from 'vue'; import { useRefeshDidShow } from './infiniteLoading'; +import { LoginFormTabs } from '@/subpackages/login/constants'; +import { useLoginedJump } from './login'; export function useUser() { const userStore = useUserStore(); - const { userDetail, userInfo, locationCity } = storeToRefs(userStore); + const { userDetail, userInfo, locationCity, virtualUserId } = storeToRefs(userStore); function updateUserInfo() { return userStore.getCurrentUserInfo(); @@ -20,13 +22,14 @@ userDetail: userDetail, updateUserInfo, locationCity, + virtualUserId, }; } export function useIsLogin() { - const { user, userDetail } = useUser(); - return computed(() => !!user.value); - // return user?.isPersonal ? !!user : !!user && !!enterpriseInfo; + const { virtualUserId } = useUser(); + // return computed(() => !!user.value); + return computed(() => !!virtualUserId.value); } type UseAuthOptions = { @@ -45,7 +48,7 @@ Taro.useReady(async () => { if (isLogin.value && userStore.firstGetUserDetail) { - userStore.getCurrentUserInfo(); + // userStore.getCurrentUserInfo(); } if (needAuth && !isLogin.value) { Taro.navigateTo({ @@ -59,10 +62,14 @@ export function useGoLogin() { const router = Taro.useRouter(); - + const { redirectParams } = useLoginedJump(); function goLoginFn() { + // Taro.navigateTo({ + // url: `${RouterPath.authorization}?redirect=${router.path}&${object2query(router.params)}`, + // }); + Taro.navigateTo({ - url: `${RouterPath.authorization}?redirect=${router.path}&${object2query(router.params)}`, + url: `${RouterPath.loginByForm}?redirect=${redirectParams.value}&tab=${LoginFormTabs.VerificationCodeLogin}`, }); } -- Gitblit v1.9.1