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);
}
});
}
});
微信小程序开发者回答:
W***:
获取openId和unionId的值需要登录成功返回一个code,而你写的回调函数啥也没接收,好好看看文档
L***:
你好,请仔细阅读相关文档说明:https://mp.weixin.qq.com/debug/wxadoc/dev/api/open.html
夏***:系统记录
本文网址:http://www.91bianli.com/weixinxiaochengxu/26293.html