zhangxiaoxu123
2022-09-13 08b5ddfa9a0a2ed52bd7d7b98ca16ef4dcc610a6
src/pages/login.vue
@@ -47,14 +47,15 @@
  </div>
</template>
<script>
// import {login} from "@/api/index";
import {login} from "@/api/index";
export default {
  name: "login",
  data() {
    return {
      loginForm: {
        username: "admin",
        password: "123456"
        username: "",
        password: "",
      },
      loginFormRules: {
        // 验证用户名是否合法
@@ -76,7 +77,12 @@
      this.$refs.loginFormRef.validate(async valid => {
        console.log(valid);
        if (!valid) return;
        this.$router.push("/");
        this.$store.dispatch('login',this.loginForm).then(res => {
            this.$router.push('/index')
        })
          // login(this.loginForm).then(res => {
          //   this.$router.push('/index')
          // })
      });
    }
  }
@@ -139,7 +145,7 @@
.login-container {
  width: 10rem;
  height: 6.5625rem;
  background: url(../assets/images/login/loginBackground@2x.png) no-repeat;
  background: url(../assets/images/login/loginBackground.jpg) no-repeat;
  background-size: 100%;
  position: relative;
}
@@ -147,7 +153,7 @@
.title {
  width: 13.0612rem;
  height: 0.5rem;
  background: url(../assets/images/login/top@2x.png) no-repeat;
  background: url(../assets/images/login/top.png) no-repeat;
  background-size: 100%;
  position: absolute;
  left: -1.5306rem;
@@ -164,7 +170,7 @@
  position: absolute;
  width: 0.3438rem;
  height: 0.3359rem;
  background: url(../assets/images/login/header@2x.png) no-repeat;
  background: url(../assets/images/login/header.png) no-repeat;
  background-size: 100%;
  border-right: 0.0039rem dashed #51d2ff;
}
@@ -175,14 +181,14 @@
  width: 0.3438rem;
  height: 0.3359rem;
  border-right: 0.0039rem dashed #51d2ff;
  background: url(../assets/images/login/lock@2x_1.png) no-repeat;
  background: url(../assets/images/login/lock_1.png) no-repeat;
  background-size: 100%;
}
.loginBox {
  width: 3.125rem;
  height: 3.1979rem;
  background: url(../assets/images/login/loginBorder@2x.png);
  background: url(../assets/images/login/loginBorder.png);
  background-size: 100%;
  position: relative;
  margin: 0 auto;