Authored by 郭成尧

countDown

... ... @@ -74,14 +74,14 @@ class RegisterNew {
itime = setInterval(() => {
if (count === 0) {
this.view.getVerifyCodeBtn.text('重新发送').removeClass('disable');
this.view.getVerifyCodeBtn.text('重新发送').addClass('active');
clearInterval(itime);
} else {
this.view.getVerifyCodeBtn.text('重新发送 (' + count-- + '秒)');
window.setCookie('count', count);
if (during && parseInt(during, 10) !== 0) {
this.view.getVerifyCodeBtn.addClass('disable');
this.view.getVerifyCodeBtn.removeClass('active');
}
}
}, 1000);
... ...
... ... @@ -46,6 +46,30 @@ class SmsLoginNew extends Page {
}
/**
* 获取验证码倒计时
*/
countDown(during) {
let count = during || 59;
let itime;
this.selector.getVerifyCodeBtn.removeClass('active');
itime = setInterval(() => {
if (count === 0) {
this.selector.getVerifyCodeBtn.text('重新发送').addClass('active');
clearInterval(itime);
} else {
this.selector.getVerifyCodeBtn.text('重新发送 (' + count-- + '秒)');
window.setCookie('count', count);
if (during && parseInt(during, 10) !== 0) {
this.selector.getVerifyCodeBtn.removeClass('active');
}
}
}, 1000);
}
/**
* 输入监听,改变按钮状态
*/
changeBtnStatus() {
... ... @@ -122,7 +146,7 @@ class SmsLoginNew extends Page {
validate.type === 2 && validate.refresh();
if (data.code === 200) {
checkPoint('YB_MOBILE_NEXT_C'); // 埋点
console.log(data);
this.countDown();
} else {
(data.changeCaptcha && validate.type !== 2) && validate.refresh();
tip.show(data.message);
... ...