From 5eb6e6bab29554390851bbed86615110e62efa48 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期一, 11 八月 2025 13:43:18 +0800
Subject: [PATCH] Merge branch 'master' of http://120.26.58.240:8888/r/flexJobMiniApp

---
 apps/cMiniApp/src/stores/modules/user.ts |   46 ++++++++++++++++++++++++++--------------------
 1 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/apps/cMiniApp/src/stores/modules/user.ts b/apps/cMiniApp/src/stores/modules/user.ts
index 20364b5..21cf5ab 100644
--- a/apps/cMiniApp/src/stores/modules/user.ts
+++ b/apps/cMiniApp/src/stores/modules/user.ts
@@ -31,7 +31,7 @@
 import { AppLocalConfig } from '@/constants';
 
 interface UserState {
-  userInfo?: Nullable<API.PasswordLoginCommandCallback>;
+  userInfo?: Nullable<API.LoginCommandCallback>;
   token?: Nullable<string>;
   refreshToken?: Nullable<string>;
   userDetail?: Nullable<API.UserInfoV2>;
@@ -87,6 +87,10 @@
     accountInfo(): Partial<AccountInfo> {
       return getAccountInfoFromAccessToken(this.userInfo?.accessToken);
     },
+
+    userId: (state) => {
+      return state.userInfo?.id ?? '';
+    },
   },
   actions: {
     // 鎵嬫満鍙锋巿鏉僀ode鐧诲綍
@@ -114,11 +118,13 @@
     },
 
     // 鐢ㄦ埛鎵嬫満楠岃瘉鐮佺櫥鍏�
-    async loginByUsername(data: API.PhoneMesssageCodeLoginInput) {
-      let res = await accountServices.phoneMesssageCodeLogin(
+    async loginByUsername(data: API.SmsLoginCommand) {
+      let res = await authServices.smsLogin(
         {
           phoneNumber: data.phoneNumber,
-          code: data.code,
+          verifyCode: data.verifyCode,
+          type: AppLocalConfig.userType,
+          clientType: AppLocalConfig.clientType,
         },
         { showLoading: false }
       );
@@ -146,7 +152,7 @@
       return res;
     },
 
-    async loginSuccess(res: API.PasswordLoginCommandCallback) {
+    async loginSuccess(res: API.LoginCommandCallback) {
       try {
         this.setUserInfoAction(res);
         this.setTokenAction(res);
@@ -186,27 +192,27 @@
     },
 
     async getCurrentUserInfo() {
-      try {
-        let res = await userServices.getUserInfo({ showLoading: false });
-        if (res) {
-          // res.frontStatus = getUserCertificationFrontStatusAdapter(
-          //   res.userCertificationStatus,
-          //   res.userCertificationAuditStatus
-          // );
-          // res.originalAvatarUrl = res.avatarUrl;
-          // res.avatarUrl = res.avatarUrl ? setOSSLink(res.avatarUrl) : DefaultAvatar;
-          // this.setUserDetail(res);
-          // this.firstGetUserDetail = false;
-        }
-      } catch (error) {}
+      // try {
+      //   let res = await userServices.getUserInfo({ showLoading: false });
+      //   if (res) {
+      //     res.frontStatus = getUserCertificationFrontStatusAdapter(
+      //       res.userCertificationStatus,
+      //       res.userCertificationAuditStatus
+      //     );
+      //     res.originalAvatarUrl = res.avatarUrl;
+      //     res.avatarUrl = res.avatarUrl ? setOSSLink(res.avatarUrl) : DefaultAvatar;
+      //     this.setUserDetail(res);
+      //     this.firstGetUserDetail = false;
+      //   }
+      // } catch (error) {}
     },
 
-    setTokenAction(tokenInfo: API.PasswordLoginCommandCallback) {
+    setTokenAction(tokenInfo: API.LoginCommandCallback) {
       this.token = tokenInfo?.accessToken;
       this.refreshToken = tokenInfo.refreshToken ?? '';
     },
 
-    setUserInfoAction(info: API.PasswordLoginCommandCallback) {
+    setUserInfoAction(info: API.LoginCommandCallback) {
       this.userInfo = info;
       setUserInfo(info);
     },

--
Gitblit v1.9.1