ZhangXianQiang
2024-03-28 07e7a6323d6f98fe2dfdf2733daf457a4e4f42f4
src/views/login.vue
@@ -1,40 +1,32 @@
<template>
  <div class="login">
    <div class="title-container">
      <h3 class="title">自贡公安天网运维平台</h3>
    <div class="login-container">
      <div class="login-wrapper">
        <div class="info-wrapper enter-x">
          <div class="logo-wrapper">
            <img src="../assets/svg/login-box-bg.svg" alt="">
    </div>
          <div class="title-wrapper">
            <p class="title">自贡公安天网运维平台</p>
          </div>
        </div>
        <div class="form-wrapper">
          <h1 class="title">登录</h1>
    <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
      <h3 class="title">自贡公安天网运维平台</h3>
      <el-form-item prop="username">
        <el-input
          v-model="loginForm.username"
          type="text"
          auto-complete="off"
          placeholder="账号"
        >
              <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
          <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
        </el-input>
      </el-form-item>
      <el-form-item prop="password">
        <el-input
          v-model="loginForm.password"
          type="password"
          auto-complete="off"
          placeholder="密码"
          @keyup.enter.native="handleLogin"
        >
              <el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码"
                @keyup.enter.native="handleLogin">
          <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
        </el-input>
      </el-form-item>
      <el-form-item prop="code" v-if="captchaEnabled">
        <el-input
          v-model="loginForm.code"
          auto-complete="off"
          placeholder="验证码"
          style="width: 63%"
          @keyup.enter.native="handleLogin"
        >
              <el-input v-model="loginForm.code" auto-complete="off" placeholder="验证码" style="width: 63%"
                @keyup.enter.native="handleLogin">
          <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
        </el-input>
        <div class="login-code">
@@ -43,13 +35,8 @@
      </el-form-item>
      <el-checkbox v-model="loginForm.rememberMe" style=" margin:0px 0px 25px 0px;">记住密码</el-checkbox>
      <el-form-item style="width:100%;">
        <el-button
          :loading="loading"
          size="medium"
          type="primary"
          style="width:100%;"
          @click.native.prevent="handleLogin"
        >
              <el-button :loading="loading" size="medium" type="primary" style="width:100%;"
                @click.native.prevent="handleLogin">
          <span v-if="!loading">登 录</span>
          <span v-else>登 录 中...</span>
        </el-button>
@@ -58,7 +45,7 @@
        </div>
      </el-form-item>
    </el-form>
        </div>
    <el-dialog title="为了您的账号安全,首次登陆请修改密码" :visible.sync="loginInfo.firstLogin==0">
         <el-form>
           <el-form-item label="新密码">
@@ -72,6 +59,8 @@
            <el-button type="primary" @click="updatePwd">确 定</el-button>
         </div>
    </el-dialog>
      </div>
    </div>
  </div>
@@ -231,54 +220,142 @@
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
$light_gray:#eee;
.login {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  background-image: url("../assets/images/login-background.jpg");
  background-size: cover;
}
.title {
  // background-image: url("../assets/images/login-background.jpg");
  // background-size: cover;
  margin: 0px auto 30px auto;
  text-align: center;
  color: #707070;
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin-left: -48%;
    background-image: url('../assets/svg/login-bg.svg');
    background-repeat: no-repeat;
    background-position: 100%;
    background-size: auto 100%;
}
}
.login-container {
  margin: 0 auto;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 2;
  padding: 0 20px;
}
.login-wrapper {
  display: flex;
  height: 100%;
}
.info-wrapper {
  width: 50%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  .logo-wrapper {
    transform: translateX(-50px);
    opacity: 0;
    animation: enter-x 0.3s ease forwards;
    img {
      width: 50%;
    }
  }
  .title-wrapper {
    margin-top: 30px;
    transform: translateX(-50px);
    opacity: 0;
    animation: enter-x 0.3s ease forwards;
    animation-delay: 0.1s;
    .title {
      text-align: left;
      font-size: 30px;
      color: #fff;
    }
  }
}
.form-wrapper {
  width: 50%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  .title {
    transform: translateX(50px);
    opacity: 0;
    animation: enter-x 0.3s ease forwards;
  }
  .login-form {
    transform: translateX(50px);
    opacity: 0;
    animation: enter-x 0.3s ease forwards;
    animation-delay: 0.1s;
  }
}
.login-form {
  border-radius: 6px;
  background: #ffffff;
  width: 400px;
  padding: 25px 25px 5px 25px;
  .el-input {
    height: 38px;
    input {
      height: 38px;
    }
  }
  .input-icon {
    height: 39px;
    width: 14px;
    margin-left: 2px;
  }
}
.login-tip {
  font-size: 13px;
  text-align: center;
  color: #bfbfbf;
}
.login-code {
  width: 33%;
  height: 38px;
  float: right;
  img {
    cursor: pointer;
    vertical-align: middle;
  }
}
.el-login-footer {
  height: 40px;
  line-height: 40px;
@@ -291,13 +368,16 @@
  font-size: 12px;
  letter-spacing: 1px;
}
.login-code-img {
  height: 38px;
}
.title-container {
  position: absolute;
  transform: translateY(-400%);
  left: 35%;
  .title {
    font-size: 40px;
    color: $light_gray;
@@ -307,4 +387,42 @@
    letter-spacing: 20px;
  }
}
@media (min-width: 640px) {
  .login-container {
    max-width: 640px;
  }
}
@media (min-width: 768px) {
  .login-container {
    max-width: 768px;
  }
}
@media (min-width: 1024px) {
  .login-container {
    max-width: 1024px;
  }
}
@media (min-width: 1280px) {
  .login-container {
    max-width: 1280px;
  }
}
@media (min-width: 1536px) {
  .login-container {
    max-width: 1536px;
  }
}
@keyframes enter-x {
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}
</style>