瀏覽代碼

添加登录后跳转

natasha 1 年之前
父節點
當前提交
01654e2c4e
共有 1 個文件被更改,包括 58 次插入35 次删除
  1. 58 35
      src/components/login/login.vue

+ 58 - 35
src/components/login/login.vue

@@ -119,9 +119,12 @@
             @input="ChangeVericationCode"
             maxlength="20"
           />
-          <div class="verificationCode-btn" @click="getVerificationCode"
-                :class="VerificationCodeShow ? 'waitTime' : 'getVerification'">
-                {{ VerificationCodeShow ? time+'s' : $t("Key93") }}
+          <div
+            class="verificationCode-btn"
+            @click="getVerificationCode"
+            :class="VerificationCodeShow ? 'waitTime' : 'getVerification'"
+          >
+            {{ VerificationCodeShow ? time + "s" : $t("Key93") }}
           </div>
         </div>
       </template>
@@ -226,7 +229,13 @@ import { getConfigInfor } from "@/utils/index";
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: { UserAgreement },
-  props: ["ForgetType", "changeLoginReg", "changeLoginType", "getChildSysList","changeEmailTips"],
+  props: [
+    "ForgetType",
+    "changeLoginReg",
+    "changeLoginType",
+    "getChildSysList",
+    "changeEmailTips",
+  ],
   data() {
     //这里存放数据
     return {
@@ -250,7 +259,12 @@ export default {
       verificationCodeLoading: true, // 图形验证码的flag
       time: 60, //获取验证码的时间
       emailCode: "",
-      dynamicVerificationShow: getConfigInfor()&&getConfigInfor().is_enable_dynamic_verification_code_for_user_login=='true' ? true : false
+      dynamicVerificationShow:
+        getConfigInfor() &&
+        getConfigInfor().is_enable_dynamic_verification_code_for_user_login ==
+          "true"
+          ? true
+          : false,
     };
   },
   //计算属性 类似于data概念
@@ -279,7 +293,7 @@ export default {
     },
     ChangeVericationCode() {
       this.verificationCode = this.verificationCode.trim();
-      this.emailCode = this.emailCode.trim()
+      this.emailCode = this.emailCode.trim();
     },
     //选择密码登录和验证码登录
     selectLoginType(type) {
@@ -299,8 +313,8 @@ export default {
     // 获取验证码
     getVerificationCode() {
       let this_ = this;
-      if(this_.time != 60){
-        return
+      if (this_.time != 60) {
+        return;
       }
       let timer;
       if (this_.email_phone) {
@@ -316,16 +330,17 @@ export default {
         }, 1000);
         let MethodName = "user_manager-SendVerificationCode";
         let data = {
-          verification_type: 'EMAIL',
+          verification_type: "EMAIL",
           phone_or_email: this_.email_phone,
         };
-        getLogin(MethodName, data).then((res) => {
-        }).catch(()=>{
+        getLogin(MethodName, data)
+          .then((res) => {})
+          .catch(() => {
             this_.VerificationCodeShow = false;
             clearInterval(timer);
             timer = null;
             this_.time = 60;
-        });
+          });
       } else {
         this_.$message.warning(this.$t("Key546"));
       }
@@ -364,9 +379,9 @@ export default {
         password: md5(this.password).toUpperCase(),
         verification_code_image_text: this.verificationCode,
         verification_code_image_id: this.verificationCodeimgID,
-        dynamic_verification_type:'EMAIL',
+        dynamic_verification_type: "EMAIL",
         phone_or_email: this.email_phone,
-        dynamic_verification_code: this.emailCode
+        dynamic_verification_code: this.emailCode,
       };
       if (this.rememberMe) {
       } else {
@@ -375,33 +390,41 @@ export default {
       getLogin(MethodName, data)
         .then((res) => {
           this.isLogin = false;
-          if(res.status==-5){
+          if (res.status == -5) {
             this.$message.error(res.error);
             return;
           }
           this.changeLoginReg("", res);
           if (this.rememberMe) {
             let obj = {
-                email_phone: this.email_phone,
-                user_type: res.user_type,
+              email_phone: this.email_phone,
+              user_type: res.user_type,
             };
             localStorage.setItem("user_name", JSON.stringify(obj));
           }
           setToken(res);
-          if(res.last_update_password_days>=res.sys_recommend_password_update_days){
-            this.changeEmailTips(res.last_update_password_days)
-          }else{
+          let isShare = localStorage.getItem("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 (
-                    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();
-                }
+              if (isShare) {
+                localStorage.removeItem("temporary_link");
+                location.href = isShare;
+              } 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();
+              }
             });
           }
         })
@@ -623,10 +646,10 @@ export default {
               cursor: pointer;
             }
           }
-          &.verificationCode-btn{
+          &.verificationCode-btn {
             width: 128px;
             margin-left: 5px;
-            background: #FF9900;
+            background: #ff9900;
             border-radius: 4px;
             color: #fff;
             font-weight: 700;
@@ -635,9 +658,9 @@ export default {
             align-items: center;
             justify-content: center;
             cursor: pointer;
-            &.waitTime{
-                background: #F0F0F0;
-                color: #6C6C6C;
+            &.waitTime {
+              background: #f0f0f0;
+              color: #6c6c6c;
             }
           }
         }
@@ -773,4 +796,4 @@ export default {
 .v-modal {
   opacity: 0.1;
 }
-</style>
+</style>