yuany 3 лет назад
Родитель
Сommit
9547e96423
1 измененных файлов с 21 добавлено и 14 удалено
  1. 21 14
      src/views/account/Login.vue

+ 21 - 14
src/views/account/Login.vue

@@ -60,7 +60,13 @@
           忘记密码?
         </van-button> -->
 
-                <van-button block size="large" native-type="submit" type="primary" class="sure" :disabled="!canLogin"
+                <van-button
+                    block
+                    size="large"
+                    native-type="submit"
+                    type="primary"
+                    class="sure"
+                    :disabled="!canLogin && !loading"
                     >登录</van-button
                 >
             </div>
@@ -104,7 +110,8 @@ export default {
             checked: localStorage.getItem('agreeTerm') === 'true',
             protocol: false,
             activeIcon: require('@assets/checked.png'),
-            inactiveIcon: require('@assets/checked1.png')
+            inactiveIcon: require('@assets/checked1.png'),
+            loading: true
         };
     },
     computed: {
@@ -133,6 +140,7 @@ export default {
                 this.protocol = true;
                 return;
             }
+            this.loading = true;
             this.$toast.loading({
                 message: '加载中...',
                 forbidClick: true
@@ -146,23 +154,21 @@ export default {
                         !fromRoute ||
                         !fromRoute.name ||
                         fromRoute.name === 'userRegister' ||
-                        fromRoute.name === 'userLogin' || 
+                        fromRoute.name === 'userLogin' ||
                         fromRoute.name === 'agreement'
                     ) {
                         this.$router.replace('/home');
                     } else {
                         this.$router.back();
-                        try{
-                            setTimeout(()=>{
-                                let path = window.location.hash.slice(1)
-                                this.$router.replace(path)
-                            },1)
-                            return false
-                        }catch(e){
-
-                        }
+                        try {
+                            setTimeout(() => {
+                                let path = window.location.hash.slice(1);
+                                this.$router.replace(path);
+                            }, 1);
+                            return false;
+                        } catch (e) {}
                     }
-                }, 1500);
+                }, 1000);
             });
         },
         agreement(value) {
@@ -182,6 +188,7 @@ export default {
                         inviteCode: this.$store.state.inviteCode
                     })
                     .catch(e => {
+                        this.loading = false;
                         if (e) {
                             this.$toast(e.error);
                         }
@@ -456,7 +463,7 @@ export default {
 //     height: 14px;
 // }
 
-.img-icon{
+.img-icon {
     width: 14px;
     height: 14px;
 }