[baozhangchao] 3 anni fa
parent
commit
91b7e6cbf9
1 ha cambiato i file con 17 aggiunte e 3 eliminazioni
  1. 17
    3
      src/utils/initial.js

+ 17
- 3
src/utils/initial.js Vedi File

@@ -61,6 +61,19 @@ export function share (opt) {
61 61
 export function Login () {
62 62
   const code = process.env.NODE_ENV === 'development' ? '123' : getCode()
63 63
 
64
+  let isLoaded = false;
65
+
66
+  const t = setTimeout(() => {
67
+    if (isLoaded) {
68
+      hideLoading()
69
+    } else {
70
+      isLoaded = true
71
+    }
72
+
73
+    clearTimeout(t);
74
+  }, 1000);
75
+
76
+
64 77
   return LoginUser(code).then(e => {
65 78
     // PVsum
66 79
     console.log(e);
@@ -87,10 +100,11 @@ export function Login () {
87 100
       console.error(error)
88 101
     }
89 102
 
90
-    setTimeout(() => {
103
+    if (isLoaded) {
91 104
       hideLoading()
92
-
93
-    }, 1000);
105
+    } else {
106
+      isLoaded = true
107
+    }
94 108
 
95 109
     return;
96 110
   })