| myCenterData:null,//个人中心数据 | myCenterData:null,//个人中心数据 | ||||
| userInfoData:null, | userInfoData:null, | ||||
| certificationState:0,//1车主,2合伙人,3同事 | certificationState:0,//1车主,2合伙人,3同事 | ||||
| mobileData:null, | |||||
| }, | }, | ||||
| // 获取openId | // 获取openId | ||||
| getOpenid: function (code) { | getOpenid: function (code) { | ||||
| if (this.globalData.openidSuccessFuc) { | if (this.globalData.openidSuccessFuc) { | ||||
| 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 { | } else { | ||||
| wx.showToast({ | wx.showToast({ | ||||
| title: res.msg, | title: res.msg, | ||||
| } | } | ||||
| }, | }, | ||||
| addformId: function (e) {//添加formid | addformId: function (e) {//添加formid | ||||
| console.log("下面是formid"); | |||||
| console.log(e); | |||||
| this.wxRequest(this.globalData.urlRoot + "/msg/addFormId", { formid: e }, res => { | this.wxRequest(this.globalData.urlRoot + "/msg/addFormId", { formid: e }, res => { | ||||
| console.log(res.msg); | console.log(res.msg); | ||||
| }, this, "POST"); | }, this, "POST"); | ||||
| }, | }, | ||||
| getMobile: function (encryptedData, iv, callback, thisArg){//和后台置换手机号 | |||||
| getMobile: function (encryptedData, iv, callback, thisArg) {//检查登录态是否过期 | |||||
| wx.checkSession({ | wx.checkSession({ | ||||
| success: res => { | 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 => { | 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(); | 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"); | |||||
| } | } | ||||
| }) | }) |