From 6c92130d9691a9fddf28d6745d8f96273d093827 Mon Sep 17 00:00:00 2001
From: lixuliang <lixuliang_hd@126.com>
Date: 星期日, 04 二月 2024 16:26:39 +0800
Subject: [PATCH] 1

---
 src/components/login.vue |   92 +++++++++++++++++++++++-----------------------
 1 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/src/components/login.vue b/src/components/login.vue
index e79bdb0..89f38a5 100644
--- a/src/components/login.vue
+++ b/src/components/login.vue
@@ -139,54 +139,54 @@
     },
     // 璐﹀彿瀵嗙爜鐧诲綍
     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)",
-      //     });
+      // 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);
-      //       });
+          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.$refs.refresh.createdCode();
+          // this.validCode = ""; //娓呯┖楠岃瘉鐮佽緭鍏ユ鐨勫唴瀹�
+        } else {
+          // console.log("error submit!!");
+          return false;
+        }
+      });
     },
     // CA鍏嶅瘑鐧诲綍
     passCAFree() {

--
Gitblit v1.9.3