From dbb352c9d988dfac83da979023fe81a0a02f88e9 Mon Sep 17 00:00:00 2001 From: lixuliang <lixuliang_hd@126.com> Date: 星期五, 12 四月 2024 16:34:20 +0800 Subject: [PATCH] 与数字人合并 --- src/components/login.vue | 110 ++++++++++++++++++++++++------------------------------- 1 files changed, 48 insertions(+), 62 deletions(-) diff --git a/src/components/login.vue b/src/components/login.vue index e79bdb0..585ae04 100644 --- a/src/components/login.vue +++ b/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,68 +124,55 @@ 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"); - // this.$refs[formName].validate((valid) => { - // if (valid) { - // const loading = this.$loading({ - // lock: true, - // text: "Loading", - // spinner: "el-icon-loading", - // background: "rgba(0, 0, 0, 0.7)", - // }); - - // login({ - // username: this.loginForm.loginname, - // password: this.loginForm.password, - // }) - // .then((res) => { - // loading.close(); - // if (res.code !== 200) { - // this.$message.error(res.msg); - // } else { - // let tokenData = res.token; - // let times = new Date().getTime(); - // window.localStorage.setItem("TokenTime", times); - // window.localStorage.setItem("TokenKey", tokenData); - // this.$router.push("/index"); - // } - // }) - // .catch((error) => { - // //缃戠粶瓒呮椂寮傚父澶勭悊 - // loading.close(); - // if ( - // error.code === "ECONNABORTED" || - // error.message === "Network Error" || - // error.message.includes("timeout") - // ) { - // this.$message.error("璇锋眰瓒呮椂锛岃绋嶅悗閲嶈瘯"); - // } - // return Promise.resolve(error.response); - // // reject(error); - // }); - - // // //濡傛灉鐧诲綍澶辫触锛岄渶瑕佸埛鏂伴獙璇佺爜鐨� - // // this.$refs.refresh.createdCode(); - // // this.validCode = ""; //娓呯┖楠岃瘉鐮佽緭鍏ユ鐨勫唴瀹� - // } else { - // // console.log("error submit!!"); - // return false; - // } - // }); + // this.$router.push("/index"); + this.$refs[formName].validate((valid) => { + if (valid) { + const loading = this.$loading({ + lock: true, + text: "Loading", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); + login({ + username: this.loginForm.loginname, + password: this.loginForm.password, + }) + .then((res) => { + loading.close(); + if (res.code !== 200) { + this.$message.error(res.msg); + } else { + let tokenData = res.token; + let times = new Date().getTime(); + window.localStorage.setItem("TokenTime", times); + window.localStorage.setItem("TokenKey", tokenData); + this.$router.push("/index"); + } + }) + .catch((error) => { + //缃戠粶瓒呮椂寮傚父澶勭悊 + loading.close(); + if ( + error.code === "ECONNABORTED" || + error.message === "Network Error" || + error.message.includes("timeout") + ) { + this.$message.error("璇锋眰瓒呮椂锛岃绋嶅悗閲嶈瘯"); + } + return Promise.resolve(error.response); + // reject(error); + }); + // //濡傛灉鐧诲綍澶辫触锛岄渶瑕佸埛鏂伴獙璇佺爜鐨� + // this.$refs.refresh.createdCode(); + // this.validCode = ""; //娓呯┖楠岃瘉鐮佽緭鍏ユ鐨勫唴瀹� + } else { + // console.log("error submit!!"); + return false; + } + }); }, // CA鍏嶅瘑鐧诲綍 passCAFree() { @@ -417,7 +403,7 @@ bottom: -160px; animation: square 20s linear infinite; border-radius: 45%; - box-shadow: 0px 0px 10px rgba(255,255,255,0.5); + box-shadow: 0px 0px 10px rgba(255, 255, 255, 0.5); } .bg-squares li:nth-child(1) { -- Gitblit v1.9.3