[baozhangchao] 3 år sedan
förälder
incheckning
91b7e6cbf9
1 ändrade filer med 17 tillägg och 3 borttagningar
  1. 17
    3
      src/utils/initial.js

+ 17
- 3
src/utils/initial.js Visa fil

61
 export function Login () {
61
 export function Login () {
62
   const code = process.env.NODE_ENV === 'development' ? '123' : getCode()
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
   return LoginUser(code).then(e => {
77
   return LoginUser(code).then(e => {
65
     // PVsum
78
     // PVsum
66
     console.log(e);
79
     console.log(e);
87
       console.error(error)
100
       console.error(error)
88
     }
101
     }
89
 
102
 
90
-    setTimeout(() => {
103
+    if (isLoaded) {
91
       hideLoading()
104
       hideLoading()
92
-
93
-    }, 1000);
105
+    } else {
106
+      isLoaded = true
107
+    }
94
 
108
 
95
     return;
109
     return;
96
   })
110
   })