<wxs src="../../utils/filter.wxs" module="filters" />
<view class="editBox">
  <button class="resetBtn editRow" open-type="chooseAvatar" bind:chooseavatar="changeAvatar">
    <view class="name">头像</view>
    <view class="right">
      <image class='avatar' src='{{ userInfo.avatar}}'></image>
      <image class='black' src='/static/black.png'></image>
    </view>
  </button>
  <view class="editRow">
    <view class="name">昵称</view>
    <view class="right">
      <input name='nickName' type="nickname" placeholder="请输入昵称" class='nickName' maxlength="9"
        value='{{userInfo.nickName}}' bindblur='saveNickName'></input>
      <image class='black' src='/static/black.png'></image>
    </view>
  </view>
  <view class="editRow" bindtap="selectGender">
    <view class="name">性别</view>
    <view class="right">
      <view class="name">
        {{userInfo.gender===0?'女':'男'}}
      </view>
      <image class='black' src='/static/black.png'></image>
    </view>
  </view>
  <view class="editRow">
    <view class="name">生日</view>
    <view class="right">
      <picker mode="date" value="{{filters.formatDate( userInfo.birthday, 2)  }}" bindchange="bindDateChange"
        end="2022-01-01">
        <view class="name">{{userInfo.birthday?filters.formatDate(userInfo.birthday,2):'请选择生日' }}</view>
      </picker>
      <image class='black' src='/static/black.png'></image>
    </view>
  </view>
  <view class="editRow mt40" bindtap="selectProfession">
    <view class="name">身份</view>
    <view class="right">
      <view class="name">
        {{userInfo.profession}}
      </view>
      <image class='black' src='/static/black.png'></image>
    </view>
  </view>
  <view class="editRow">
    <view class="name">年级</view>
    <view class="right">
      <picker value="{{gradeIndex}}" range="{{gradeArray}}" range-key="key" bindchange="bindGradeChange">
        <view class="name">
          {{filters.gradeFilter(userInfo.grade)}}
        </view>
      </picker>
      <image class='black' src='/static/black.png'></image>
    </view>
  </view>
  <view class="editRow">
    <view class="name">学校</view>
    <view class="right">
      <input placeholder="请输入学校" class='nickName' maxlength="18" value='{{userInfo.schoolName}}'
        bindblur='saveSchool'></input>
      <image class='black' src='/static/black.png'></image>
    </view>
  </view>
  <view class="editRow">
    <view class="name">手机号</view>
    <view class="right" wx:if="{{!userInfo.mobile}}">
      <button class="resetBtn" style="font-size: 30rpx;" open-type="getPhoneNumber"
        bindgetphonenumber="getPhoneNumber">立即绑定</button>
      <image class='black' src='/static/black.png'></image>
    </view>
    <view class="right" wx:if="{{userInfo.mobile}}">
      {{userInfo.mobile}}
    </view>
  </view>
  <!--    <view class="switchAccount mt40">
        切换账号
    </view> -->
</view>