<!--pages/login/index.wxml-->
<view class="sg-container">
  <view class="sg-login-box sg-pad-lg">
    <view class="sg-center sg-bold sg-title sg-primary-color">{{ title }}</view>
    <view class="sg-form">
      <block wx:if="{{ type == 'mobile' || type == 'forget' }}">
        <view class="sg-form-item sg-bottom-border">
          <van-field left-icon="user-o" value="{{ mobile }}" type="number" placeholder="请输入手机号" bind:change="updateValue"
            data-name="mobile" label-class="sg-label" />
        </view>
        <view class="sg-form-item sg-bottom-border">
          <block wx:if="{{ type == 'mobile' }}">
            <van-field left-icon="lock" value="{{ password }}" placeholder="请输入密码" bind:change="onChange" password="true"
            bind:change="updateValue" data-name="password" label-class="sg-label" />
          </block>
          <block wx:else>
            <van-field left-icon="lock" value="{{ name }}" placeholder="请输入真实姓名" bind:change="onChange"  bind:change="updateValue" data-name="name" label-class="sg-label" />
          </block>
        </view>
      </block>
      <block wx:if="{{ type == 'mobile' }}">
        <van-button type="info" block="true" round="true" color="#195ED7" custom-class="sg-margin-top sg-shadow"
          bindtap="login">登录</van-button>
      </block>
      <block wx:elif="{{ type == 'forget' }}">
        <van-button type="warning" block="true" round="true" custom-class="sg-margin-top sg-shadow"
          bindtap="reset">提交管理员重置</van-button>
          <van-button type="info" block="true" round="true" color="#195ED7" custom-class="sg-margin-top sg-shadow" bindtap="switchType" data-type="mobile">返回手机登录</van-button>
      </block>
      <block wx:elif="{{ type == 'wechat' }}">
        <van-button type="primary" block="true" round="true" custom-class="sg-margin-top sg-shadow"
        bind:getuserinfo="getUserInfo" icon="http://t18.9026.com/mini/wechat2.png" open-type="getUserInfo">微信账号快捷登录</van-button>
          <van-button type="info" block="true" round="true" color="#195ED7" custom-class="sg-margin-top sg-shadow" bindtap="switchType" data-type="mobile">返回手机登录</van-button>
      </block>
      <block wx:if="{{ type == 'mobile' }}">
        <view class="sg-pad-top" bindtap="switchType" data-type="forget">忘记密码？</view>
      </block>
      <block wx:if="{{ type == 'mobile' }}">
        <van-divider contentPosition="center">其他登录方式</van-divider>
        <view class="sg-third-box">
          <image src="http://t18.9026.com/mini/wechat.png" class="sg-wechat-img" mode="widthFix" bindtap="switchType"
            data-type="wechat"></image>
        </view>
      </block>
      <block wx:if="{{ type == 'forget' }}">
        <view class="sg-hint-box sg-margin-top sg-gray-color sg-font-small">
          <view>温馨提示：</view>
          <view>管理员重置成功后，密码默认设置为：123456
重新在登录页输入手机号和密码后即可登录</view>
        </view>
      </block>
    </view>
  </view>
  <image src="http://t18.9026.com/mini/login-bg.png" mode="widthFix" class="sg-bg"></image>
</view>