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

Merge remote-tracking branch 'origin/dev' into feature-bh2018-hb

# Conflicts:
#	nuxt.config.js
hangb 7 лет назад
Родитель
Сommit
f3d2711332

+ 53 - 40
components/mobile/registerEnterprise/index.vue

@@ -11,17 +11,14 @@
                     v-model="step1.mobile"
                     :state="state.mobile"
                     type="tel"
-                    @blur.native.capture="validateMobile"
           ></mt-field>
         </div>
         <div class="page-part">
           <mt-field auto-complete="off"
                     placeholder="短信验证码"
                     v-model="step1.token"
-                    :state="state.token"
-                    @blur.native.capture="validateCode">
-            <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>
+                    :state="state.token">
+            <span class="token" @click="getCheckCode" v-text="tokenText">获取验证码</span>
           </mt-field>
         </div>
       </div>
@@ -38,20 +35,17 @@
           <mt-field placeholder="企业名称"
                     :attr="{ maxlength: 20 }"
                     v-model="step2.spaceName"
-                    :state="state.spaceName"
-                    @blur.native.capture="validateSpaceName"></mt-field>
+                    :state="state.spaceName"></mt-field>
         </div>
         <div class="page-part">
           <mt-field placeholder="营业执照号"
                     v-model="step2.businessCode"
-                    :state="state.businessCode"
-                    @blur.native.capture="validateBusinessCode"></mt-field>
+                    :state="state.businessCode"></mt-field>
         </div>
         <div class="page-part" v-if="!hasRegister">
           <mt-field placeholder="管理员姓名"
                     v-model="step2.vipName"
-                    :state="state.vipName"
-                    @blur.native.capture="validateVipName"></mt-field>
+                    :state="state.vipName"></mt-field>
         </div>
         <div class="page-part" v-if="!hasRegister">
           <mt-field placeholder="登录密码"
@@ -60,8 +54,7 @@
                     :state="state.password"
                     type="password"
                     auto-complete="new-password"
-                    @input.native="validatePassword"
-                    @blur.native.capture="validatePasswordTip"></mt-field>
+                    @input.native="validatePassword"></mt-field>
           <template v-if="step2.password">
             <p class="pwd">密码强度 <em :class="{sm:progress === '弱', md: progress === '中', ld:progress === '强'}"></em> <em :class="{md: progress === '中', ld:progress === '强'}"></em> <em :class="{ld:progress === '强'}"></em> <span :class="{smstep:progress === '弱', mdstep: progress === '中', ldstep:progress === '强'}" v-text="progress">强</span></p>
             <p class="pwd">密码须为8-20字符的英文、数字混合</p>
@@ -72,8 +65,7 @@
                     v-model="step2.password"
                     :state="state.password"
                     type="password"
-                    auto-complete="new-password"
-                    @blur.native.capture="validatePasswordTipHas"></mt-field>
+                    auto-complete="new-password"></mt-field>
           <template v-if="!step2.password">
             <p class="pwd" style="text-align:right;"><a href="/reset/forgetPasswordValidationAccount">忘记密码?</a></p>
           </template>
@@ -86,15 +78,13 @@
                     v-model="step2.confirm"
                     :state="state.confirm"
                     type="password"
-                    auto-complete="new-password"
-                    @blur.native.capture="validateConfirm"></mt-field>
+                    auto-complete="new-password"></mt-field>
         </div>
         <div class="page-part" v-if="!hasEmail">
           <mt-field placeholder="联系邮箱"
                     v-model="step2.email"
                     :state="state.email"
-                    type="email"
-                    @blur.native.capture="validateEmail"></mt-field>
+                    type="email"></mt-field>
         </div>
       </div>
       <div class="form-btn">
@@ -118,7 +108,7 @@
           vipName: 'error',
           password: 'error',
           confirm: 'error',
-          email: 'success'
+          email: null
         },
         step1: {
           mobile: '',
@@ -141,6 +131,16 @@
         progress: '弱'
       }
     },
+    watch: {
+      'step1.token': {
+        handler (newVal) {
+          if (newVal.length === 6) {
+            this.validateCode()
+          }
+        },
+        immediate: true
+      }
+    },
     methods: {
       // 注册
       goRegister () {
@@ -211,6 +211,7 @@
         if (this.tokenTime > 0 && this.tokenTime < 60) {
           this.downToast('请稍后再点击,我在倒计时')
         } else {
+          this.validateMobile()
           if (this.state.mobile === 'success') {
             this.$indicator.open('获取中...')
             let _this = this
@@ -234,17 +235,19 @@
                     }
                   }, 1000)
                 }
-              }).catch((err) => {
+              }).catch(() => {
                 this.$indicator.close()
-                this.downToast(err.errMsg)
+                this.downToast('获取失败,请检查网络')
               })
           }
         }
       },
       // 验证手机
       checkPhone () {
-        if (this.state.mobile !== 'success' || this.state.token !== 'success') {
-          this.downToast('请确认填写部分是否有误')
+        if (this.state.mobile !== 'success') {
+          this.validateMobile()
+        } else if (this.state.token !== 'success') {
+          this.validateCode()
         } else if (this.checked === false) {
           this.downToast('您对阅读条款未做勾选')
         } else {
@@ -466,31 +469,41 @@
       // 企业注册
       sureRegister () {
         if (!this.hasRegister) {
-          if (this.state.spaceName !== 'success' ||
-            this.state.businessCode !== 'success' ||
-            this.state.vipName !== 'success' ||
-            this.state.password !== 'success' ||
-            this.state.confirm !== 'success' ||
-            this.state.email !== 'success') {
-            this.downToast('请确认填写部分是否有误')
+          if (this.state.spaceName !== 'success') {
+            this.validateSpaceName()
+          } else if (this.state.businessCode !== 'success') {
+            this.validateBusinessCode()
+          } else if (this.state.vipName !== 'success') {
+            this.validateVipName()
+          } else if (this.state.password !== 'success') {
+            this.validatePasswordTip()
+          } else if (this.state.confirm !== 'success') {
+            this.validateConfirm()
+          } else if (this.state.email !== 'success') {
+            this.validateEmail()
           } else {
             this.sbmitRegister()
           }
         } else {
           if (!this.hasEmail) {
-            if (this.state.spaceName !== 'success' ||
-              this.state.businessCode !== 'success' ||
-              this.state.password !== 'success' ||
-              this.state.email !== 'success') {
-              this.downToast('请确认填写部分是否有误')
+            if (this.state.spaceName !== 'success') {
+              this.validateSpaceName()
+            } else if (this.state.businessCode !== 'success') {
+              this.validateBusinessCode()
+            } else if (this.state.password !== 'success') {
+              this.validatePasswordTip()
+            } else if (this.state.email !== 'success') {
+              this.validateEmail()
             } else {
               this.sbmitRegister()
             }
           } else {
-            if (this.state.spaceName !== 'success' ||
-              this.state.businessCode !== 'success' ||
-              this.state.password !== 'success') {
-              this.downToast('请确认填写部分是否有误')
+            if (this.state.spaceName !== 'success') {
+              this.validateSpaceName()
+            } else if (this.state.businessCode !== 'success') {
+              this.validateBusinessCode()
+            } else if (this.state.password !== 'success') {
+              this.validatePasswordTipHas()
             } else {
               this.sbmitRegister()
             }

+ 26 - 16
components/mobile/registerPersonal/index.vue

@@ -8,8 +8,8 @@
       <div class="page-part">
         <mt-field :state="state.vipName"
                   placeholder="会员名"
-                  v-model="vipName"
-                  @blur.native.capture="codeVipName" ></mt-field>
+                  :attr="{ maxlength: 20 }"
+                  v-model="vipName"></mt-field>
       </div>
       <div class="page-part">
         <mt-field :state="state.password"
@@ -17,8 +17,7 @@
                   :attr="{ maxlength: 20 }"
                   v-model="password"
                   @input.native="codePwd"
-                  type="password"
-                  @blur.native.capture="codePwdBlur"></mt-field>
+                  type="password"></mt-field>
         <template v-if="password">
           <p class="pwd">密码强度 <em :class="{sm:step === '弱', md: step === '中', ld:step === '强'}"></em> <em :class="{md: step === '中', ld:step === '强'}"></em> <em :class="{ld:step === '强'}"></em> <span :class="{smstep:step === '弱', mdstep: step === '中', ldstep:step === '强'}" v-text="step">强</span></p>
           <p class="pwd">密码须为8-20字符的英文、数字混合</p>
@@ -28,24 +27,20 @@
         <mt-field :state="state.confirm"
                   placeholder="确认密码"
                   v-model="confirm"
-                  type="password"
-                  @blur.native.capture="codePassword"></mt-field>
+                  type="password"></mt-field>
       </div>
       <div class="page-part">
         <mt-field :state="state.mobile"
                   placeholder="手机号码"
                   v-model="mobile"
-                  @blur.native.capture="codeMobile"
                   type="tel"></mt-field>
       </div>
       <div class="page-part">
         <mt-field :state="state.token"
                   placeholder="短信验证码"
                   v-model="token"
-                  @blur.native.capture="codeToken"
                   auto-complete="off">
-          <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>
+          <span class="token" v-text="tokenText" @click="getCheckCode">获取验证码</span>
         </mt-field>
       </div>
     </div>
@@ -82,6 +77,16 @@
         checked: true
       }
     },
+    watch: {
+      'token': {
+        handler (newVal) {
+          if (newVal.length === 6) {
+            this.codeToken()
+          }
+        },
+        immediate: true
+      }
+    },
     methods: {
       // 注册
       goRegister () {
@@ -210,6 +215,7 @@
       },
       // 获取验证码
       loadCheckCode () {
+        this.codeMobile()
         if (this.state.mobile === 'success') {
           this.$indicator.open('获取中...')
           let _this = this
@@ -249,12 +255,16 @@
       },
       // 表单提交
       submit () {
-        if (this.state.vipName !== 'success' ||
-          this.state.password !== 'success' ||
-          this.state.confirm !== 'success' ||
-          this.state.mobile !== 'success' ||
-          this.state.token !== 'success') {
-          this.downToast('请确认填写部分是否有误')
+        if (this.state.vipName !== 'success') {
+          this.codeVipName()
+        } else if (this.state.password !== 'success') {
+          this.codePwdBlur()
+        } else if (this.state.confirm !== 'success') {
+          this.codePassword()
+        } else if (this.state.mobile !== 'success') {
+          this.codeMobile()
+        } else if (this.state.token !== 'success') {
+          this.codeToken()
         } else if (this.checked === false) {
           this.downToast('您对阅读条款未做勾选')
         } else {