The mini program has modified the previous authorization method to obtain the user's avatar and user name. Previously, it was using
let base = this;
uni.getUserInfo({
provider: "weixin",
success: function(res) {
(base.headImg = res.userInfo.avatarUrl),
(base.nickName = res.userInfo.nickName);
},
fail: function() {}
});
You can get the relevant parameters.
But if you write now, you will find that the new version of the mini program no longer provides such calls.
So check out the documentation:
I copied it from actual use and found that the page did not display the avatar. Then I tried to wrap a view in the outer layer. Sure enough, there was an avatar. I dropped the code:
<view class="headImg">
<open-data type="userAvatarUrl"></open-data>
</view>
<view class="nickName">
<view class="testup">
<open-data type="userNickName"></open-data>
</view>
</view>
If it helps you, can you give me a little heart~