|
@@ -173,18 +173,13 @@ export const useUserStore = defineStore({
|
|
|
|
|
|
// 登录到jflow
|
|
// 登录到jflow
|
|
async loginToJFlow(username: string, mode: ErrorMessageMode) {
|
|
async loginToJFlow(username: string, mode: ErrorMessageMode) {
|
|
- console.log("执行了登录JFlow方法:"+this.getToken)
|
|
|
|
- //jflowtoken
|
|
|
|
- const jflowLoginInfo = await jflowLoginApi({ userNo: username, privateKey: import.meta.env.VITE_APP_JFLOW_KEY, jeecgToken: this.getToken }, mode);
|
|
|
|
- console.dir(jflowLoginInfo)
|
|
|
|
try {
|
|
try {
|
|
|
|
+ const jflowLoginInfo = await jflowLoginApi({ userNo: username, privateKey: import.meta.env.VITE_APP_JFLOW_KEY, jeecgToken: this.getToken }, mode);
|
|
const jflowInfo = JSON.parse(jflowLoginInfo as string);
|
|
const jflowInfo = JSON.parse(jflowLoginInfo as string);
|
|
const { Token } = jflowInfo;
|
|
const { Token } = jflowInfo;
|
|
- console.log("登录到JFlow并拿到Token:"+Token)
|
|
|
|
this.setJFlowToken(Token);
|
|
this.setJFlowToken(Token);
|
|
} catch (err: any) {
|
|
} catch (err: any) {
|
|
- console.error(err.toString());
|
|
|
|
- message.error('jflow登录失败,请重新登录');
|
|
|
|
|
|
+ if (err.response.status === 503) message.warning('Jflow服务不可用');
|
|
}
|
|
}
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
@@ -204,6 +199,7 @@ export const useUserStore = defineStore({
|
|
this.setToken(token);
|
|
this.setToken(token);
|
|
this.setTenant(userInfo.loginTenantId);
|
|
this.setTenant(userInfo.loginTenantId);
|
|
// await this.loginToJFlow(userInfo.username, mode);
|
|
// await this.loginToJFlow(userInfo.username, mode);
|
|
|
|
+
|
|
return this.afterLoginAction(goHome, data);
|
|
return this.afterLoginAction(goHome, data);
|
|
} catch (error) {
|
|
} catch (error) {
|
|
return Promise.reject(error);
|
|
return Promise.reject(error);
|
|
@@ -229,6 +225,8 @@ export const useUserStore = defineStore({
|
|
if (!this.getToken) return null;
|
|
if (!this.getToken) return null;
|
|
//获取用户信息
|
|
//获取用户信息
|
|
const userInfo = await this.getUserInfoAction();
|
|
const userInfo = await this.getUserInfoAction();
|
|
|
|
+ const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
|
|
|
|
+ await delay(3000); // 延迟3秒
|
|
const sessionTimeout = this.sessionTimeout;
|
|
const sessionTimeout = this.sessionTimeout;
|
|
if (sessionTimeout) {
|
|
if (sessionTimeout) {
|
|
this.setSessionTimeout(false);
|
|
this.setSessionTimeout(false);
|