// 模拟向后端请求验证码
uni.showLoading({
title: '正在获取验证码'
});
this.$u.api
.sendSms({
mobile: this.phone,
lb: 0
})
.then(data => {
this.$u.toast('验证码已发送');
this.$refs.uCode.start();
uni.request({
url: 'https://2e3d4d99-7c60-42ca-942a-4cac5f15636d.bspapp.com/sendcode',
data: {
phone: this.phone, //获取用户手机号码
code: data //后端返回的验证码
},
method: 'GET',
success: res => {
if (res.data.code == 200) {
setTimeout(() => {
// this.pldata = res.data.data.records;
console.log(res.data);
// this.$forceUpdate();
}, 500);
}
},
fail(res) {
console.log(res);
}
});
})
.catch(erro => {
uni.hideLoading();
});
} else {
this.$u.toast('倒计时结束后再发送');
}