vue倒计时60s
// 倒计时60s
getCodeWait() {
let TIME_COUNT = 60;
if (!this.timer) {
this.count = TIME_COUNT;
this.show = false;
this.timer = setInterval(() => {
if (this.count > 0 && this.count <= TIME_COUNT) {
this.count--;
} else {
this.show = true;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
}
},
// 点击获取验证码
go_send() {
// window._hmt.push(["_trackEvent", "获取验证码", "点击", "获取验证码"]);
const telReg = /^1\d{10}$/;
if (telReg.test(this.tel)) {
let loading = weui.loading("加载中");
api
.se(this.tel)
.then((res) => {
loading.hide();
if (res.status == 1) {
this.getCodeWait();
} else {
return Promise.reject(res.errorMsg);
}
})
.catch((error) => {
weui.toast(error, 1500);
});
} else {
weui.toast("请输入正确手机号码", 1500);
}
},

浙公网安备 33010602011771号