微信登陆获取用户信息

//index.wxml


       
    

//index.js

const app = getApp()

Page({
  getUserInfo() {
    wx.login({
      success(res) {
        var code = res.code
        wx.getUserInfo({
          success: function (datas) {
            datas.code=code
            console.log(datas);
            wx.request({
              url: "http://127.0.0.1:8088/coach/auth",
              method: "POST",
              data: datas,
              header: {
                "Content-Type": "application/x-www-form-urlencoded",
                "X-Access-Token": "003758a8626aded7fe820e3759c05151",
                "X-Access-Uid": "347"
              },
              success: function (res) {
                console.log(res);
              },
            })
          }
        })
      }
    })
  }
})

你可能感兴趣的:(微信登陆获取用户信息)