Box.wxml 2.37 KB
<view class="box">
  <block wx:if="{{loginType == 0}}">
    <image webp class="img opacity-view" src="{{IMGURL}}login/login.webp" />
  </block>
  <block wx:else>
    <view class="input-box opacity-view">
      <view class="title">{{loginType == 1?'手机号':'账号'}}登录</view>
      <block wx:if="{{loginType == 1}}">
        <view class="input">
          <input type="number" placeholder="填写手机号" placeholder-class="placeholder" bindinput="input" data-name="phone" value="{{formData.phone}}" maxlength="11" />
          <input-icon show="{{formData.phone}}" bindtap="clear" data-name="phone" />
        </view>
        <view class="input">
          <input type="number" placeholder="填写验证码" placeholder-class="placeholder" bindinput="input" data-name="code" value="{{formData.code}}" maxlength="4" />
          <input-icon show="{{formData.code}}" bindtap="clear" data-name="code" />
          <button class="sms text-center " bindtap="getSmsCode" disabled="{{count || !phoneReady}}" loading="{{smsLoading}}">{{
            count? count + 's':'获取验证码'
            }}</button>
          <block wx:if="{{smsError}}">
            <view class="error">验证码错误</view>
          </block>
        </view>
      </block>
      <block wx:else>
        <view class="input">
          <input type="text" placeholder="填写账号" placeholder-class="placeholder" bindinput="input" data-name="account" value="{{formData.account}}" maxlength="15" />
          <input-icon show="{{formData.account}}" bindtap="clear" data-name="account" />
        </view>
        <view class="input">
          <input type="text" placeholder="填写密码" placeholder-class="placeholder" bindinput="input" data-name="password" value="{{formData.password}}" maxlength="20" password='{{!showPwd}}' />
          <input-icon show bindtap="pwdSwitch" type="{{showPwd?'showPwd':'hidePwd'}}" />
          <input-icon show="{{formData.password}}" bindtap="clear" data-name="password" />
        </view>
      </block>
    </view>
  </block>
</view>
<block wx:if="{{loginType == 0}}">
  <button class="button" disabled="{{disabled}}" hover-class="btn-hover" open-type="getPhoneNumber" bindgetphonenumber="wxLogin" loading="{{loading}}">微信登录</button>
</block>
<block wx:else>
  <button class="button" disabled="{{disabled}}" hover-class="btn-hover" bindtap="login" loading="{{loading}}">登录</button>
</block>