const app = getApp() const util = require('../../utils/util.js') Page({ data: {}, //事件处理函数 bindViewTap: function() { wx.navigateTo({ url: '../logs/logs' }) }, onLoad: function(options) { console.log(app.globalData.openid); // console.log(options) this.setData({ navH: app.globalData.navHeight }) }, getPhoneNumber: function(e) { var that = this; if (e.detail.errMsg == 'getPhoneNumber:ok') { var that = this; util.postData('/getWxDecrypt', { encrypData: e.detail.encryptedData, ivData: e.detail.iv, openid: app.globalData.openid }).then(res => { console.log(res); if (res.purePhoneNumber !== undefined && res.purePhoneNumber != 'undefined') { app.globalData.userphone = res.purePhoneNumber; wx.setStorageSync('PHONE', res.purePhoneNumber); util.postData('/updateWXUser', { xu_openid: app.globalData.openid, xu_phone: res.purePhoneNumber, xu_countryCode: res.countryCode }).then(res2 => { console.log(res2); util.postData('/insertDcIntroduceLog', { xul_openid: app.globalData.openid, xul_phone: res.purePhoneNumber, xul_event: 2, xul_introducer_phone: app.globalData.introducer }).then(() => { wx.navigateBack(); }) }) } else { //没有电话号 wx.navigateBack(); } }) } else { wx.navigateBack(); } } })