login.vue 3.12 KB
<template>
  <div class="login_container">
    <UserCommon>
      <template slot="top">
        <NafmHeader :isBgImg="false" bgColor="transparent" />
      </template>
    </UserCommon>
    <div class="login_content">
      <van-tabs @click="switchTab" :border="false" class="login_tabs" v-model="tabActive" swipeable>
        <van-tab title="手机号登录" :name="1">
          <div class="login_form">
            <van-field v-model="userName" clearable type="tel" maxlength="11" :left-icon="userNameIcon" placeholder="请输入手机号" />
            <van-field v-model="password" clearable label="" maxlength="16" :left-icon="passwordIcon" placeholder="请输入6-16位密码">
              <template #button>
                <SendVerificationCode :phone="userName" />
              </template>
            </van-field>
            <div>
              <van-button></van-button>
            </div>
          </div>
        </van-tab>
        <van-tab title="账号密码登录" :name="2">
          <div class="login_form">
            <van-field v-model="userName" clearable type="tel" maxlength="11" :left-icon="userNameIcon" placeholder="请输入手机号" />
            <van-field v-model="password" clearable label="" maxlength="16" :left-icon="passwordIcon" placeholder="请输入6-16位密码" />
            <div class="form_second">
              <van-checkbox v-model="checked" checked-color="#106abc" class="checkbox" shape="square" icon-size="12px">记住密码</van-checkbox>
              <span class="forget">忘记密码</span>
            </div>
          </div>
        </van-tab>
      </van-tabs>
    </div>
    <div class="login_others">
      <div>其他登录方式</div>
      <div>
        <img src="require('@/assets/icon/wechat.png')" alt="">
      </div>
    </div>
  </div>
</template>
<script>
import UserCommon from '@/components/UserCommon'
import SendVerificationCode from '@/components/SendVerificationCode'
export default {
  name: 'Login',
  components: {
    UserCommon,
    SendVerificationCode
  },
  data() {
    return {
      tabActive: 1,
      userName: null,
      password: "",
      checked: false,
      userNameIcon: require('@/assets/icon/user.png'),
      passwordIcon: require('@/assets/icon/password.png'),
    }
  },
  methods: {
    handleBack() {
      this.$router.back()
    },
    switchTab(name) {
      this.tabActive = name
    },
  }
}
</script>
<style lang="less" scoped>
.login-container {
  width: 100%;
  height: 100%;
  font-size: 40px;
}
.login_content {
  margin-top: 40px;
}
/deep/ .van-tabs__nav--line {
  width: 60%;
  margin: 0 auto;
}
/deep/ .van-tab {
  border-bottom: 1px solid #b8cfe5;
}
/deep/ .van-tabs__line {
  bottom: 4px;
}
.login_form {
  margin: 30px 42px 0 42px;
}
/deep/ .van-cell:not(:last-child)::after {
  border-bottom: 1px solid #efefef;
}
.form_second {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  color: #999;
  .checkbox {
    margin-left: 20px;
    /deep/ .van-checkbox__label {
      color: #999;
    }
  }
  .forget {
    text-decoration: underline;
  }
}

// /deep/ .van-field__body input::-webkit-input-placeholder {
//   color: #8F9196;
// }
</style>