From c0bcba49bef43b880978ff63b2ac00f1ba5c5c6a Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期三, 21 五月 2025 16:13:59 +0800
Subject: [PATCH] fix: 修改ui

---
 apps/taro/src/hooks/user.ts |   54 ++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/apps/taro/src/hooks/user.ts b/apps/taro/src/hooks/user.ts
index 757a837..981d80e 100644
--- a/apps/taro/src/hooks/user.ts
+++ b/apps/taro/src/hooks/user.ts
@@ -6,8 +6,36 @@
 import { useRefeshDidShow } from './infiniteLoading';
 import { LoginFormTabs } from '@/subpackages/login/constants';
 import { useLoginedJump } from './login';
-import { useLifeRechargeContext, APIgetLifePayWxIndentityParams } from '@life-payment/core-vue';
+import {
+  useLifeRechargeContext,
+  APIgetLifePayWxIndentityParams,
+  WxMiniAppIndentityInfo,
+  LifePayPhoneMesssageCodeLoginOutput,
+} from '@life-payment/core-vue';
 import { isInWeChat } from '@/utils/env';
+
+export function useVirtualUserInfo() {
+  const { blLifeRecharge } = useLifeRechargeContext();
+
+  const { data: virtualUserInfo } = useQuery({
+    queryKey: ['blLifeRecharge/lifePayUserMesssageByIduser', blLifeRecharge.accountModel.userId],
+    queryFn: async () => {
+      return await blLifeRecharge.services.lifePayUserMesssageByIduser(
+        {
+          id: blLifeRecharge.accountModel.userId,
+        },
+        {
+          showLoading: false,
+        }
+      );
+    },
+    placeholderData: () => ({} as LifePayPhoneMesssageCodeLoginOutput),
+    enabled: computed(() => !!blLifeRecharge.accountModel.userId),
+    staleTime: Infinity,
+  });
+
+  return { virtualUserInfo };
+}
 
 export function useUser() {
   const userStore = useUserStore();
@@ -26,7 +54,10 @@
     return userStore.getCurrentUserInfo();
   }
 
-  const isChannelAccount = computed(() => true);
+  const { blLifeRecharge } = useLifeRechargeContext();
+  // const { virtualUserInfo } = useVirtualUserInfo();
+
+  const isChannelAccount = computed(() => blLifeRecharge.accountModel.isBackClientUser);
 
   return {
     user: userInfo,
@@ -38,6 +69,7 @@
     wxCode,
     wxOpenId,
     isChannelAccount,
+    // virtualUserInfo,
   };
 }
 
@@ -98,11 +130,13 @@
       }
       if (!!code && !wxCode.value) {
         userStore.setWxCode(router.params.code ?? '');
-        // getLifePayWxIndentity(code);
+        getLifePayWxIndentity(code);
       }
     } catch (error) {}
   });
 }
+
+let wxIndentityPromise: Promise<WxMiniAppIndentityInfo>;
 
 export function useLifePayWxIndentity() {
   const { blLifeRecharge } = useLifeRechargeContext();
@@ -113,9 +147,17 @@
       let params: APIgetLifePayWxIndentityParams = {
         code: code,
       };
-      let res = await blLifeRecharge.services.getLifePayWxIndentity(params, {
-        showLoading: false,
-      });
+      if (!wxIndentityPromise) {
+        wxIndentityPromise = blLifeRecharge.services
+          .getLifePayWxIndentity(params, {
+            showLoading: false,
+          })
+          .finally(() => {
+            wxIndentityPromise = undefined;
+          });
+      }
+
+      let res = await wxIndentityPromise;
       if (res.openId) {
         userStore.setWxOpenId(res.openId);
       }

--
Gitblit v1.9.1