|
|
@@ -39,7 +39,7 @@
|
|
|
<template #right>
|
|
|
<view class="identifying-code">
|
|
|
<u-code
|
|
|
- ref="uCode2"
|
|
|
+ ref="uCode3"
|
|
|
@change="codeChange2"
|
|
|
keep-running
|
|
|
start-text="获取验证码"
|
|
|
@@ -128,17 +128,14 @@ export default {
|
|
|
saveSetPhoneData(){
|
|
|
let that = this;
|
|
|
// 验证电话号码是否存在
|
|
|
- setPhone(null,{data:this.userInfo}).then((res)=>{
|
|
|
+ this.$api.setPhone(this.userInfo).then((res)=>{
|
|
|
uni.showToast({
|
|
|
title: '绑定成功'
|
|
|
})
|
|
|
setTimeout(function() {
|
|
|
- // 选择完成后返回上一页
|
|
|
- uni.navigateBack({
|
|
|
- delta: 1,
|
|
|
- success: function(res) {
|
|
|
- console.log('返回成功');
|
|
|
- }
|
|
|
+ // 绑定成功,返回我的页面
|
|
|
+ uni.switchTab({
|
|
|
+ url: '/pages/my/index',
|
|
|
});
|
|
|
}, 2000); // 延迟2秒执行
|
|
|
}).catch(() =>{
|
|
|
@@ -161,7 +158,7 @@ export default {
|
|
|
},
|
|
|
getCode2() {
|
|
|
let that = this;
|
|
|
- if (this.$refs.uCode2.canGetCode) {
|
|
|
+ if (this.$refs.uCode3.canGetCode) {
|
|
|
that.getSmsCode();
|
|
|
} else {
|
|
|
uni.$u.toast('倒计时结束后再发送');
|
|
|
@@ -170,13 +167,13 @@ export default {
|
|
|
// 获取手机验证码
|
|
|
getSmsCode(){
|
|
|
let that = this;
|
|
|
- if(this.$isDataEmpty(this.userInfo.phonenumber)){
|
|
|
+ if(!this.userInfo.phonenumber){
|
|
|
uni.$u.toast('请认真填写手机号');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 验证电话号码是否存在
|
|
|
- phoneIsExist(null,{data:this.userInfo}).then((res)=>{
|
|
|
+ this.$api.phoneIsExist(this.userInfo).then((res)=>{
|
|
|
if(res.phoneIsExist){ // 存在
|
|
|
that.errTipShow = true;
|
|
|
setTimeout(() => {
|
|
|
@@ -203,12 +200,12 @@ export default {
|
|
|
uni.showLoading({
|
|
|
title: '正在获取验证码'
|
|
|
})
|
|
|
- getSmsCode({data:{phonenumber:this.userInfo.phonenumber,auth: true}}).then((res)=>{
|
|
|
+ this.$api.getSmsCode({phonenumber:this.userInfo.phonenumber,auth: true}).then((res)=>{
|
|
|
uni.hideLoading();
|
|
|
// 这里此提示会被this.start()方法中的提示覆盖
|
|
|
uni.$u.toast('验证码已发送');
|
|
|
// 通知验证码组件内部开始倒计时
|
|
|
- that.$refs.uCode2.start();
|
|
|
+ that.$refs.uCode3.start();
|
|
|
}).catch(() =>{
|
|
|
uni.showToast({
|
|
|
title: "操作失败"
|