北京经济技术开发区经开区虚拟城市项目-【前端】-Web
lixuliang
2024-04-12 dbb352c9d988dfac83da979023fe81a0a02f88e9
src/components/login.vue
@@ -9,7 +9,6 @@
        :model="loginForm"
        :rules="rules"
        ref="loginForm"
        @keyup.enter.native="submitForm('loginForm')"
      >
        <el-form-item prop="loginname">
          <div class="user-box">
@@ -54,6 +53,7 @@
                class="nobr"
                autocomplete="off"
                clearable
                @keyup.enter.native="submitForm('loginForm')"
              >
              </el-input>
            </div>
@@ -108,7 +108,6 @@
  },
  created() {},
  mounted() {
    window.addEventListener("keydown", this.keyDown);
    // if (
    //   window.location.href.match(/=(\S*)#/) &&
    //   window.location.href.match(/=(\S*)#/)[1] != ""
@@ -125,18 +124,7 @@
      this.passCAFree();
    }
  },
  destroyed() {
    // 销毁事件
    window.removeEventListener("keydown", this.keyDown, false);
  },
  methods: {
    // 点击回车键登录
    keyDown(e) {
      // 回车则执行登录方法 enter键的ASCII是13
      if (e.keyCode == 13 || e.keyCode == 100) {
        this.submitForm("loginForm"); // 定义的登录方法
      }
    },
    // 账号密码登录
    submitForm(formName) {
      // this.$router.push("/index");
@@ -148,7 +136,6 @@
            spinner: "el-icon-loading",
            background: "rgba(0, 0, 0, 0.7)",
          });
          login({
            username: this.loginForm.loginname,
            password: this.loginForm.password,
@@ -178,7 +165,6 @@
              return Promise.resolve(error.response);
              // reject(error);
            });
          // //如果登录失败,需要刷新验证码的
          // this.$refs.refresh.createdCode();
          // this.validCode = ""; //清空验证码输入框的内容