natasha пре 11 месеци
родитељ
комит
7f3af25dba
1 измењених фајлова са 56 додато и 2 уклоњено
  1. 56 2
      src/views/login/index.vue

+ 56 - 2
src/views/login/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="index" v-if="isData && configInfor">
+  <div class="index" v-if="isData && configInfor" v-loading="loading">
     <template v-if="isPc">
       <div class="shadow" v-if="LoginOrRegistration != 'signin'">
         <LoginNav
@@ -116,10 +116,11 @@ import LoginNav from "@/components/login/LoginNav";
 
 import { getLogin, getContent, getAcsCode, getStaticContent } from "@/api/api";
 import { updateWordPack } from "@/utils/i18n";
-import { getToken, removeToken } from "@/utils/auth";
+import { getToken, removeToken, setToken } from "@/utils/auth";
 
 import { getConfigInfor } from "@/utils/index";
 import { mapGetters } from "vuex";
+import { setI18nLang } from "@/utils/i18n";
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: {
@@ -268,6 +269,7 @@ export default {
       isData: false,
       emailTipShow: false,
       emailTipDay: 0,
+      loading: false,
     };
   },
   //计算属性 类似于data概念
@@ -456,6 +458,55 @@ export default {
       this.emailTipShow = false;
       this.browserRedirect();
     },
+    // clever登录
+    getLoginClever() {
+      this.loading = true;
+      let MethodName = "login_control-Login_Clever";
+      let data = {
+        code: this.$route.query.code,
+      };
+      getLogin(MethodName, data)
+        .then((res) => {
+          this.loading = false;
+          if (res.status == -5) {
+            this.$message.error(res.error);
+            return;
+          }
+
+          setToken(res);
+          let isShare = this.$route.query.temporary_link
+            ? decodeURIComponent(this.$route.query.temporary_link)
+            : "";
+          // if (
+          //   res.last_update_password_days >=
+          //     res.sys_recommend_password_update_days &&
+          //   !isShare
+          // ) {
+          //   this.changeEmailTips(res.last_update_password_days);
+          // } else {
+          this.$message.success(this.$t("Key442"));
+          setI18nLang(this.language_type).then(() => {
+            if (isShare) {
+              location.href = isShare;
+            } else if (localStorage.getItem("testLink")) {
+              location.href = localStorage.getItem("testLink");
+              localStorage.removeItem("testLink");
+            } else if (
+              res.popedom_code_list.indexOf(2000001) > -1 ||
+              res.user_type == "STUDENT"
+            ) {
+              this.$message.warning(this.$t("Key247") + "....");
+              location.href = `/GCLS-Learn/#/EnterSys`;
+            } else {
+              this.getChildSysList();
+            }
+          });
+          // }
+        })
+        .catch((err) => {
+          this.loading = false;
+        });
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   async created() {
@@ -506,6 +557,9 @@ export default {
       ],
     });
     this.isData = true;
+    if (this.$route.query.code) {
+      this.getLoginClever();
+    }
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {