网友真实露脸自拍10p,成人国产精品秘?久久久按摩,国产精品久久久久久无码不卡,成人免费区一区二区三区

小程序模板網

微信小程序獲取openid小程序端及服務器端代碼

發布時間:2018-02-10 11:27 所屬欄目:小程序開發教程

一:客戶端

 
   var that = this
    wx.login({
      success: function (res) {
        var appId = '     ';//微信公眾號平臺申請的appid
        var appSecret = '   ';//微信公眾號平臺申請的app secret
        var js_code = res.code;//調用登錄接口獲得的用戶的登錄憑證code
        wx.request({
          url: 'https://api.weixin.qq.com/sns/jscode2session?appid=' + appId + '&secret=' + appSecret + '&js_code=' + js_code + '&grant_type=authorization_code',
          data: {},
          method: 'GET',
          success: function (res) {
            var openid = res.data.openid //返回的用戶唯一標識符openid
            console.log(openid)
            console.log("試試吧上面就是獲得的openid")
          }
        })
      }
    })
    //試驗自己的服務器獲取openId
    //調用登錄接口
    wx.login({
      success: function (res) {
        //console.log(res);
        that.globalData.loginCode = res.code
        wx.getUserInfo({
          success: function (res) {
            that.globalData.userInfo = res.userInfo
            that.globalData.iv = res.iv
            that.globalData.encryptedData = res.encryptedData
            typeof cb == "function" && cb(that.globalData.userInfo)
            that.req(
              'https://lifar網址.aspx?Action=ActionLogin',
              {
                encryptedData: that.globalData.encryptedData,
                iv: that.globalData.iv,
                code: that.globalData.loginCode
              },
              'GET',
              function (res) {
                console.log(res)
                if ( 


易優小程序(企業版)+靈活api+前后代碼開源 碼云倉庫:starfork
本文地址:http://www.xiuhaier.com/wxmini/doc/course/21937.html 復制鏈接 如需定制請聯系易優客服咨詢:800182392 點擊咨詢
QQ在線咨詢
AI智能客服 ×