From 915424730f27445da2e8de13b62e77179cc1a15a Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期一, 18 八月 2025 17:07:39 +0800
Subject: [PATCH] fix: 关闭移动充值渠道,打开电信充值渠道
---
apps/taro/src/stores/modules/user.ts | 127 ++++++++++++++++++++++++-----------------
1 files changed, 74 insertions(+), 53 deletions(-)
diff --git a/apps/taro/src/stores/modules/user.ts b/apps/taro/src/stores/modules/user.ts
index cab0747..65c9724 100644
--- a/apps/taro/src/stores/modules/user.ts
+++ b/apps/taro/src/stores/modules/user.ts
@@ -14,7 +14,6 @@
LoginVirtualRes,
} from '@/utils/storage/auth';
import * as accountServices from '@life-payment/services/api/Account';
-import * as userServices from '@life-payment/services/api/User';
import Taro, { useRouter } from '@tarojs/taro';
import { ButtonProps } from '@tarojs/components';
import { debounce } from 'lodash';
@@ -22,6 +21,8 @@
import { getAccountInfoFromAccessToken, AccountInfo, setOSSLink } from '@life-payment/utils';
import DefaultAvatar from '@/assets/components/icon-default-avatar.png';
import { myClient } from '@/constants/query';
+import { blLifeRecharge } from '@/utils/blLifeRecharge';
+import { LifePayPhoneMesssageCodeLoginOutput } from '@life-payment/core-vue';
interface UserState {
userInfo?: Nullable<API.IdentityModelTokenCacheItem>;
@@ -36,13 +37,18 @@
virtualUserId?: string;
virtualPhoneNumber?: string;
+
+ wxCode?: string;
+ wxOpenId?: string;
+
+ virtualUserInfo?: LifePayPhoneMesssageCodeLoginOutput;
}
const goAuthorization = debounce(
() => {
const route = Taro.getCurrentInstance().router;
if (route.path !== RouterPath.authorization) {
- Taro.navigateTo({
+ RouteHelper.navigateTo({
url: RouterPath.authorization,
});
}
@@ -73,6 +79,9 @@
virtualUserId: storageVirtualUser?.virtualUserId ?? '',
virtualPhoneNumber: storageVirtualUser?.virtualPhoneNumber ?? '',
+
+ wxCode: '',
+ wxOpenId: '',
};
},
getters: {
@@ -104,37 +113,38 @@
wxMiniAppUserLoginRes: any
) {
try {
- let res: API.IdentityModelTokenCacheItem;
- if (!wxMiniAppUserLoginRes.accessToken) {
- let params: API.WxMiniAppPhoneLoginInput = {
- openId: wxMiniAppUserLoginRes.openId,
- sessionKey: wxMiniAppUserLoginRes.sessionKey,
- encryptedData: detail.encryptedData,
- iv: detail.iv,
- // wxMiniApp: WxMiniAppEnum.C绔皬绋嬪簭,
- };
- res = await accountServices.wxMiniAppPhoneAuthLogin(params);
- this.loginSuccess(res);
- }
- return res;
+ // let res: API.IdentityModelTokenCacheItem;
+ // if (!wxMiniAppUserLoginRes.accessToken) {
+ // let params: API.WxMiniAppPhoneLoginInput = {
+ // openId: wxMiniAppUserLoginRes.openId,
+ // sessionKey: wxMiniAppUserLoginRes.sessionKey,
+ // encryptedData: detail.encryptedData,
+ // iv: detail.iv,
+ // // wxMiniApp: WxMiniAppEnum.C绔皬绋嬪簭,
+ // };
+ // res = await accountServices.wxMiniAppPhoneAuthLogin(params);
+ // this.loginSuccess(res);
+ // }
+ // return res;
+ return 1;
} catch (error) {
console.log('error3: ', error);
}
},
// 鐢ㄦ埛鎵嬫満楠岃瘉鐮佺櫥鍏�
- async loginByUsername(data: API.PhoneMesssageCodeLoginInput) {
+ async loginByUsername(data: any) {
let res = await accountServices.lifePayPhoneMesssageCodeLogin(
{
phoneNumber: data.phoneNumber,
- code: data.code,
+ // code: data.code,
},
{ showLoading: false }
);
if (res) {
this.loginVirtualSuccess({
- virtualUserId: res,
+ virtualUserId: res.userId,
virtualPhoneNumber: data.phoneNumber,
});
}
@@ -143,17 +153,17 @@
// 鐢ㄦ埛璐﹀彿瀵嗙爜鐧诲叆
async loginByPassword(data: API.AccessRequestDto) {
- let res = await accountServices.passwordLogin(
- {
- loginName: data.userName,
- password: data.userPassword,
- },
- { showLoading: false }
- );
- if (res) {
- this.loginSuccess(res);
- }
- return res;
+ // let res = await accountServices.passwordLogin(
+ // {
+ // loginName: data.userName,
+ // password: data.userPassword,
+ // },
+ // { showLoading: false }
+ // );
+ // if (res) {
+ // this.loginSuccess(res);
+ // }
+ // return res;
},
async loginSuccess(res: API.IdentityModelTokenCacheItem) {
@@ -168,6 +178,7 @@
async loginVirtualSuccess(virtualUserRes: LoginVirtualRes) {
try {
this.setVirtualUserId(virtualUserRes);
+ this.getCurrentUserInfo();
} catch (error) {}
},
@@ -179,13 +190,14 @@
async wxMiniAppUserLoginFromScan(wxIndentityRes: API.WxMiniAppIndentityInfo, uuid: string) {
try {
- let res = await accountServices.wxMiniAppUserLoginFromScan({
- uId: uuid,
- userName: wxIndentityRes.userName,
- openId: wxIndentityRes.openId,
- });
- this.loginSuccess(res);
- return res;
+ // let res = await accountServices.wxMiniAppUserLoginFromScan({
+ // uId: uuid,
+ // userName: wxIndentityRes.userName,
+ // openId: wxIndentityRes.openId,
+ // });
+ // this.loginSuccess(res);
+ // return res;
+ return 1;
} catch (error) {}
},
@@ -195,28 +207,28 @@
uuid: string
) {
try {
- let res = await accountServices.wxMiniAppPhoneAuthLoginFromScan({
- uId: uuid,
- openId: wxIndentityRes.openId,
- sessionKey: wxIndentityRes.sessionKey,
- encryptedData: detail.encryptedData,
- iv: detail.iv,
- // wxMiniApp: WxMiniAppEnum.C绔皬绋嬪簭,
- });
- this.loginSuccess(res);
- return res;
+ // let res = await accountServices.wxMiniAppPhoneAuthLoginFromScan({
+ // uId: uuid,
+ // openId: wxIndentityRes.openId,
+ // sessionKey: wxIndentityRes.sessionKey,
+ // encryptedData: detail.encryptedData,
+ // iv: detail.iv,
+ // // wxMiniApp: WxMiniAppEnum.C绔皬绋嬪簭,
+ // });
+ // this.loginSuccess(res);
+ // return res;
+ return 1;
} catch (error) {}
},
async getCurrentUserInfo() {
try {
- let res = await userServices.getUserInfo({ showLoading: false });
- if (res) {
- res.originalAvatarUrl = res.avatarUrl;
- res.avatarUrl = res.avatarUrl ? setOSSLink(res.avatarUrl) : DefaultAvatar;
- this.setUserDetail(res);
- this.firstGetUserDetail = false;
- }
+ // let res = await blLifeRecharge.accountModel.getUserInfo(this.virtualUserId);
+ // if (res) {
+ // // this.setUserDetail(res);
+ // this.virtualUserInfo = res;
+ // this.firstGetUserDetail = false;
+ // }
} catch (error) {}
},
@@ -235,6 +247,13 @@
setUserDetail(detail);
},
+ setWxCode(code: string) {
+ this.wxCode = code;
+ },
+ setWxOpenId(openId: string) {
+ this.wxOpenId = openId;
+ },
+
resetState() {
this.userInfo = null;
this.token = '';
@@ -242,6 +261,8 @@
this.userDetail = null;
this.virtualUserId = '';
this.virtualPhoneNumber = '';
+ this.wxCode = '';
+ this.wxOpenId = '';
removeUserInfo();
removeUserDetail();
removeStorageVirtualUserId();
--
Gitblit v1.9.1