From 64b52fa928e11640e8d6aad49bd39cd27c896543 Mon Sep 17 00:00:00 2001 From: wupengfei <834520024@qq.com> Date: 星期五, 21 二月 2025 18:42:13 +0800 Subject: [PATCH] feat: 订单 --- apps/taro/src/stores/modules/user.ts | 26 +++++++++++++++++++++++--- 1 files changed, 23 insertions(+), 3 deletions(-) diff --git a/apps/taro/src/stores/modules/user.ts b/apps/taro/src/stores/modules/user.ts index 7c3f0ab..b101a3d 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: { @@ -113,7 +120,7 @@ // 鐢ㄦ埛鎵嬫満楠岃瘉鐮佺櫥鍏� async loginByUsername(data: API.PhoneMesssageCodeLoginInput) { - let res = await accountServices.phoneMesssageCodeLogin( + let res = await accountServices.lifePayPhoneMesssageCodeLogin( { phoneNumber: data.phoneNumber, code: data.code, @@ -122,7 +129,7 @@ ); if (res) { - this.loginSuccess(res); + this.loginVirtualSuccess(res); } return res; }, @@ -143,11 +150,23 @@ }, async loginSuccess(res: API.IdentityModelTokenCacheItem) { + console.log('res: ', res); 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) { @@ -215,6 +234,7 @@ this.userDetail = null; removeUserInfo(); removeUserDetail(); + removeStorageVirtualUserId(); }, /** @@ -223,7 +243,7 @@ logout() { this.resetState(); myClient.removeQueries(); - goAuthorization(); + // goAuthorization(); }, logoutAndToHome() { -- Gitblit v1.9.1