<!--pages/me/profile/index.wxml-->
<view class='page-wrapper'>
  <i-cell-group i-class='plane'>
    <i-cell title="头像" i-class="cell-class">
      <image catchtap='chooseAvatar' slot="footer" class='avatar-image' src='{{user.avatar}}'></image>
    </i-cell>

    <i-cell title="姓名" i-class="cell-class">
      <input slot="footer" class='input' type='text' placeholder='请输入您的昵称' bindinput='handleNickname' value='{{user.nickname}}'></input>
    </i-cell>

    <i-cell title="性别" is-link i-class="cell-class">
      <picker slot="footer" class='input' range="{{genders}}" value="{{user.gender-1}}" bindchange="handleGenderChange" class="picker">
        <view class='picker-text'>{{genders[gender-1]}}</view>
      </picker>
    </i-cell>
  </i-cell-group>

  <i-cell-group i-class='plane'>
    <i-cell title="手机号" i-class="cell-class">
      <block wx:if="{{phone.length == 0}}">
        <button slot="footer" bindgetphonenumber="handlePhoneAuth" type="info" open-type="getPhoneNumber" class="btn-auth-phone">授权手机号</button>
      </block>
      <block wx:else>
        <text slot="footer">{{phone}}</text>
      </block>
    </i-cell>
  </i-cell-group>

  <view class='btn-save-wrapper'>
    <i-button type="info" bind:click="handleSubmit" shape="circle">保存</i-button>
  </view>
</view>

<i-toast id="toast" />