From 8fad5b05aa4d6d4a46b3bc04f2ab9614be73ba99 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期二, 23 九月 2025 17:19:06 +0800
Subject: [PATCH] fix: bug

---
 src/store/modules/user.ts |   31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index 42a97e2..91a830c 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -8,6 +8,9 @@
   setUserInfo,
   getUserInfo,
   md5Encrypt,
+  getUserDetail,
+  setUserDetail,
+  removeUserDetail,
 } from '@/utils';
 import { resetRouter, router } from '@/router';
 import { useTagsViewStoreHook } from './tagsView';
@@ -20,15 +23,18 @@
 export interface UserState {
   token: string;
   userInfo: API.LoginCommandCallback;
+  userDetail?: Nullable<API.GetEnterpriseLoginInfoQueryResult>;
 }
 
 function getDefaultState() {
   const accessToken = getToken();
   const userInfo = getUserInfo();
+  const userDetail = getUserDetail();
 
   return {
     token: accessToken,
     userInfo: userInfo || {},
+    userDetail: userDetail,
   } as UserState;
 }
 
@@ -44,7 +50,7 @@
     },
 
     userId(state) {
-      return '';
+      return state.userDetail?.id;
     },
   },
   actions: {
@@ -57,25 +63,43 @@
       setUserInfo(userInfo);
     },
 
+    setUserDetail(detail: API.GetEnterpriseLoginInfoQueryResult) {
+      this.userDetail = detail;
+      setUserDetail(detail);
+    },
+
     // 鐢ㄦ埛鐧诲叆
     async loginByUsername(params: API.PasswordLoginCommand) {
       let res = await authServices.passwordLogin(
         {
           ...params,
-          password: (params.password),
+          password: params.password,
           // password: md5Encrypt(params.password),
           type: AppLocalConfig.userType,
           clientType: AppLocalConfig.clientType,
         },
         {
           showLoading: false,
-          skipErrorHandler: true,
         }
       );
       if (res) {
         this.setToken(res.accessToken);
         this.setUserInfo(res);
+        this.getCurrentUserInfo();
       }
+    },
+
+    async getCurrentUserInfo() {
+      try {
+        let res = await authServices.getEnterpriseLoginInfo({}, { showLoading: false });
+        if (res) {
+          // res.frontStatus = getUserCertificationFrontStatusAdapter(
+          //   res.userCertificationStatus,
+          //   res.userCertificationAuditStatus
+          // );
+          this.setUserDetail(res);
+        }
+      } catch (error) {}
     },
 
     // 鐧诲嚭 娓呯┖缂撳瓨
@@ -83,6 +107,7 @@
       return new Promise(async (resolve) => {
         removeToken();
         removeUserInfo();
+        removeUserDetail();
         this.resetState();
         resetRouter();
         myClient.removeQueries();

--
Gitblit v1.9.1