<view wx:if="{{showPrivacy}}">
<view>隐私弹窗内容....</view>
<button bindtap="handleOpenPrivacyContract">查看隐私协议</button>
<button id="agree-btn" open-type="agreePrivacyAuthorization" bindagreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
</view>
handleAgreePrivacyAuthorization() {
wx.getUserProfile({
desc: '用于完善信息',
success: (res) => {
app.globalData.userInfo = res.userInfo; // 此处获取到的还是匿名信息
wx.setStorage({
key: 'userinfo',
data: res.userInfo
});
},
fail: (e)=>{
console.log(e)
}
})
},
这个接口早就无法获取头像和昵称了。
getUserProfile接口有调整,获取不到头像昵称了,参考公告:https://developers.weixin.qq.com/community/develop/doc/00022c683e8a80b29bed2142b56c01 ;
头像昵称填写功能可以了解一下:https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/userProfile.html