<!--pages/user/index.wxml-->
<view class='container'>
  <view class='user_bg'>
    <image mode='aspectFill' class='user_bg_img'></image>
    <view class='user_avatar_bg'>
      <view class='user_avatar_con'>
        <!-- 新的登录逻辑 -->
        <view class="userinfo">
          <block wx:if="{{canIUseNicknameComp && isLogin}}">
            <button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
              <image class="user_avatar" src="{{userInfo.avatarUrl}}" mode="aspectFit"></image>
            </button>
            <view class="nickname-wrapper" wx:if="{{userInfo.nickName}}">
              <input type="nickname" class="nickname-input" placeholder="{{userInfo.nickName || '请输入昵称'}}" bind:change="onInputChange" />
            </view>
            <!-- <view class="nickname-display" wx:else>
              <text class='user_nickName'>{{userInfo.nickName || '微信用户'}}</text>
            </view> -->
          </block>
          <block wx:else>
            <image mode="aspectFit" class='user_avatar' src='{{avatarUrl||avatar}}'></image>
            <text class='user_nickName' bindtap='getUserProfile'>{{isLogin ? (avatarName || userInfo.nickName) : "登录"}}</text>
            <!-- 登录按钮 -->
            <!-- <button class='user_avatar_btn' bindtap="{{isLogin ? 'handleAvatarClick' : 'getUserProfile'}}">
              {{isLogin ? '点击设置头像昵称' : '点击登录'}}
            </button> -->
          </block>
        </view>
      </view>
    </view>
  </view>
  <view>
    <view class="fdkk-cells">
    <view  wx:for="{{tabList}}" bindtap='tapByIdx' data-idx='{{item.id}}' wx:key="index">
    
    </view>
      <view wx:for="{{tabList}}" bindtap='tapByIdx' data-idx='{{item.id}}' wx:key="index"  hover-class='none' class="weui-cell">
        <view class="weui-cell__hd">
        </view>
        <view class="weui-cell__bd">
          <text class='list-txt'>我的{{item.name}}</text>
        </view>
        <view class="weui-cell__ft weui-cell__ft_in-access"></view>
      </view>

      <view bindtap='clickCell' class="weui-cell">
        <view class="weui-cell__hd">
        </view>
        <view class="weui-cell__bd">
          <text class='list-txt'>联系我们</text>
        </view>
        <view class="weui-cell__ft weui-cell__ft_in-access"></view>
      </view>
    </view>
  </view>
  <view class='user_order' wx:if="{{isLogin}}">
    <view class="fdkk-cells">
      <view bindtap='_logout' hover-class='none' class="weui-cell">
        <view class="weui-cell__hd">
        </view>
        <view class="weui-cell__bd">
          <text class='list-txt'>退出</text>
        </view>
      </view>
    </view>
  </view>
</view>