收藏
回答

隐私授权同意后为何还获取不到用户真实的昵称和头像?

<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)
      }
  })
},

回答关注问题邀请回答
收藏

2 个回答

登录 后发表内容