loulijun2021
2022-07-16 392f9468875a8721c17c4e15c288333017cac4a1
src/views/login/index.vue
@@ -51,7 +51,7 @@
        <div class="title-container">
          <div class="title_img" />
          <h3 class="title">新凯迪制造云平台</h3>
          <!--          <h3 class="title">新凯迪制造云平台</h3>-->
        </div>
        <el-form-item prop="username">
@@ -103,7 +103,7 @@
        <el-button
          :loading="loading"
          type="primary"
          style="width:100%;margin-bottom:30px;"
          style="width:100%;margin-top:20px;"
          @click.native.prevent="handleLogin"
        >登录
        </el-button>
@@ -131,27 +131,32 @@
      // } else {
      //   callback()
      // }
      const mPattern = /^\w+$/ // 正则 等价于[A-Za-z0-9_]
      // const mPattern = /^\w+$/ // 正则 等价于[A-Za-z0-9_]
      if (value.length < 5) {
        callback(new Error('账号长度不少于五位!'))
      } else if (!mPattern.test(value)) {
        callback(new Error('账号不符合规则,可输入字母、数字及下划线'))
      if (value.length < 1) {
        callback(new Error('账号不能为空!'))
      } else {
        callback()
      }
      // if (value.length < 1) {
      //   callback(new Error('账号不能为空!'))
      // } else if (!mPattern.test(value)) {
      //   callback(new Error('账号不符合规则,可输入字母、数字及下划线'))
      // } else {
      //   callback()
      // }
    }
    const validatePassword = (rule, value, callback) => {
      if (value.length < 6) {
        callback(new Error('密码长度不少于六位!'))
      if (value.length < 1) {
        callback(new Error('密码长度不能为空!'))
      } else {
        callback()
      }
    }
    return {
      loginForm: {
        username: 'Admin',
        password: '123456'
        username: 'Admin', // Admin
        password: '123456'// 123456
      },
      loginRules: {
        username: [{ required: true, trigger: ['blur', 'change'], validator: validateUsername }],
@@ -331,10 +336,11 @@
    align-items: center;
    .title_img {
      background: url("../../assets/images/xkd_logo.png");
      width: 200px;
      height: 100px;
      background: url("../../assets/images/xkd_newlogo.png") no-repeat;
      width: 300px;
      height: 200px;
      margin: -50px 0 20px;
      background-size: 100% 100%;
    }
    .title {