Browse Source

修改验证码验证情况的BUG

Administrator 7 years ago
parent
commit
0ab427b6b5

+ 8 - 0
assets/scss/mobileCommon.scss

@@ -127,6 +127,14 @@
       margin-left: .1rem;
       color:#2d8cf0;
     }
+    .token-no{
+      display:inline-block;
+      padding: 0 .5rem;
+      text-align: center;
+      border-left:1px solid #b5b5b5;
+      margin-left: .1rem;
+      color:#666;
+    }
   }
 }
 

+ 3 - 4
components/mobile/registerEnterprise/index.vue

@@ -20,7 +20,8 @@
                     v-model="step1.token"
                     :state="state.token"
                     @blur.native.capture="validateCode">
-            <span class="token" @click="getCheckCode" v-text="tokenText">获取验证码</span>
+            <span class="token" @click="getCheckCode" v-text="tokenText" v-if="state.mobile === 'success'">获取验证码</span>
+            <span class="token-no" v-text="tokenText" v-if="state.mobile !== 'success'">获取验证码</span>
           </mt-field>
         </div>
       </div>
@@ -203,9 +204,7 @@
         if (this.tokenTime > 0 && this.tokenTime < 60) {
           this.downToast('请稍后再点击,我在倒计时')
         } else {
-          if (this.state.mobile !== 'success') {
-            this.downToast('请先输入正确的手机号')
-          } else {
+          if (this.state.mobile === 'success') {
             this.$indicator.open('获取中...')
             let _this = this
             this.$http.get('/sso/personal/register/checkCode', {params: {mobile: this.step1.mobile}})

+ 36 - 33
components/mobile/registerPersonal/index.vue

@@ -35,8 +35,8 @@
         <mt-field :state="state.mobile"
                   placeholder="手机号码"
                   v-model="mobile"
-                  type="tel"
-                  @blur.native.capture="codeMobile"></mt-field>
+                  @blur.native.capture="codeMobile"
+                  type="tel"></mt-field>
       </div>
       <div class="page-part">
         <mt-field :state="state.token"
@@ -44,7 +44,8 @@
                   v-model="token"
                   @blur.native.capture="codeToken"
                   auto-complete="off">
-          <span class="token" v-text="tokenText" @click="getCheckCode">获取验证码</span>
+          <span class="token" v-text="tokenText" @click="getCheckCode" v-if="state.mobile === 'success'">获取验证码</span>
+          <span class="token-no" v-text="tokenText" v-if="state.mobile !== 'success'">获取验证码</span>
         </mt-field>
       </div>
     </div>
@@ -204,40 +205,42 @@
         }
       },
       // 获取验证码
+      loadCheckCode () {
+        if (this.state.mobile === 'success') {
+          this.$indicator.open('获取中...')
+          let _this = this
+          this.$http.get('/sso/personal/register/checkCode', {params: {mobile: this.mobile}})
+            .then(response => {
+              this.$indicator.close()
+              if (response.data) {
+                this.tokenCode = response.data.token
+                this.$toast({
+                  message: '验证码已经发送到您的手机,请注意查收',
+                  iconClass: 'el-icon-success'
+                })
+                this.tokenText = '已发送(' + this.tokenTime + 'S)'
+                let setTime = setInterval(() => {
+                  _this.tokenTime--
+                  this.tokenText = '已发送(' + this.tokenTime + 'S)'
+                  if (this.tokenTime <= 0) {
+                    clearInterval(setTime)
+                    _this.tokenText = '获取验证码'
+                    _this.tokenTime = 60
+                  }
+                }, 1000)
+              }
+            }).catch(() => {
+              this.$indicator.close()
+              this.downToast('请检查网络是否正常或联系服务商')
+            })
+        }
+      },
+      // 验证码发送请求
       getCheckCode () {
         if (this.tokenTime > 0 && this.tokenTime < 60) {
           this.downToast('请稍后再点击,我在倒计时')
         } else {
-          if (this.state.mobile !== 'success') {
-            this.downToast('请先输入正确的手机号')
-          } else {
-            this.$indicator.open('获取中...')
-            let _this = this
-            this.$http.get('/sso/personal/register/checkCode', {params: {mobile: this.mobile}})
-              .then(response => {
-                this.$indicator.close()
-                if (response.data) {
-                  this.tokenCode = response.data.token
-                  this.$toast({
-                    message: '验证码已经发送到您的手机,请注意查收',
-                    iconClass: 'el-icon-success'
-                  })
-                  this.tokenText = '已发送(' + this.tokenTime + 'S)'
-                  let setTime = setInterval(() => {
-                    _this.tokenTime--
-                    this.tokenText = '已发送(' + this.tokenTime + 'S)'
-                    if (this.tokenTime <= 0) {
-                      clearInterval(setTime)
-                      _this.tokenText = '获取验证码'
-                      _this.tokenTime = 60
-                    }
-                  }, 1000)
-                }
-              }).catch(() => {
-                this.$indicator.close()
-                this.downToast('请检查网络是否正常或联系服务商')
-              })
-          }
+          this.loadCheckCode()
         }
       },
       // 表单提交

+ 3 - 4
components/mobile/reset/stepAppeal.vue

@@ -19,7 +19,8 @@
                   v-model="valid.token"
                   :state="state.token"
                   @blur.native.capture="validateCode">
-          <span class="token" @click="getCheckCode" v-text="tokenText">获取验证码</span>
+          <span class="token" @click="getCheckCode" v-text="tokenText" v-if="state.mobile === 'success'">获取验证码</span>
+          <span class="token-no" v-text="tokenText" v-if="state.mobile !== 'success'">获取验证码</span>
         </mt-field>
       </div>
       <div class="page-part">
@@ -180,9 +181,7 @@
           if (this.tokenTime > 0 && this.tokenTime < 60) {
             this.downToast('请稍后再点击,我在倒计时')
           } else {
-            if (this.state.mobile !== 'success') {
-              this.downToast('请先输入正确的手机号')
-            } else {
+            if (this.state.mobile === 'success') {
               this.$indicator.open('获取中...')
               let _this = this
               this.$http.get('/sso/personal/register/checkCode', {params: {mobile: this.valid.mobile}})