Ver código fonte

手机号绑定页面修改

master
sunfengxiang 2 anos atrás
pai
commit
a07c1fdbc6
1 arquivos alterados com 14 adições e 8 exclusões
  1. +14
    -8
      src/views/smsManage.vue

+ 14
- 8
src/views/smsManage.vue Ver arquivo

@@ -141,6 +141,8 @@
smsCode: null, //短信验证码 smsCode: null, //短信验证码
codeTime: null, //短信验证码发送时间 codeTime: null, //短信验证码发送时间
openId: null, // openId openId: null, // openId
headimgurl: "", // 微信头像url
nickname: "", // 微信昵称
// memberName: null, //身份信息 // memberName: null, //身份信息
// idcard: null, //身份号码 // idcard: null, //身份号码
// rememberMe: false // rememberMe: false
@@ -149,8 +151,6 @@
codeUrl: "", //验证码 codeUrl: "", //验证码
isSmsLogin: false, //是否手机验证码 isSmsLogin: false, //是否手机验证码
computeTime: 0, computeTime: 0,
headimgurl: "",
nickname: "",
}; };
}, },
created() { created() {
@@ -165,6 +165,7 @@
this.showMessage = !this.showMessage this.showMessage = !this.showMessage
}, },
wxAuth() { wxAuth() {
var _this = this;
// 非静默授权:snsapi_userinfo,有弹框弹出需要用户手动点击确认授权。可以获取openId,用户的头像、昵称等 // 非静默授权:snsapi_userinfo,有弹框弹出需要用户手动点击确认授权。可以获取openId,用户的头像、昵称等
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let openid = this.$cookie.get('openid'); let openid = this.$cookie.get('openid');
@@ -193,15 +194,20 @@
}).then(res => { }).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
console.log("微信授权完成"); console.log("微信授权完成");
this.headimgurl = res.data.headimgurl;
this.nickname = res.data.nickname;
console.log(this.headimgurl);
console.log(this.nickname);
resolve(res.data);
} else { } else {
reject("换取openid失败");
console.log("换取openid失败"); console.log("换取openid失败");
} }
}); });
} }
}).then(function (res) {
if(res.data != null && res.data != undefined){
_this.formData.headimgurl = res.data.headimgurl;
_this.formData.nickname = res.data.nickname;
}
}).catch(function (reason) {
console.log(reason);
}); });


// 静默授权:snsapi_base,没有弹窗,只能获取用户的openId。 // 静默授权:snsapi_base,没有弹窗,只能获取用户的openId。
@@ -307,8 +313,8 @@
method: 'post', method: 'post',
data: this.$http.adornParams({ data: this.$http.adornParams({
'openId': this.$cookie.get('openid'), 'openId': this.$cookie.get('openid'),
'headimgurl': this.headimgurl,
'nickname': this.nickname,
'headimgurl': this.formData.headimgurl,
'nickname': this.formData.nickname,
'mobile': this.formData.mobile, 'mobile': this.formData.mobile,
'code': this.formData.smsCode, 'code': this.formData.smsCode,
'codeTime': this.formData.codeTime 'codeTime': this.formData.codeTime


Carregando…
Cancelar
Salvar