diff --git a/pages/reg/reg.vue b/pages/reg/reg.vue index 8da0b8a..55347a6 100644 --- a/pages/reg/reg.vue +++ b/pages/reg/reg.vue @@ -64,9 +64,6 @@ import * as Verify from '@/utils/verify' import whpop from './components/WhPopup' - //倒计时120s - const st = 120 - export default { components: { // nothing @@ -95,6 +92,8 @@ utchk2:false, // 需要打开的链接 murl:"", + //倒计时 + st:120, // 显示/隐藏弹窗 showPopup: false, } @@ -132,32 +131,34 @@ // 发送验证码 getsmscode(){ - this.$toast("sss") - this.countDown(2200) // 检查手机号是否填写 - // let mb = this.mobile - // if(this.validteMobile(mb)){ - // regApi.sendSms(mb).then(res=>{ - // if(res.resultCode=="00000000"){ - // if(res.data ==1){ - // this.$toast("手机号已被注册") - // // 倒计时 - // } - // } - // console.log(res) - // }); - // } + let mb = this.mobile + if(this.validteMobile(mb)){ + regApi.sendSms(mb).then(res=>{ + if(res.resultCode=="00000000"){ + if(res.data ==1){ + this.$toast("手机号已被注册") + // 倒计时 + this.countDown() + } + } + console.log(res) + }); + } }, // 倒计时 - countDown(st){ - this.$refs.abtn.$el.innerText=st+"秒" - const ss = setTimeout({ - if(st>1){ - st=st-1 - countDown(st) - // }else{ - // st = 0 + countDown(){ + let app = this + app.$refs.abtn.$el.innerText=app.st+"秒" + let qq = app.st + console.log(qq) + setTimeout(function(){ + if(app.st>1){ + app.st-- + app.countDown(app.st) + }else{ + app.st = "获取验证码" } },1000)