var app = getApp(), $ = require("../../utils/util.js"); Page({ data: { showModal: false, canIUse: true }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { console.log('auth') }, getUserProfile: function(e) { console.log('ss',e) let that = this; $.loading("登录中..."); wx.getUserProfile({ desc: '用于完善会员资料', success: function(res) { var wxinfo = {} console.log('rrrrrrr',res) wxinfo.userInfo = res.rawData getApp().globalData.userInfo = res.userInfo that.setData({ showModal: true }) $.hideloading() } }) }, //获取手机号码 getPhoneNumber(e){ console.log('e12',e) let that = this let code = e.detail.code let data = { key: code } let url = getApp().globalData.API + '/api/WeiXin/getPhoneToken' wx.request({ url: url, data: data, method: 'GET', header: { 'content-type': 'application/json' // 默认值 }, success (res) { console.log('saa',res) getApp().globalData.userInfo.phone = res.data.result.phone getApp().globalData.token = res.data.result.token wx.setStorageSync("userInfo", getApp().globalData.userInfo) wx.setStorageSync("token", getApp().globalData.token) wx.redirectTo({ url: '/pages/home/home' }) }, fail() { } }) } })