Browse Source

修复bug

zhaoke 3 years ago
parent
commit
3f484c4208
1 changed files with 22 additions and 8 deletions
  1. 22 8
      src/App.vue

+ 22 - 8
src/App.vue

@@ -69,6 +69,7 @@ export default {
       },
       flag: false,
       loading: false,
+      LoginError: null
     };
   },
   computed: {
@@ -78,7 +79,7 @@ export default {
       "name",
       "systemSet",
       "roles",
-      "errorNum",
+      "errorNum"
     ]),
   },
   watch: {
@@ -102,6 +103,10 @@ export default {
       deep: true,
     },
   },
+  created () {
+    const { LoginError } = typeof this.systemSet === "string" ? JSON.parse(this.systemSet) : this.systemSet;
+    this.LoginError = LoginError;
+  },
   mounted () {
     const num = Number(this.errorNum);
     if (this.dialog && num >= 2) {
@@ -253,13 +258,22 @@ export default {
           this.handleTimer();
           this.loading = false;
         } else {
-          const num = Number(res.returnData);
-          this.form.identify = '';
-          this.$store.dispatch("app/getErrorNum", num);
-          if (num >= 2) {
-            this.getCheckCode();
-          }
-          if (num >= 5) {
+          if (res.returnData) {
+            const num = Number(res.returnData);
+            this.form.identify = '';
+            this.$store.dispatch("app/getErrorNum", num);
+            if (num >= 2) {
+              this.getCheckCode();
+            }
+            if (num >= Number(this.LoginError)) {
+              await this.$store.dispatch("user/logout");
+              this.$store.dispatch("app/getErrorNum", 0);
+              this.clearAll();
+              this.$store.dispatch("app/toggleDialog", false);
+              this.$router.push(`/login?redirect=${this.$route.fullPath}`);
+              location.reload();
+            }
+          } else {
             await this.$store.dispatch("user/logout");
             this.$store.dispatch("app/getErrorNum", 0);
             this.clearAll();