关于getUserProfile的问题
发布于 6 年前 作者 ming73 8375 次浏览 来自 官方Issues

1.根据官方发布的接口调整说明,<button open-type=“getUserInfo”/> 与 wx。getUserInfo 在4月28日后发布的版本不可在使用。且 已经同步到最新版的开发者工具。那么出现了以下问题 不太理解

1.1。 微信开发者工具中。5月6号-7号 利用<button open-type=“getUserInfo”/> 获取用户信息 返回是。匿名信息。 且无弹窗为正常

但是 第二天到目前为止 再去尝试 发现 <button open-type=“getUserInfo”/> 可以正常使用,且不是匿名信息 还有弹窗。 那请问是升级还是不升级

2.2。 因为用的是Taro。发现往getUserProfile的desc参数中传递的值。并没有在授权的弹出窗中展示 那么这个参数是bug呢。还是没有作用

2.3。encryptedDate解密后不包含openId了吗? 如果没有的话。是否只能在login后通过前端传递

3 回复

1.1 可能微信版本不一样,1.2 desc 目前不展示 后续可能会展示出来 2.3 获取openid 就用 login 获取就好了

getUserProfile与getUserInfo 要采用兼容模式(高基础库用getUserProfile,低基础库用getUserInfo )。

<button wx:if="{{canIUseGetUserProfile}}" bindtap="getUserProfile"> 获取头像昵称 </button>
<button wx:else open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>

onLoad() {
 if (wx.getUserProfile) {
  this.setData({
   canIUseGetUserProfile: true
  })
 }
}

https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html#%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81

openId通过login去获取。

openId确实不再返回,之前看漏了

回到顶部