getUserProfile(e){
let that = this;
wx.getUserProfile({
desc:'用于验证用户',
success: (res) => {
console.log(res.userInfo)
var userInfo = res.userInfo
that.setData({
userInfo:userInfo,
nickName:userInfo.nickName,
city:userInfo.city,
province:userInfo.province,
})
wx.request({
url: 'http://127.0.0.1/sqxt/login1.php',
method: 'POST',
data: {
'nickName': userInfo.nickName,
'city': userInfo.city,
'province': userInfo.province,
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
success(res) {
console.log(res.data)
if ("success" == res.data.replace(/^\s+|\s+$/g, '')) {
wx.navigateTo({
url: '../sqxt/sqxt'
})
} else if ("fail" == res.data.replace(/^\s+|\s+$/g, '') ) {
wx.showModal({
title: '提示',
content: '未授权用户,请联系管理员谢志奇获取授权,TEL:560155。',
showCancel: "false",
success(res) {
console.log('用户点击确定');
wx.redirectTo({
url: '../login/login'
})
}
})
}
}
})
}
})
},
官方公告说到10月20号完成调整,我是刚用上getuserprofile
,21号就发现只能获取昵称和头像了,正常正常,不是代码问题
接口更新了,可以看下这个文档:https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801?blockType=1&page=2#comment-list