//index.js //获取应用实例 const app = getApp() Page({ data: { username:'未登录' }, getPhoneNumber (e) { console.log(e.detail.errMsg) console.log(e.detail.iv) console.log(e.detail.encryptedData) }, //事件处理函数 bindViewTap: function() { wx.navigateTo({ url: '../logs/logs' }) }, getmenu:function(){ wx.request({ url: 'http://192.168.20.53:9999/admin/menu/tree', method: 'get', header: { 'Authorization': 'Bearer '+wx.getStorageSync('token') }, success(r) { console.log(r) console.log(r) } }) }, login:function(){ // var self = this // wx.login({ // success(res){ // wx.request({ // url: 'http://192.168.20.53:9999/auth/mobile/token/social?grant_type=mobil&mobile=MINI@'+res.code, // method: 'post', // header: { // 'Authorization': 'Basic dGVzdDp0ZXN0' // }, // success(res){ // console.log(res) // wx.setStorageSync('token', res.data.access_token); // if (res.statusCode === 401){ // console.log(res.data) // wx.navigateTo({ // url: '../bind/bind', // }) // }else{ // self.setData({ // username: res.data.username // }) // } // } // }) // } // }) } })