ソースを参照

Merge branch 'dev' of http://120.79.166.78:19005/zhongzheng-edu/saas_pc into dev

chenxiong 3 年 前
コミット
2c8063efcc

+ 15 - 0
src/apis/login.js

@@ -116,4 +116,19 @@ export default {
 			noToken: true
 		})
 	},
+  
+  /**
+   * 
+   * @param {*} data 
+   * @returns 
+   * 获取找回密码短信
+   */
+   getRegisterSmsforget(data) {
+		return request({
+			url: '/app/common/sms/forget',
+			method: 'post',
+			data: data,
+			noToken: true
+		})
+	},
 }

+ 42 - 25
src/components/header/index.vue

@@ -26,31 +26,31 @@
           <i class="pi" v-if="msgCount > 0"></i>
           <i class="el-icon-message-solid icon"></i>
         </a>
-        <a
-          class="name"
-          @click="go('/person-center')"
-          @mouseenter="mouseover"
-          @mouseleave="mouseLeave"
-        >
-          <img
-            :src="
-              userInfo
-                ? userInfo.avatar
-                  ? $tools.splitImgHost(userInfo.avatar, true)
-                  : '@/assets/qrcode.png'
-                : ''
-            "
-            alt=""
-          />
-          <span>{{ userInfo && userInfo.realname }}</span>
-          <transition name="fade">
-            <ul class="modal-box" v-if="showBox">
-              <li @click.stop="go('/person-center/my-course')">我的课程</li>
-              <li @click.stop="go('/person-center/my-bank')">我的题库</li>
-              <li @click.stop="$tools.exit">退出登录</li>
-            </ul>
-          </transition>
-        </a>
+        <el-dropdown @command="handleCommand">
+          <span
+            class="el-dropdown-link"
+            @click="go('/person-center/my-course')"
+            style="margin-left:10px;cursor:pointer;"
+          >
+            <img
+              style="width: 24px; vertical-align: middle"
+              :src="
+                userInfo
+                  ? userInfo.avatar
+                    ? $tools.splitImgHost(userInfo.avatar, true)
+                    : '@/assets/qrcode.png'
+                  : ''
+              "
+              alt=""
+            />
+            <span>{{ userInfo && userInfo.realname }}</span>
+          </span>
+          <el-dropdown-menu slot="dropdown">
+            <el-dropdown-item command="1">我的课程</el-dropdown-item>
+            <el-dropdown-item command="2">我的题库</el-dropdown-item>
+            <el-dropdown-item command="3">退出登录</el-dropdown-item>
+          </el-dropdown-menu>
+        </el-dropdown>
       </div>
       <div class="userinfo" v-else>
         <div class="text-list" v-if="!userInfo">
@@ -115,6 +115,23 @@ export default {
   },
   methods: {
     ...mapMutations(["getMsgCount"]),
+
+    handleCommand(command) {
+      switch (command) {
+        case "1":
+          this.go("/person-center/my-course");
+          break;
+        case "2":
+          this.go("/person-center/my-bank");
+          break;
+        case "3":
+          this.$tools.exit();
+          break;
+
+        default:
+          break;
+      }
+    },
     go(path, query) {
       this.$router.push({
         path,

+ 3 - 3
src/pages/bank-report/index.vue

@@ -59,10 +59,10 @@
                   试卷得分
                   <span class="note">(客观题)</span>
                 </div>
-                <div class="desc">{{ reportdata.performance }}</div>
+                <div class="desc" style="margin-top:70px;">{{ reportdata.performance }}</div>
                 <div class="other">满分{{ reportdata.totalScore }}</div>
               </div>
-              <div class="left-box__in left-box__in--bottom">
+              <!-- <div class="left-box__in left-box__in--bottom">
                 <div class="title">
                   试卷得分
                   <span class="note">(客观题+主观题)</span>
@@ -71,7 +71,7 @@
                   {{ reportdata.performance + reportdata.score }}
                 </div>
                 <div class="other">满分{{ reportdata.totalScore }}</div>
-              </div>
+              </div> -->
             </div>
             <div class="right-box">
               <div class="right-box__in">

+ 30 - 14
src/pages/home/index.vue

@@ -12,20 +12,20 @@
             <a @click="go('/person-center/my-message')">
               <i class="el-icon-message-solid icon"></i>
             </a>
-            <a
-              @click="go('/person-center')"
-              @mouseenter="mouseover"
-              @mouseleave="mouseLeave"
-            >
-              <i class="el-icon-user-solid icon"></i>
-              <transition name="fade">
-                <ul class="modal-box" v-show="showBox">
-                  <li @click.stop="go('/person-center/my-course')">我的课程</li>
-                  <li @click.stop="go('/person-center/my-bank')">我的题库</li>
-                  <li @click.stop="$tools.exit">退出登录</li>
-                </ul>
-              </transition>
-            </a>
+            <el-dropdown @command="handleCommand">
+              <span class="el-dropdown-link">
+                <i
+                  class="el-icon-user-solid"
+                  style="font-size: 20px; color: #3f8dfd; cursor: pointer"
+                  @click="go('/person-center/my-course')"
+                ></i>
+              </span>
+              <el-dropdown-menu slot="dropdown">
+                <el-dropdown-item command="1">我的课程</el-dropdown-item>
+                <el-dropdown-item command="2">我的题库</el-dropdown-item>
+                <el-dropdown-item command="3">退出登录</el-dropdown-item>
+              </el-dropdown-menu>
+            </el-dropdown>
           </div>
         </div>
       </div>
@@ -595,6 +595,22 @@ export default {
     },
   },
   methods: {
+    handleCommand(command) {
+      switch (command) {
+        case "1":
+          this.go("/person-center/my-course");
+          break;
+        case "2":
+          this.go("/person-center/my-bank");
+          break;
+        case "3":
+          this.$tools.exit();
+          break;
+
+        default:
+          break;
+      }
+    },
     toFixed(num) {
       if (num) {
         let str = String(num).indexOf(".");

+ 68 - 11
src/pages/login/index.vue

@@ -243,8 +243,13 @@
                         placeholder="短信验证码"
                         autocomplete="off"
                         v-model="forgetForm.code"
-                      >
-                        <span class="btn" slot="suffix">获取验证码</span>
+                        ><span class="btn" slot="suffix" @click="getCode">
+                          {{
+                            forgetCountDown == 0
+                              ? "获取验证码"
+                              : `${forgetCountDown}秒重新获取`
+                          }}</span
+                        >
                       </el-input></el-form-item
                     >
                   </div>
@@ -842,6 +847,14 @@ export default {
         callback();
       }
     };
+    const validatorTel = (rule, value, callback) => {
+      var reg = /^1[34578][0-9]{9}$/;
+      if (!reg.test(value)) {
+        return callback(new Error("请输入正确手机号码"));
+      } else {
+        callback();
+      }
+    };
     return {
       state: 1, //1登录 2注册  3找回密码 4绑定学员身份
       tabIndex: 0,
@@ -868,11 +881,17 @@ export default {
       },
       loginSmsRules: {
         code: [{ required: true, trigger: "blur", message: "请输入验证码" }],
-        tel: [{ required: true, trigger: "blur", message: "请输入手机号" }],
+        tel: [
+          { required: true, trigger: "blur", message: "请输入手机号" },
+          { validator: validatorTel, trigger: "blur" },
+        ],
       },
       forgetRules: {
         code: [{ required: true, trigger: "blur", message: "请输入验证码" }],
-        tel: [{ required: true, trigger: "blur", message: "请输入手机号" }],
+        tel: [
+          { required: true, trigger: "blur", message: "请输入手机号" },
+          { validator: validatorTel, trigger: "blur" },
+        ],
         pwd: [{ required: true, trigger: "blur", message: "请输入新密码" }],
         pwdAgain: [
           {
@@ -883,8 +902,11 @@ export default {
         ],
       },
       registerRules: {
+        tel: [
+          { required: true, trigger: "blur", message: "请输入手机号" },
+          { validator: validatorTel, trigger: "blur" },
+        ],
         code: [{ required: true, trigger: "blur", message: "请输入验证码" }],
-        tel: [{ required: true, trigger: "blur", message: "请输入手机号" }],
         pwd: [{ required: true, trigger: "blur", message: "请输入密码" }],
         read: [{ required: true, trigger: "blur", message: "请勾选服务协议" }],
       },
@@ -972,7 +994,7 @@ export default {
                   message: `验证码已发送`,
                   type: "success",
                 });
-                this.countDown = 60;
+                this.countDown = 5;
                 this.countDownTimer = setInterval(() => {
                   if (this.countDown == 0) {
                     clearInterval(this.countDownTimer);
@@ -988,6 +1010,41 @@ export default {
         }
       });
     },
+    /**
+     * 获取找回密码短信
+     */
+    getCode() {
+      this.$refs.forgetForm.validateField("tel", (valid) => {
+        if (!valid) {
+          if (this.forgetCountDown == 0) {
+            if (this.getForgetCodeLock) {
+              return;
+            }
+            this.getForgetCodeLock = true;
+            this.$request
+              .getRegisterSmsforget({ tel: this.forgetForm.tel })
+              .then((res) => {
+                this.getForgetCodeLock = false;
+                this.$message({
+                  message: `验证码已发送`,
+                  type: "success",
+                });
+                this.forgetCountDown = 5;
+                this.forgetCountDownTimer = setInterval(() => {
+                  if (this.forgetCountDown == 0) {
+                    clearInterval(this.forgetCountDownTimer);
+                  } else {
+                    this.forgetCountDown--;
+                  }
+                }, 1000);
+              })
+              .catch((err) => {
+                this.getForgetCodeLock = false;
+              });
+          }
+        }
+      });
+    },
     /**
      * 手机号登录
      */
@@ -1069,6 +1126,7 @@ export default {
      * 获取注册验证码
      */
     getRegisterSms() {
+      var self = this;
       this.$refs.registerForm.validateField("tel", (valid) => {
         if (!valid) {
           if (this.registerCountDown == 0) {
@@ -1084,12 +1142,11 @@ export default {
                   message: `验证码已发送`,
                   type: "success",
                 });
-                this.registerCountDown = 60;
+                this.registerCountDown = 5;
                 this.registerCountDownTimer = setInterval(() => {
-                  if (this.registercountDown == 0) {
-                    clearInterval(this.registerCountDownTimer);
-                  } else {
-                    this.registerCountDown--;
+                  self.registerCountDown--;
+                  if (self.registerCountDown == 0) {
+                    clearInterval(self.registerCountDownTimer);
                   }
                 }, 1000);
               })

+ 24 - 0
src/pages/person-center/my-bank/bank-detail/index.vue

@@ -56,6 +56,14 @@
                                 <div class="bank-section__item__text">
                                   {{ section.examName }}
                                 </div>
+                                <el-button
+                                  type="text"
+                                  class="btn"
+                                  style="width: auto"
+                                  >{{ section.questionNum || 0 }}/{{
+                                    section.totalQuestionNum || 0
+                                  }}</el-button
+                                >
                                 <el-button
                                   v-if="section.recordStatus == -1"
                                   type="primary"
@@ -140,6 +148,14 @@
                                 <div class="bank-section__item__text">
                                   {{ section.examName }}
                                 </div>
+                                <el-button
+                                  type="text"
+                                  class="btn"
+                                  style="width: auto"
+                                  >{{ section.questionNum || 0 }}/{{
+                                    section.totalQuestionNum || 0
+                                  }}</el-button
+                                >
                                 <el-button
                                   v-if="section.recordStatus == -1"
                                   type="primary"
@@ -187,6 +203,14 @@
                             <div class="bank-section__item__text">
                               {{ item.name }}
                             </div>
+                            <el-button
+                              type="text"
+                              class="btn"
+                              style="width: auto"
+                              >{{ section.questionNum || 0 }}/{{
+                                section.totalQuestionNum || 0
+                              }}</el-button
+                            >
                             <el-button
                               v-if="item.recordStatus == -1"
                               type="primary"