zhongtianhaoyuan 2 éve
szülő
commit
6b11eacda6
2 módosított fájl, 50 hozzáadás és 31 törlés
  1. 8 0
      src/api/user.js
  2. 42 31
      src/views/login/index.vue

+ 8 - 0
src/api/user.js

@@ -59,5 +59,13 @@ export function getCheckInfo(data) {
     params: data,
   })
 }
+//
+export function getlogin(data) {
+  return request({
+    url: '/loginController/query/login',
+    method: 'get',
+    params: data,
+  })
+}
 
 

+ 42 - 31
src/views/login/index.vue

@@ -76,7 +76,8 @@
   } from "@/utils/validate";
   import {
     getVerifyCode,
-    getCheckInfo
+    getCheckInfo,
+    getlogin
   } from '@/api/user'
   import SIdentify from "./sidentify";
   export default {
@@ -278,36 +279,46 @@
             this.loginForm.companyName = "黑龙江中天昊元贸易有限公司";
             this.loading = true;
             // this.$store.dispatch('user/login', this.loginForm)
-            // const res = await this.$store.dispatch('user/login', this.loginForm)
-            const res = await this.login(this.loginForm);
-            localStorage.setItem("ws_login_type", 2);
-            Cookies.set("ws_login_companyShortName", this.loginForm.companyName, {
-              expires: 365,
-            });
-            Cookies.set("ws_login_account", this.loginForm.username, {
-              expires: 365,
-            });
-            if (this.rememberMe) {
-              Cookies.set("ws_login_pwd", this.loginForm.password, {
-                expires: 365,
-              });
-              Cookies.set("ws_login_rememberMe", 1, {
-                expires: 365,
-              });
-            } else {
-              Cookies.remove("ws_login_companyShortName");
-              Cookies.remove("ws_login_account");
-              Cookies.remove("ws_login_pwd");
-              Cookies.set("ws_login_rememberMe", 0, {
-                expires: 365,
-              });
-            }
-            const redirect = this.$route.query.redirect;
-            if (redirect) {
-              this.$router.push(redirect);
-            } else {
-              this.$router.push("/");
-            }
+            // const res = await this.$store.dispatch('user/login', this.loginForm)、
+            getlogin({
+              loginName: this.loginForm.username,
+              loginPassword: this.loginForm.password,
+              compId: "2710b21efc1e4393930c5dc800010dc4",
+            }).then(response => { //校验错误次数(五次锁定)
+              if (response.code == 200) {
+                this.login(this.loginForm);
+                localStorage.setItem("ws_login_type", 2);
+                Cookies.set("ws_login_companyShortName", this.loginForm.companyName, {
+                  expires: 365,
+                });
+                Cookies.set("ws_login_account", this.loginForm.username, {
+                  expires: 365,
+                });
+                if (this.rememberMe) {
+                  Cookies.set("ws_login_pwd", this.loginForm.password, {
+                    expires: 365,
+                  });
+                  Cookies.set("ws_login_rememberMe", 1, {
+                    expires: 365,
+                  });
+                } else {
+                  Cookies.remove("ws_login_companyShortName");
+                  Cookies.remove("ws_login_account");
+                  Cookies.remove("ws_login_pwd");
+                  Cookies.set("ws_login_rememberMe", 0, {
+                    expires: 365,
+                  });
+                }
+                const redirect = this.$route.query.redirect;
+                if (redirect) {
+                  this.$router.push(redirect);
+                } else {
+                  this.$router.push("/");
+                }
+              } else {
+                this.$message.error(response.message)
+              }
+            })
             // .then(response => {
             //   localStorage.setItem('UserInfo', JSON.stringify(response.data))
             //   this.$router.push({