diff --git a/pages_order/auth/loginAndRegisterAndForgetPassword.vue b/pages_order/auth/loginAndRegisterAndForgetPassword.vue index a92628e..aa70257 100644 --- a/pages_order/auth/loginAndRegisterAndForgetPassword.vue +++ b/pages_order/auth/loginAndRegisterAndForgetPassword.vue @@ -183,17 +183,20 @@ }, getCode() { if (this.$refs.code.canGetCode) { - // 模拟向后端请求验证码 uni.showLoading({ title: '正在获取验证码' }) - setTimeout(() => { - uni.hideLoading(); - // 这里此提示会被this.start()方法中的提示覆盖 - uni.$uv.toast('验证码已发送'); - // 通知验证码组件内部开始倒计时 - this.$refs.code.start(); - }, 2000); + this.$api('sendSms', { + username: this.form1.userName, + }, res => { + if (res.code == 200) { + uni.hideLoading(); + // 这里此提示会被this.start()方法中的提示覆盖 + uni.$uv.toast('验证码已发送'); + // 通知验证码组件内部开始倒计时 + this.$refs.code.start(); + } + }) } else { uni.$uv.toast('请勿重复发送'); }