|
@@ -173,18 +173,13 @@ export const useUserStore = defineStore({
|
|
|
|
|
|
// 登录到jflow
|
|
|
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 {
|
|
|
+ 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 { Token } = jflowInfo;
|
|
|
- console.log("登录到JFlow并拿到Token:"+Token)
|
|
|
this.setJFlowToken(Token);
|
|
|
} 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.setTenant(userInfo.loginTenantId);
|
|
|
// await this.loginToJFlow(userInfo.username, mode);
|
|
|
+
|
|
|
return this.afterLoginAction(goHome, data);
|
|
|
} catch (error) {
|
|
|
return Promise.reject(error);
|
|
@@ -229,6 +225,8 @@ export const useUserStore = defineStore({
|
|
|
if (!this.getToken) return null;
|
|
|
//获取用户信息
|
|
|
const userInfo = await this.getUserInfoAction();
|
|
|
+ const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
|
|
|
+ await delay(3000); // 延迟3秒
|
|
|
const sessionTimeout = this.sessionTimeout;
|
|
|
if (sessionTimeout) {
|
|
|
this.setSessionTimeout(false);
|