Procházet zdrojové kódy

登录失效,epcc 返回指定 returnUrl

Michael Wang před 5 roky
rodič
revize
84eab1a2a0
1 změnil soubory, kde provedl 15 přidání a 2 odebrání
  1. 15 2
      src/utils/axios.js

+ 15 - 2
src/utils/axios.js

@@ -2,7 +2,7 @@ import Vue from "vue";
 import axios from "axios";
 import { loadProgressBar } from "./axiosProgress";
 import cachingGet from "./axiosCache";
-import { Message } from "iview";
+import { Message, Modal } from "iview";
 import router from "../router";
 //axios配置 start
 
@@ -89,9 +89,22 @@ qmInstance.interceptors.response.use(
           closable: true,
         });
         window.___lastInvalidDate = Date.now();
+
+        const redirectUrl = sessionStorage.getItem("redirectUrl");
+        if (redirectUrl) {
+          Modal.error({
+            title: "确认退出",
+            content: "登录失效",
+            onOk: () => {
+              window.location = redirectUrl;
+            },
+          });
+        } else {
+          router.push("/login/" + localStorage.getItem("domain"));
+        }
       }
       wk_token = null;
-      router.push("/login/" + localStorage.getItem("domain"));
+      // router.push("/login/" + localStorage.getItem("domain"));
       return; // 仅显示登录失效,不显示因登录失效造成的后续错误
     } else if (status == 502) {
       Message.error({