Просмотр исходного кода

feat: NC-45: 结算后台登陆增加邮箱验证码.

zhangl 1 год назад
Родитель
Сommit
b43b88df8a
1 измененных файлов с 9 добавлено и 3 удалено
  1. 9 3
      backendEle/src/views/login/index.vue

+ 9 - 3
backendEle/src/views/login/index.vue

@@ -21,7 +21,7 @@
             <el-input v-model="loginForm.code">
               <template slot="prepend" ><i class="el-icon-chat-dot-round"></i></template>
               <template slot="append">
-                <el-button @click="sendCode" :disabled="countdown > 0">发送验证码<span v-if="countdown > 0">({{ countdown }})</span></el-button>
+                <el-button @click="sendCode" :disabled="disableBet">发送验证码<span v-if="countdown > 0">({{ countdown }})</span></el-button>
               </template>
             </el-input>
           </el-form-item>
@@ -51,6 +51,7 @@ import userInfo from '@/utils/userInfo'
 import baseInfo from '@/utils/baseInfo'
 import {REQUEST_URL} from '@/utils/config'
 import axiosObj from "../../utils/axiosPlugin";
+import {disable} from "nightwatch/lib/util/logger";
 
 export default {
   name: 'login',
@@ -71,6 +72,7 @@ export default {
       captchaUrl: '',
       countdown: 0,
       timer: null,
+      disableBet: true,
     }
   },
   beforeCreate () {
@@ -92,6 +94,7 @@ export default {
     // }
   },
   methods: {
+    disable,
     onSubmit () {
       this.submitButtonStat = true
       let promise = null
@@ -127,7 +130,7 @@ export default {
     },
     sendCode() {
       if (this.loginForm.adminName.length >= 5) {
-        // const result = network.sendEmailCode(this.loginForm.adminName)
+        this.disableBet = false
         network.sendEmailCode(this.loginForm.adminName).then(response => {
           this.$message({
             message: response,
@@ -140,6 +143,7 @@ export default {
             message: error,
             type: 'error'
           });
+          this.disableBet = true
         })
 
       }
@@ -148,7 +152,7 @@ export default {
       if (this.countdown > 0) {
         return; // 如果倒计时未结束,则不执行
       }
-      this.countdown = 10; // 设置倒计时秒数
+      this.countdown = 60; // 设置倒计时秒数
       this.timer = setInterval(() => {
         if (this.countdown > 0) {
           this.countdown -= 1;
@@ -156,6 +160,8 @@ export default {
           clearInterval(this.timer); // 倒计时结束,清除计时器
         }
       }, 1000);
+
+      this.disableBet = false
     },
   },
 }