isNaN(that.mobile)) {
this.showToast('请输入正确手机号');
}
else if (that.imgCode.length != 4) {
this.showToast('请输入正确图片验证码');
}
else {
if (that.captchaSended) return;
this.setData({
captchaSended: true
})
app.api.getSMSByMobileAndCaptcha({
mobile: that.mobile,
capKey: that.capKey,
code: that.imgCode,
type:1
}).then((result) => {
this.showToast(result.message);
if (result.code != 1) {
this.getImgCode();
this.setData({
captchaSended: false,
});
} else {
var counter = setInterval(() => {
that.timer--;
this.setData({
timer: that.timer,
captchaText: `${that.timer}秒`,
isReadOnly: true
});
if (that.timer === 0) {
clearInterval(counter);
that.captchaSended = false;
that.captchaText = '获取验证码';
this.setData({
timer: 60,
captchaText: '获取验证码',
captchaSended: false
})
}
}, 1000);
}
});
}
},
// 获取图形码
getImgCode() {
var capKey = "zdx-weixin" + Math.random();
this.setData({
imgCodeSrc: "http://prezdx.geinihua.com/invite/WeChat/verify?capKey=" + capKey,
capKey: capKey
});
},
//用户使用协议
xieyi() {
wx.navigateTo({
url: '../userXieyi/userXieyi'
})
},
// 注册
regist() {
var that = this.data;
if(!that.checkAgree
关键词:微信小程序中input输入及动态设置按钮的完成