Browse Source

登录失败逻辑修改。

zhengqiang 5 years ago
parent
commit
e68bdeed80
2 changed files with 12 additions and 4 deletions
  1. 2 2
      src/store/modules/user.js
  2. 10 2
      src/views/Login.vue

+ 2 - 2
src/store/modules/user.js

@@ -29,8 +29,8 @@ const actions = {
                 else{
                     Message.error(jsonData.message || 'Has Error')
                 }
-
-                resolve()
+                
+                resolve(jsonData.result)
             }).catch(error => {
                 reject(error)
             })

+ 10 - 2
src/views/Login.vue

@@ -40,6 +40,7 @@
             style="width:100%;margin-bottom:30px;"
             :loading="loading"
             @click.native.prevent="handleLogin"
+            class="green-btn"
           >登录</el-button>
         </el-form>
       </el-card>
@@ -105,9 +106,12 @@ export default {
 
           self.$store
             .dispatch("user/login", self.loginForm)
-            .then(() => {
-              self.$router.push({ path: this.redirect || "/home" });
+            .then((result) => {
               self.loading = false;
+
+              if(result){
+                self.$router.push({ path: this.redirect || "/home" });
+              }
             })
             .catch(error => {
               self.loading = false;
@@ -235,5 +239,9 @@ $text_color: black;
     right: 35px;
     bottom: 28px;
   }
+  .green-btn{
+    background-color:#64a63c;
+    border-color: #64a63c;
+  }
 }
 </style>