wx.login({
success: function () {
wx.getUserInfo({
success: function (res) {
console.log("==============wxlogin userInfo=" + res.userInfo);
wx.request({
url: ‘https://xxxxxx.com/xxxx’,
method: ‘GET’,
data: {
openid: res.userInfo.openId,
nickname: res.userInfo.nickName,
gender: res.userInfo.gender,
city: res.userInfo.city,
province: res.userInfo.province,
country: res.userInfo.country,
avatarurl: res.userInfo.avatarUrl,
unionid: res.userInfo.unionId
},
header: {
‘Accept’: ‘application/json’
},
success: function (res) {
console.log(res);
}
});
}
});