张延森 3 gadus atpakaļ
vecāks
revīzija
74f2d1ba25
4 mainītis faili ar 27 papildinājumiem un 1 dzēšanām
  1. 14
    0
      public/index.html
  2. Binārs
      public/loading.gif
  3. 9
    1
      src/pages/Honghe.vue
  4. 4
    0
      src/utils/index.js

+ 14
- 0
public/index.html Parādīt failu

@@ -6,11 +6,25 @@
6 6
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
7 7
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
8 8
     <title><%= htmlWebpackPlugin.options.title %></title>
9
+    <style>
10
+      .mainloading {
11
+        position: absolute;
12
+        left: 0;
13
+        top: 0;
14
+        width: 100vw;
15
+        height: 100vh;
16
+        overflow: hidden;
17
+
18
+        background: #262626 url('./loading.gif') no-repeat center center;
19
+        z-index: 999;
20
+      }
21
+    </style>
9 22
   </head>
10 23
   <body>
11 24
     <noscript>
12 25
       <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13 26
     </noscript>
27
+    <div class="mainloading"></div>
14 28
     <div id="app"></div>
15 29
     <!-- built files will be auto injected -->
16 30
   </body>

Binārs
public/loading.gif Parādīt failu


+ 9
- 1
src/pages/Honghe.vue Parādīt failu

@@ -26,6 +26,7 @@
26 26
 import { useModel } from '@/store'
27 27
 import { drawLottery, getPrizeList } from '@/services/person'
28 28
 import { rand, shuffle } from '@/utils/math'
29
+import { hideLoading } from '@/utils'
29 30
 
30 31
 // 月份信息
31 32
 const monthList = [
@@ -110,7 +111,14 @@ export default {
110 111
     },
111 112
     // 获取奖品列表
112 113
     getPrizes() {
113
-      getPrizeList().then(list => this.prizeList = list);
114
+      getPrizeList().then(list => {
115
+        this.prizeList = list;
116
+
117
+        const t = setTimeout(() => {
118
+          hideLoading()
119
+          clearTimeout(t)
120
+        }, 1000);
121
+      });
114 122
     }
115 123
   }
116 124
 }

+ 4
- 0
src/utils/index.js Parādīt failu

@@ -0,0 +1,4 @@
1
+
2
+export function hideLoading() {
3
+  document.getElementsByClassName('mainloading')[0].style="display: none"
4
+}