Applet official request for infrastructure projects api

  OnLaunch: function () {
     // showing local storage capability 
    var logs wx.getStorageSync = ( 'logs') || [] 
    logs.unshift (Date.now ()) 
    wx.setStorageSync ( 'logs' , logs) 

    // login 
    wx.login ({ 
      Success: RES => {
         // send back to the exchange res.code OpenID, a sessionKey, unionid 
      } 
    }) 
    // get user information 
    wx.getSetting ({ 
      Success: RES => {
         IF (res.authSetting [ 'scope.userInfo' ]) {
           // has been authorized to directly call getUserInfo get avatar nickname, will not play box
          wx.getUserInfo ({ 
            Success: res => {
               // may be sent back to the decoding res unionid 
              the this .globalData.userInfo = res.userInfo 

              // Since getUserInfo network request, may not return until Page.onLoad 
              // so here added to prevent this callback 
              IF ( the this .userInfoReadyCallback) {
                 the this .userInfoReadyCallback (RES) 
              } 
            } 
          }) 
        } 
      } 
    }) 
  },

 

Guess you like

Origin www.cnblogs.com/dianzan/p/11375576.html
Recommended