瀏覽代碼

Merge branch 'master' of http://git.qmth.com.cn/ExamCloud-3/examcloud-web-admin

weiwenhai 6 年之前
父節點
當前提交
0802a44709
共有 3 個文件被更改,包括 26 次插入11 次删除
  1. 11 4
      src/modules/portal/views/home/Home.vue
  2. 1 1
      src/modules/portal/views/tips/Tips.vue
  3. 14 6
      src/plugins/axios.js

+ 11 - 4
src/modules/portal/views/home/Home.vue

@@ -203,18 +203,25 @@ export default {
       this.$refs.passForm.resetFields();
     },
     logout() {
+      const orgId = this.user.rootOrgId;
+      const getRootOrgId = () => {
+        if (location.hostname.includes("qmth.com.cn")) {
+          return "";
+        } else {
+          return "?orgId=" + orgId;
+        }
+      };
+
       this.$http
         .post(CORE_API + "/auth/logout")
         .then(() => {
-          const orgId = this.user.rootOrgId;
           this.USER_SIGNOUT();
           window.name = "";
           this.$router.replace({
-            path: "/login" + "?orgId=" + orgId
+            path: "/login" + getRootOrgId()
           });
         })
         .catch(response => {
-          const orgId = this.user.rootOrgId;
           if (response.status == 500) {
             this.$notify({
               showClose: true,
@@ -225,7 +232,7 @@ export default {
           this.USER_SIGNOUT();
           window.name = "";
           this.$router.replace({
-            path: "/login" + "?orgId=" + orgId
+            path: "/login" + getRootOrgId()
           });
         });
     }

+ 1 - 1
src/modules/portal/views/tips/Tips.vue

@@ -215,7 +215,7 @@ const ALL_INSTRUCTIONS = {
         {
           name: "试卷评阅-阅卷",
           link: "/marking/mark_setting_work/marking",
-          detail: "评卷员可以对已分配的试卷进行打。"
+          detail: "评卷员可以对已分配的试卷进行打。"
         }
       ]
     }

+ 14 - 6
src/plugins/axios.js

@@ -29,6 +29,14 @@ const _axiosWithoutResponseInterceptors = axios.create(config);
 let wk_token, wk_key;
 let wk_orgId;
 
+function getRootOrgId() {
+  if (location.hostname.includes("qmth.com.cn")) {
+    return "";
+  } else {
+    return "?orgId=" + (wk_orgId === undefined ? "" : wk_orgId);
+  }
+}
+
 _axios.interceptors.request.use(
   function(config) {
     // Do something before request is sent
@@ -47,7 +55,7 @@ _axios.interceptors.request.use(
               // } else {
               //   router.push("/login");
               // }
-              router.push("/login/" + "?orgId=" + wk_orgId);
+              router.push("/login/" + getRootOrgId());
             }
           });
           return;
@@ -86,7 +94,7 @@ _axiosWithoutResponseInterceptors.interceptors.request.use(
           Vue.prototype.$alert("登录失效,请重新登录!", "提示", {
             confirmButtonText: "确定",
             callback: () => {
-              router.push("/login/" + "?orgId=" + wk_orgId);
+              router.push("/login/" + getRootOrgId());
             }
           });
           return;
@@ -140,7 +148,7 @@ _axios.interceptors.response.use(
       Vue.prototype.$alert("登录失效,请重新登录!", "提示", {
         confirmButtonText: "确定",
         callback: () => {
-          router.push("/login/" + "?orgId=" + wk_orgId);
+          router.push("/login/" + getRootOrgId());
         }
       });
       return Promise.reject(error);
@@ -148,7 +156,7 @@ _axios.interceptors.response.use(
       Vue.prototype.$alert("没有权限!", "提示", {
         confirmButtonText: "确定",
         callback: () => {
-          router.push("/login/" + "?orgId=" + wk_orgId);
+          router.push("/login/" + getRootOrgId());
         }
       });
       return Promise.reject(error);
@@ -212,7 +220,7 @@ _axiosWithoutResponseInterceptors.interceptors.response.use(
       Vue.prototype.$alert("登录失效,请重新登录!", "提示", {
         confirmButtonText: "确定",
         callback: () => {
-          router.push("/login/" + "?orgId=" + wk_orgId);
+          router.push("/login/" + getRootOrgId());
         }
       });
       return Promise.reject(error);
@@ -220,7 +228,7 @@ _axiosWithoutResponseInterceptors.interceptors.response.use(
       Vue.prototype.$alert("没有权限!", "提示", {
         confirmButtonText: "确定",
         callback: () => {
-          router.push("/login/" + "?orgId=" + wk_orgId);
+          router.push("/login/" + getRootOrgId());
         }
       });
       return Promise.reject(error);