Kaynağa Gözat

获取手机号逻辑修改

guessPrice
sui 5 yıl önce
ebeveyn
işleme
ed505abee3
1 değiştirilmiş dosya ile 25 ekleme ve 12 silme
  1. +25
    -12
      496_dongfengqichen/app.js

+ 25
- 12
496_dongfengqichen/app.js Dosyayı Görüntüle

@@ -51,6 +51,7 @@ App({
myCenterData:null,//个人中心数据
userInfoData:null,
certificationState:0,//1车主,2合伙人,3同事
mobileData:null,
},
// 获取openId
getOpenid: function (code) {
@@ -69,6 +70,9 @@ App({
if (this.globalData.openidSuccessFuc) {
this.globalData.openidSuccessFuc();
}
if(this.globalData.mobileData){
this.getMobile2(this.globalData.mobileData.encryptedData, this.globalData.mobileData.iv, this.globalData.mobileData.callback, this.globalData.mobileData.thisArg);
}
} else {
wx.showToast({
title: res.msg,
@@ -170,28 +174,37 @@ App({
}
},
addformId: function (e) {//添加formid
console.log("下面是formid");
console.log(e);
this.wxRequest(this.globalData.urlRoot + "/msg/addFormId", { formid: e }, res => {
console.log(res.msg);
}, this, "POST");
},
getMobile: function (encryptedData, iv, callback, thisArg){//和后台置换手机号
getMobile: function (encryptedData, iv, callback, thisArg) {//检查登录态是否过期
wx.checkSession({
success: res => {
this.wxRequest(this.globalData.urlRoot + "userInfo/getUserPhoneNumber", { encryptedData: encryptedData, iv: iv }, res => {
if (res.code == 200) {
wx.setStorageSync('userMobile', res.data.decodeData.phoneNumber);
this.globalData.userMobile = res.data.decodeData.phoneNumber;
}
if (callback && thisArg) {
callback.call(thisArg, res);
}
}, this, "POST");
this.getMobile2(encryptedData,iv,callback,thisArg);
},
fail: res => {
this.globalData.mobileData = {};
this.globalData.mobileData.encryptedData = encryptedData;
this.globalData.mobileData.iv = iv;
this.globalData.mobileData.callback = callback;
this.globalData.mobileData.thisArg = thisArg;
this.wxLogin();
}
})
},
getMobile2: function (encryptedData, iv, callback, thisArg) {//和后台置换手机号
this.globalData.mobileData = null;
this.wxRequest(this.globalData.urlRoot + "userInfo/getUserPhoneNumber", { encryptedData: encryptedData, iv: iv }, res => {
if (res.code == 200) {
if (res.data.decodeData && res.data.decodeData.phoneNumber) {
wx.setStorageSync('userMobile', res.data.decodeData.phoneNumber);
this.globalData.userMobile = res.data.decodeData.phoneNumber;
}
}
if (callback && thisArg) {
callback.call(thisArg, res);
}
}, this, "POST");
}
})

Yükleniyor…
İptal
Kaydet