guanchunjie hace 3 años
padre
commit
f25b1cc9ff
Se han modificado 1 ficheros con 35 adiciones y 37 borrados
  1. 35 37
      src/views/login/index.vue

+ 35 - 37
src/views/login/index.vue

@@ -545,51 +545,49 @@ export default {
         location.href = "/GCLS-Mobile-ROOT/#/EnterSys";
         console.log("移动端");
       } else {
-        console.log("PC端");
+        let user_name = JSON.parse(localStorage.getItem("user_name"));
+        if (user_name) {
+          if (user_name.user_type == "TEACHER") {
+            this.loginType = "teacher";
+          } else {
+            this.loginType = "student";
+          }
+        }
+        this.getLangList();
+        this.Islogin();
+        updateWordPack({
+          word_key_list: ["teaching", "teaching"],
+        });
+        let type = this.$route.query.type;
+        if (type && type == "login") {
+          this.LoginOrRegistration = "login";
+        }
+        let userInfor = getToken();
+        let user_code = "",
+          user_type = "",
+          session_id = "";
+        if (userInfor) {
+          userInfor = JSON.parse(getToken());
+          user_code = userInfor.user_code;
+          user_type = userInfor.user_type;
+          session_id = userInfor.session_id;
+        }
+        if (!session_id || !user_code || !user_type || !userInfor) {
+          this.isPc = true;
+          this.LoginOrRegistration = "login";
+        } else {
+          this.isPc = false;
+          location.href = `/GCLS-Learn/#/EnterSys`;
+        }
       }
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
-    let user_name = JSON.parse(localStorage.getItem("user_name"));
-    if (user_name) {
-      if (user_name.user_type == "TEACHER") {
-        this.loginType = "teacher";
-      } else {
-        this.loginType = "student";
-      }
-    }
-    this.getLangList();
-    this.Islogin();
-    updateWordPack({
-      word_key_list: ["teaching", "teaching"],
-    });
-    let type = this.$route.query.type;
-    if (type && type == "login") {
-      this.LoginOrRegistration = "login";
-    }
     this.browserRedirect();
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {
-    let userInfor = getToken();
-    let user_code = "",
-      user_type = "",
-      session_id = "";
-    if (userInfor) {
-      userInfor = JSON.parse(getToken());
-      user_code = userInfor.user_code;
-      user_type = userInfor.user_type;
-      session_id = userInfor.session_id;
-    }
-    if (!session_id || !user_code || !user_type || !userInfor) {
-      this.isPc = true;
-      this.LoginOrRegistration = "login";
-    } else {
-      this.isPc = false;
-      location.href = `/GCLS-Learn/#/EnterSys`;
-    }
-  },
+  mounted() {},
   //生命周期-创建之前
   beforeCreated() {},
   //生命周期-挂载之前