From 3fed7aef66ebc0f54a8f92426a8afacc8da541b3 Mon Sep 17 00:00:00 2001 From: "453530270@qq.com" Date: Mon, 8 Jan 2024 18:18:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/reg/reg.vue | 51 ++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 25 deletions(-) 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)