master
lion 7 days ago
parent b526869201
commit 89569d01c4

@ -22,19 +22,38 @@
export default { export default {
data() { data() {
return { return {
openidReady: false
} }
}, },
onShareAppMessage() {}, onShareAppMessage() {},
onLoad() { onLoad() {
//this.login(); var that = this;
util.getOpenidInfo(function() {
that.openidReady = true;
}, true);
}, },
onReady() {}, onReady() {},
onHide() {}, onHide() {},
methods: { methods: {
getStoredOpenid: function() {
var user = uni.getStorageSync('userInfo_token') || {};
return user.openid || (user.user_info ? user.user_info.openid : '');
},
_getPhoneNumber: function(o) { _getPhoneNumber: function(o) {
null != o.detail.iv ? this.getPhone(o) : util.alert('为了更好的为您服务,请允许访问您的手机号码'); var that = this;
if (null == o.detail.iv) {
util.alert('为了更好的为您服务,请允许访问您的手机号码');
return;
}
if (that.openidReady && that.getStoredOpenid()) {
that.getPhone(o);
return;
}
util.getOpenidInfo(function() {
that.openidReady = true;
that.getPhone(o);
}, true);
@ -88,11 +107,13 @@
getPhone: function(t) { getPhone: function(t) {
var that = this; var that = this;
var code = t.detail.code; var code = t.detail.code;
var openid = this.getStoredOpenid();
console.log("code", code); console.log("code", code);
util.request({ util.request({
api: 'customer/mobile', api: 'customer/mobile',
data: { data: {
code: code code: code,
openid: openid
}, },
method: 'POST', method: 'POST',
utilSuccess: function(e) { utilSuccess: function(e) {

Loading…
Cancel
Save