// app.js App({ onLaunch() { // 展示本地存储能力 const logs = wx.getStorageSync('logs') || [] logs.unshift(Date.now()) wx.setStorageSync('logs', logs) // 登录 wx.login({ success: res => { console.log(res); // wx.request({ // url: 'https://www.umayle.com/weixin_api/API/Wx/User/GetUserInfo.ashx?appName=Inland&code='+res.code, // method: 'POST', // success:(_res)=>{ // console.log(_res); // let openId = _res.data.openid; // this.globalData.openId = openId // console.log('openid',openId); // wx.request({ // url: 'https://www.umayle.com/inland/Api/GetUserInfo.ashx?openId='+openId, // method: 'POST', // success:(_res_)=>{ // console.log(_res_,',,,res'); // this.globalData.userInfo = _res_.data.data // if(_res_.data.code == 0 && _res_.data.message == '获取成功'){ // //跳转到列表页面 // setTimeout(() => { // wx.redirectTo({ // url:'/pages/map/map' // // url:'/pages/register/register' // }) // }, 2000); // }else{ // //跳转到注册页面 // setTimeout(() => { // wx.redirectTo({ // url:'/pages/register/register' // // url:'/pages/list/list' // }) // }, 2000); // } // } // }) // } // }) // 发送 res.code 到后台换取 openId, sessionKey, unionId } }) }, globalData: { userInfo: null, openId:null } })