根据官方微信小程序开发关于登录授权API的调整,自 2022年10月25日起有关API接口获取用户头像将统一返回默认灰色头像,昵称将统一返回 “微信用户”。(如下图所示)
<!-- <view> -->
<view class="container">
<view class="wechatapp">
<view class="auth-subtitle">请设置头像和昵称</view>
<button open-type="chooseAvatar" bindchooseavatar="onChooseAvatar" style="background-color: white;">
<block wx:if="{{img}}">
<image class="header" mode="widthFix" src="{{img}}"></image>
</block>
<block wx:else>
<image class="header" src="/images/mo.jpg"></image>
</block>
</button>
<input style="margin-top: 20px;" placeholder="请输入您的昵称" type="nickname" value="{{nickname}}" bindblur="bindblur"></input>
<!-- <view class="header">
<open-data class="" type="userAvatarUrl"></open-data>
</view> -->
</view>
<view class="auth-title">登录后可体验更多功能</view>
<view class="auth-subtitle">99%的用户选择使用微信默认头像和昵称</view>
<!-- <button class="login-btn" openType="getUserInfo" lang="zh_CN" bindgetuserinfo="authorLogin">授权登录</button> -->
<button class="login-btn" lang="zh_CN" bindtap="setBtnTap">确认登录</button>
</view>
<view class="no-login-btn" style="width:84%;margin-left:5%;">
<button class="btn-normal" catchtap="onNotLogin">暂不登录</button>
</view>
改完后: