guanchunjie 3 سال پیش
والد
کامیت
d7871fd77b
4فایلهای تغییر یافته به همراه114 افزوده شده و 55 حذف شده
  1. BIN
      src/assets/login/close-forget.png
  2. 91 38
      src/components/login/ForgetPassword.vue
  3. 12 16
      src/components/login/login.vue
  4. 11 1
      src/views/login/index.vue

BIN
src/assets/login/close-forget.png


+ 91 - 38
src/components/login/ForgetPassword.vue

@@ -1,9 +1,29 @@
 <template>
   <!-- 忘记密码 -->
   <div class="ForgetPassword">
+    <img
+      src="../../assets/login/close-forget.png"
+      class="close-win"
+      @click="closeWin"
+    />
     <div class="title">
       <p>忘记密码</p>
     </div>
+    <!-- 先择老师还是学生 -->
+    <div class="teacherAndStudent">
+      <div
+        @click="selectTS('teacher')"
+        :class="TorS == 'teacher' ? 'select' : ''"
+      >
+        <p>我是老师</p>
+      </div>
+      <div
+        @click="selectTS('student')"
+        :class="TorS == 'teacher' ? '' : 'select'"
+      >
+        <p>我是学生</p>
+      </div>
+    </div>
     <div class="main">
       <div class="ploneEmail">
         <div>
@@ -122,8 +142,10 @@
       </div>
       <!-- 验证 -->
       <div class="btnLogin">
-        <img v-if="isLogin" src="../../assets/login/Ellipse87.png" alt="" />
-        <p @click="gotoLogin" v-else>验证</p>
+        <div class="inner">
+          <img v-if="isLogin" src="../../assets/login/Ellipse87.png" alt="" />
+          <p @click="gotoLogin" v-else>完成</p>
+        </div>
       </div>
     </div>
     <div v-show="shadow" class="shadow"></div>
@@ -137,7 +159,7 @@ import { getLogin } from "@/api/api";
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: {},
-  props: ["ForgetType", "changeLoginReg"],
+  props: ["ForgetType", "changeLoginReg", "changeLoginType"],
   data() {
     //这里存放数据
     return {
@@ -157,6 +179,7 @@ export default {
       twopassword: "",
       passwordError: false, //密码错误
       passwordErrorTwo: false, //第二次输入的密码错误
+      TorS: "",
     };
   },
   //计算属性 类似于data概念
@@ -165,6 +188,13 @@ export default {
   watch: {},
   //方法集合
   methods: {
+    closeWin() {
+      this.changeLoginReg("login");
+    },
+    //   选择老师或者学生
+    selectTS(user_type) {
+      this.TorS = user_type;
+    },
     // 显示选择登录方式
     showLoginType() {
       this.ShowloginType = !this.ShowloginType;
@@ -227,9 +257,7 @@ export default {
           console.log(res);
         });
       } else {
-        this_.$message.warning(
-          "请先输入电子邮箱或手机号码"
-        );
+        this_.$message.warning("请先输入电子邮箱或手机号码");
       }
     },
     // 验证码的验证只能输入数字
@@ -300,6 +328,7 @@ export default {
           this.$message.success("密码修改成功”");
           this.changeLoginReg("login");
           this.isLogin = false;
+          this.changeLoginType(this.TorS);
         })
         .catch((err) => {
           this.isLogin = false;
@@ -309,7 +338,9 @@ export default {
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},
   //生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {},
+  mounted() {
+    this.TorS = this.ForgetType;
+  },
   //生命周期-创建之前
   beforeCreated() {},
   //生命周期-挂载之前
@@ -329,19 +360,19 @@ export default {
 <style lang="scss" scoped>
 /* @import url(); 引入css类 */
 .ForgetPassword {
+  position: relative;
   width: 820px;
   height: 500px;
   background: #f8f8f8;
   border-radius: 8px;
-  margin-left: 30px;
-  .title {
-    height: 100px;
-    line-height: 100px;
-    p {
-      text-align: center;
-      font-size: 20px;
-      color: #ff9900;
-    }
+  margin-left: 40px;
+  .close-win {
+    position: absolute;
+    right: 24px;
+    top: 24px;
+    width: 24px;
+    height: 24px;
+    cursor: pointer;
   }
   .teacherAndStudent {
     margin: 0 auto;
@@ -352,6 +383,7 @@ export default {
     display: flex;
     align-items: center;
     justify-content: center;
+    margin-bottom: 28px;
     > div {
       width: 164px;
       height: 36px;
@@ -360,20 +392,34 @@ export default {
       align-items: center;
       justify-content: center;
       cursor: pointer;
+      color: #a6a6a6;
     }
     .select {
       background: #ffffff;
       box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.1);
       border-radius: 2px;
+      font-weight: bold;
+      color: #ff9900;
+    }
+  }
+  .title {
+    padding: 48px 0 20px;
+    p {
+      text-align: center;
+      font-size: 20px;
+      color: #ff9900;
+      font-weight: bold;
+      margin: 0;
     }
   }
+
   .main {
     .ploneEmail {
       display: flex;
       justify-content: center;
       > div {
         // margin: 24px auto;
-        margin: 20px 10px;
+        margin: 16px 12px;
         width: 334px;
         position: relative;
         .input {
@@ -525,27 +571,34 @@ export default {
     }
 
     .btnLogin {
-      margin: 0 auto;
-      margin-top: 90px;
-      position: relative;
-      width: 693px;
-      height: 50px;
-      background: #ff9900;
-      border-radius: 4px;
-      color: white;
-      line-height: 48px;
-      text-align: center;
-      cursor: pointer;
-      z-index: 2;
-      p {
-        margin: 0;
-        padding: 0;
-        width: 100%;
-        height: 100%;
-      }
-      img {
-        vertical-align: middle;
-        animation: rotated 1s linear infinite;
+      position: absolute;
+      bottom: 37px;
+      left: 0;
+      width: 100%;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      .inner {
+        margin: 0 auto;
+        width: 693px;
+        height: 50px;
+        background: #ff9900;
+        border-radius: 4px;
+        color: white;
+        line-height: 48px;
+        text-align: center;
+        cursor: pointer;
+        z-index: 2;
+        p {
+          margin: 0;
+          padding: 0;
+          width: 100%;
+          height: 100%;
+        }
+        img {
+          vertical-align: middle;
+          animation: rotated 1s linear infinite;
+        }
       }
     }
     .agreement {

+ 12 - 16
src/components/login/login.vue

@@ -155,11 +155,11 @@ import { setToken } from "@/utils/auth";
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: {},
-  props: ["changeLoginReg", "changeLoginType"],
+  props: ["ForgetType", "changeLoginReg", "changeLoginType"],
   data() {
     //这里存放数据
     return {
-      TorS: "teacher", //老师还是学生
+      TorS: this.ForgetType, //老师还是学生
       ShowloginType: false, //显示登录方式
       parsswordType: "password",
       loginType: "密码",
@@ -184,8 +184,6 @@ export default {
     selectTS(user_type) {
       this.TorS = user_type;
       this.changeLoginType(this.TorS);
-      // this.password = "";
-      // this.email_phone = "";
     },
     // 显示选择登录方式
     showLoginType() {
@@ -259,12 +257,16 @@ export default {
             localStorage.setItem("user_name", JSON.stringify(obj));
           }
           setToken(res);
-          res.popedom_code_list.forEach((item, i) => {
-            if (item == 2000001) {
-              location.href = `/GCLS-Learn/#/EnterSys`;
-              return;
-            }
-          });
+          if (res.user_type == "TEACHER") {
+            res.popedom_code_list.forEach((item, i) => {
+              if (item == 2000001) {
+                location.href = `/GCLS-Learn/#/EnterSys`;
+                return;
+              }
+            });
+          } else if (res.user_type == "STUDENT") {
+            location.href = `/GCLS-Learn/#/EnterSys`;
+          }
         })
         .catch((err) => {
           this.isLogin = false;
@@ -286,12 +288,6 @@ export default {
     let user_name = JSON.parse(localStorage.getItem("user_name"));
     if (user_name) {
       this.email_phone = user_name.email_phone;
-      console.log(user_name);
-      if (user_name.user_type == "TEACHER") {
-        this.TorS = "teacher";
-      } else {
-        this.TorS = "student";
-      }
       this.rememberMe = true;
     }
   },

+ 11 - 1
src/views/login/index.vue

@@ -20,6 +20,7 @@
         </div>
         <div class="login" v-if="LoginOrRegistration == 'login'">
           <Login
+            :ForgetType.sync="loginType"
             :changeLoginReg="changeLoginReg"
             :changeLoginType="changeLoginType"
           />
@@ -31,6 +32,7 @@
           <ForgetPassword
             :changeLoginReg="changeLoginReg"
             :ForgetType.sync="loginType"
+            :changeLoginType="changeLoginType"
           />
         </div>
         <div class="list" v-if="!LoginOrRegistration">
@@ -276,7 +278,7 @@ export default {
               ? []
               : _this.handleProList(popedom_code_list);
         } else if (_this.userMessage.user_type == "STUDENT") {
-          _this.projectList = _this.stuProList;
+          //_this.projectList = _this.stuProList;
         }
         _this.projectList.forEach((item, index) => {
           if (item.id == 4) {
@@ -549,6 +551,14 @@ export default {
   },
   //生命周期 - 创建完成(可以访问当前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({