1、用户未授权(首次登录)
button open-type='getUserInfo'
2、用户已经授权(再次登录)
wx.getUserInfo
html文件:
<view class="indexContainer">
<image wx:if='{
{userInfo.avatarUrl}}' class="avatarUrl" src="{
{userInfo.avatarUrl}}"></image>
<button wx:else bindgetuserinfo='handleGetUserInfo' open-type="getUserInfo">获取用户信息</button>
<text class="userName">{
{userInfo.nickName}}</text>
<!-- 测试事件绑定 -->
<!-- <view class="goStudy" catchtap="handleParent">
<text catchtap&