<template>
  <div class="username">
    <el-form
      :model="ruleForm"
      :rules="rules"
      ref="ruleForm"
      label-width="100px"
      class="demo-ruleForm"
    >
      <el-form-item prop="name">
        <el-input v-model="ruleForm.name" placeholder="请输入账号"></el-input>
      </el-form-item>
      <el-form-item prop="password">
        <el-input
          v-model="ruleForm.password"
          placeholder="请输入密码"
          show-password
        ></el-input>
      </el-form-item>
      <el-button type="primary" @click="submitForm()">登录</el-button>
      <p>
        还没有账号？<span @click="$router.push('/user/register')">立即注册</span
        ><span>|</span><span @click="$router.push('/user/forgetPassword')">忘记密码？</span>
      </p>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      ruleForm: {
        name: "",
        password: ""
      },
      rules: {
        name: [{ required: true, message: "请输入账号", trigger: "blur" }],
        password: [{ required: true, message: "请输入密码", trigger: "blur" }]
      }
    };
  },
  methods: {
    //提交表单
    submitForm() {
      if (this.ruleForm.name && this.ruleForm.password) {
        console.log(123);
      }
    }
  }
};
</script>

<style lang="scss">
.username {
  .el-form {
    .el-form-item {
      .el-form-item__content {
        margin-left: 0 !important;
        display: flex;
      }
    }
  }
  p {
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: rgba(153, 153, 153, 1);
    line-height: 20px;
    margin-top: 60px;
    text-align: center;
  }
  .el-input {
    input {
      width: 100%;
      height: 42px;
      border-radius: 0;
    }
  }
  .el-form {
    .el-form-item {
      margin-top: 30px;
      button {
        border-radius: 0;
        border: 1px solid #108ee9;
        color: #108ee9;
        margin-left: 10px;
        min-width: 150px;
        height: 41px;
        margin-top: 0;
      }
    }
    button {
      width: 100%;
      height: 42px;
      margin-top: 20px;
      border-radius: 0;
      background: #3071fe;
      border: 1px solid #3071fe;
    }
    p {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: rgba(102, 102, 102, 1);
      line-height: 20px;
      text-align: center;
      margin-top: 10px;
      span {
        color: #108ee9;
        cursor: pointer;
        margin: 0 5px;
      }
    }
  }
}
</style>
