123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- App({
- onLaunch: function () {
-
- var logs = wx.getStorageSync('logs') || []
- logs.unshift(Date.now())
- wx.setStorageSync('logs', logs)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- },
- getUserInfo: function (cb) {
- var that = this;
- if (this.globalData.userInfo) {
- typeof cb == "function" && cb(this.globalData.userInfo)
- } else {
-
- wx.login({
- success: function (res) {
- if (res.code) {
- wx.request({
-
- url: 'https://weixin.ai160.com',
- header: { 'content-type': 'application/json' },
- data:{
- js_code: res.code,
- grant_type: 'authorization_code'
- },
- method:'GET',
- success:function(res){
- console.log(res)
- }
- })
-
-
-
-
-
-
-
- } else {
- console.log('登录失败!' + res.errMsg)
- }
- wx.getUserInfo({
- success: function (res) {
- console.log(res);
- that.globalData.userInfo = res.userInfo;
- typeof cb == "function" && cb(that.globalData.userInfo)
- }
- })
- }
- });
- }
- },
- globalData: {
- userInfo: null
- }
- })
|