Ver código fonte

解决 缺陷13730 流程模块下线,系统无法登入

LT32820A 1 semana atrás
pai
commit
470fab6891

+ 1 - 1
jeecgboot-vue3/src/api/sys/user.ts

@@ -73,7 +73,7 @@ export function jflowLoginApi(params, mode: ErrorMessageMode = 'modal') {
       url: Api.jflowLogin + '?userNo=' + params.userNo + '&privateKey=' + params.privateKey +'&jeecgToken=' + params.jeecgToken,
     },
     {
-      errorMessageMode: mode,
+      errorMessageMode: "none",
     }
   );
 }

+ 5 - 7
jeecgboot-vue3/src/store/modules/user.ts

@@ -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);