This commit is contained in:
Gdpao
2020-08-07 19:56:47 +08:00
parent 71e984b2ed
commit 502e020000
17 changed files with 238 additions and 136 deletions

View File

@@ -44,49 +44,57 @@
this.$emit('tochange');
let member_mobile = this.member_mobile;
// 校验手机号
let type_phone = this.$u.test.mobile(member_mobile)
console.log(member_mobile)
console.log(this.smslog_type)
let type_phone = this.$u.test.mobile(member_mobile);
// console.log(member_mobile);
// console.log(this.smslog_type);
// 判断是否有手机号为空
if (type_phone == false) {
this.$refs.uToast.show({
title: '手机号格式不正确',
type: 'error'
})
this.$refs.uToast.show({
title: "手机号格式不正确"
})
} else {
// 验证码倒计时
if (this.$refs.uCode.canGetCode) {
// 模拟向后端请求验证码
uni.showLoading({
title: '正在获取验证码'
})
setTimeout(() => {
uni.hideLoading();
// 这里此提示会被this.start()方法中的提示覆盖
this.$u.toast('验证码已发送');
// 通知验证码组件内部开始倒计时
this.$refs.uCode.start();
}, 2000);
uni.showLoading({
title: '正在获取验证码'
})
// 请求接口
this.$u.api.sendSmsCode({
member_mobile: this.member_mobile,
smslog_type: this.smslog_type
}).then((res) => {
if (res.errCode == 0) {
console.log(res);
this.$refs.uToast.show({
title: res.message,
})
setTimeout(() => {
uni.hideLoading();
// 这里此提示会被this.start()方法中的提示覆盖
// this.$u.toast('验证码已发送');
// 通知验证码组件内部开始倒计时
this.$refs.uCode.start();
}, 100);
} else {
this.$refs.uToast.show({
title: res.message,
})
}
})
} else {
// this.$u.toast('倒计时结束后再发送');
console.log("倒计时结束后再发送");
// console.log("倒计时结束后再发送");
}
}
},
end() {
this.$u.toast('倒计时结束');
// this.$u.toast('倒计时结束');
},
start() {
// this.$u.toast('倒计时开始');
console.log(this.smslog_type)
// console.log(this.smslog_type)
// 倒计时请求
this.$u.api.sendSmsCode({
member_mobile: this.member_mobile,
smslog_type: this.smslog_type
}).then((res) => {
console.log(res)
})
}
}
}