From a3be4bd8a96df6b27e4f0d3883d661d9cb64d1fc Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期五, 21 二月 2025 14:47:05 +0800
Subject: [PATCH] fix: 页面
---
apps/taro/src/stores/modules/user.ts | 33 ++++++++++++++++++++++++++-------
1 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/apps/taro/src/stores/modules/user.ts b/apps/taro/src/stores/modules/user.ts
index 24f87f0..29663e5 100644
--- a/apps/taro/src/stores/modules/user.ts
+++ b/apps/taro/src/stores/modules/user.ts
@@ -8,6 +8,9 @@
setUserDetail,
getUserDetail,
removeUserDetail,
+ setStorageVirtualUserId,
+ getStorageVirtualUserId,
+ removeStorageVirtualUserId,
} from '@/utils/storage/auth';
import * as accountServices from '@life-payment/services/api/Account';
import * as userServices from '@life-payment/services/api/User';
@@ -29,6 +32,8 @@
locationCity?: string;
locationProvince?: string;
firstSetLocation?: boolean;
+
+ virtualUserId?: string;
}
const goAuthorization = debounce(
@@ -62,6 +67,8 @@
refreshToken: userInfo?.refreshToken ?? '',
userDetail: userDetail,
firstGetUserDetail: true,
+
+ virtualUserId: getStorageVirtualUserId() ?? '',
};
},
getters: {
@@ -122,7 +129,7 @@
);
if (res) {
- this.loginSuccess(res);
+ this.loginVirtualSuccess(res);
}
return res;
},
@@ -142,13 +149,24 @@
return res;
},
- async loginSuccess(res: API.IdentityModelTokenCacheItem | string) {
+ async loginSuccess(res: API.IdentityModelTokenCacheItem) {
console.log('res: ', res);
- // try {
- // this.setUserInfoAction(res);
- // this.setTokenAction(res);
- // await this.getCurrentUserInfo();
- // } catch (error) {}
+ try {
+ this.setUserInfoAction(res);
+ this.setTokenAction(res);
+ await this.getCurrentUserInfo();
+ } catch (error) {}
+ },
+
+ async loginVirtualSuccess(virtualUserId: string) {
+ try {
+ this.setVirtualUserId(virtualUserId);
+ } catch (error) {}
+ },
+
+ setVirtualUserId(virtualUserId: string) {
+ this.virtualUserId = virtualUserId;
+ setStorageVirtualUserId(virtualUserId);
},
async wxMiniAppUserLoginFromScan(wxIndentityRes: API.WxMiniAppIndentityInfo, uuid: string) {
@@ -216,6 +234,7 @@
this.userDetail = null;
removeUserInfo();
removeUserDetail();
+ removeStorageVirtualUserId();
},
/**
--
Gitblit v1.10.0