xiatian 1 viikko sitten
vanhempi
commit
327e36b1d2
2 muutettua tiedostoa jossa 50 lisäystä ja 29 poistoa
  1. 2 0
      src/modules/portal/views/Access.vue
  2. 48 29
      src/modules/portal/views/home/Home.vue

+ 2 - 0
src/modules/portal/views/Access.vue

@@ -29,6 +29,7 @@ export default {
     this.accessInfo.appId = params.appId;
     this.accessInfo.timestamp = params.timestamp;
     this.accessInfo.token = params.token;
+    this.accessInfo.from = params.from;
 
     const url = CORE_API + "/auth/thirdPartyAccess";
     this.$httpWithMsg
@@ -37,6 +38,7 @@ export default {
       })
       .then((response) => {
         var user = response.data;
+        user.from = this.accessInfo.from;
         this.USER_SIGNIN(user);
         this.$router.replace({ path: "/home/overview" });
         this.$notify({

+ 48 - 29
src/modules/portal/views/home/Home.vue

@@ -347,38 +347,57 @@ 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(() => {
-          this.USER_SIGNOUT();
-          window.name = "";
-          this.$router.replace({
-            path: "/login" + getRootOrgId(),
+      if ("cas" == this.user.from) {
+        var schoolCode = window.location.hostname.split(".")[0];
+        this.$http
+          .get("https://auth.exam-cloud.cn/api/open/auth/logout/" + schoolCode)
+          .then(() => {
+            this.USER_SIGNOUT();
+          })
+          .catch((response) => {
+            if (response.status == 500) {
+              this.$notify({
+                showClose: true,
+                message: response.data.desc,
+                type: "error",
+              });
+            }
+            this.USER_SIGNOUT();
           });
-        })
-        .catch((response) => {
-          if (response.status == 500) {
-            this.$notify({
-              showClose: true,
-              message: response.data.desc,
-              type: "error",
-            });
+      } else {
+        const orgId = this.user.rootOrgId;
+        const getRootOrgId = () => {
+          if (location.hostname.includes("qmth.com.cn")) {
+            return "";
+          } else {
+            return "?orgId=" + orgId;
           }
-          this.USER_SIGNOUT();
-          window.name = "";
-          this.$router.replace({
-            path: "/login" + getRootOrgId(),
+        };
+
+        this.$http
+          .post(CORE_API + "/auth/logout")
+          .then(() => {
+            this.USER_SIGNOUT();
+            window.name = "";
+            this.$router.replace({
+              path: "/login" + getRootOrgId(),
+            });
+          })
+          .catch((response) => {
+            if (response.status == 500) {
+              this.$notify({
+                showClose: true,
+                message: response.data.desc,
+                type: "error",
+              });
+            }
+            this.USER_SIGNOUT();
+            window.name = "";
+            this.$router.replace({
+              path: "/login" + getRootOrgId(),
+            });
           });
-        });
+      }
     },
   },
 };