From 0692f4289ee0046a50602adc065f1ececa90dfea Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期日, 19 十月 2025 16:54:29 +0800
Subject: [PATCH] Merge branch 'dev-1.2.0.1' of http://120.26.58.240:8888/r/flexJobAdminBClient into dev-1.2.0.1
---
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