|
@@ -19,6 +19,7 @@
|
|
|
并授权使用您的账号信息(如昵称、头像、收获地址)以便您统一管理
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <u-toast ref="uToast" />
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -33,6 +34,9 @@ export default {
|
|
|
codelength: 4,
|
|
|
show: false,
|
|
|
second:10,
|
|
|
+ toastMsg:'',
|
|
|
+ toastUrl:'',
|
|
|
+ toastType:'',
|
|
|
// messageError:false
|
|
|
}
|
|
|
},
|
|
@@ -50,39 +54,54 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ showToast() {
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ title: this.toastMsg,
|
|
|
+ type: this.toastType,
|
|
|
+ url: this.toastUrl
|
|
|
+ })
|
|
|
+ },
|
|
|
submit() {
|
|
|
if(this.$u.test.mobile(this.tel)&&this.messageDisable==false) {
|
|
|
- this.messageDisable = true;
|
|
|
- this.messageShow = true;
|
|
|
- this.show = true;
|
|
|
- // this.getCaptcha()
|
|
|
- let interval = setInterval(() => {
|
|
|
- this.second--;
|
|
|
- if (this.second <= 0) {
|
|
|
- this.messageDisable=false
|
|
|
- this.messageShow = false;
|
|
|
- if (this.messageCode.lenth != 4) {
|
|
|
- // this.messageError = true;
|
|
|
+ let that = this;
|
|
|
+ this.$u.api.getcode(this.tel)
|
|
|
+ .then(res =>{
|
|
|
+ this.messageDisable = true;
|
|
|
+ this.messageShow = true;
|
|
|
+ this.show = true;
|
|
|
+ let interval = setInterval(() => {
|
|
|
+ that.second--;
|
|
|
+ if (that.second <= 0) {
|
|
|
+ that.messageDisable=false
|
|
|
+ that.messageShow = false;
|
|
|
+ if (that.messageCode.lenth != 4) {
|
|
|
+ // this.messageError = true;
|
|
|
+ }
|
|
|
+ clearInterval(interval);
|
|
|
+ that.second=10;
|
|
|
}
|
|
|
- clearInterval(interval);
|
|
|
- this.second=10;
|
|
|
- }
|
|
|
- }, 1000);
|
|
|
-
|
|
|
+ }, 1000);
|
|
|
+ console.log('getcode res',res)
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log('err',err)
|
|
|
+ this.toastMsg = err.statusCode + ":" + err.data.message;
|
|
|
+ this.showToast();
|
|
|
+ console.log('getcode err',err)
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
// 收不到验证码选择时的选择
|
|
|
- noCaptcha() {
|
|
|
- uni.showActionSheet({
|
|
|
- itemList: ['重新获取验证码', '接听语音验证码'],
|
|
|
- success: function(res) {
|
|
|
+ // noCaptcha() {
|
|
|
+ // uni.showActionSheet({
|
|
|
+ // itemList: ['重新获取验证码', '接听语音验证码'],
|
|
|
+ // success: function(res) {
|
|
|
|
|
|
- },
|
|
|
- fail: function(res) {
|
|
|
+ // },
|
|
|
+ // fail: function(res) {
|
|
|
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // },
|
|
|
// change事件侦听
|
|
|
change(value) {
|
|
|
// console.log('change', value);
|
|
@@ -90,20 +109,34 @@ export default {
|
|
|
// 输入完验证码最后一位执行
|
|
|
finish(value) {
|
|
|
let params = {
|
|
|
- tel:this.tel,
|
|
|
- openid:this.$store.state.vuex_user.openId,
|
|
|
- value:value
|
|
|
+ phone:this.tel,
|
|
|
+ code:value
|
|
|
};
|
|
|
this.$u.api.bindphone(params)
|
|
|
.then(res =>{
|
|
|
- if(res.retBody.OK=='ok'){
|
|
|
- this.$u.route({
|
|
|
- url: 'pages/template/login/code'
|
|
|
- })
|
|
|
- }else{
|
|
|
+ if(res.retHead.errCode=='0'){
|
|
|
+ this.$u.api.getuseinfo().then(res => {
|
|
|
+ console.log('getuseinfo',res.retBody);
|
|
|
+ this.$u.vuex('vuex_user', res.retBody);
|
|
|
+ this.toastMsg = '操作成功';
|
|
|
+ this.showToast();
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$u.route({
|
|
|
+ url: 'pages/template/wxCenter/index'
|
|
|
+ })
|
|
|
+ }, 2000);
|
|
|
+ });
|
|
|
|
|
|
+ }else{
|
|
|
+ console.log('asdf',res)
|
|
|
+ this.toastMsg = res.retHead.errMsg;
|
|
|
+ this.showToast();
|
|
|
}
|
|
|
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log('finish err',err);
|
|
|
+ this.toastMsg = err.retHead.errMsg;
|
|
|
+ this.showToast();
|
|
|
});
|
|
|
console.log('finish', value);
|
|
|
}
|