Yansen před 2 roky
rodič
revize
988297bd3f

+ 2
- 2
public/config.js Zobrazit soubor

@@ -9,5 +9,5 @@ const shareOptTpl = {
9 9
 const link1URL = 'http://h5.njyunzhi.com/wenhua818-2/index.html';
10 10
 
11 11
 // 分享接口地址
12
-const API_BASE = 'http://api.h5.zijincao.njyunzhi.com';
13
-// const API_BASE = '';
12
+// const API_BASE = 'http://api.h5.zijincao.njyunzhi.com';
13
+const API_BASE = '';

binární
public/images/pg1/shine.png Zobrazit soubor


binární
public/images/pg1/videocover.jpg Zobrazit soubor


binární
public/images/pg2-2/goAgain.png Zobrazit soubor


binární
public/images/pg2/content-bg.png Zobrazit soubor


+ 7
- 6
src/App.vue Zobrazit soubor

@@ -1,12 +1,13 @@
1 1
 <script setup>
2 2
   import { ref } from 'vue';
3 3
   import { useModel } from '@zjxpcyc/vue-tiny-store';
4
+  import { getCountryData } from '@/services/country';
4 5
   import wxsdk from '@/utils/wx'
5 6
   import track from '@/utils/track'
6 7
   import Loading from './pages/loading/index.vue';
7 8
 
8 9
   const { el, play } = useModel('audio');
9
-  const { setUser, contries } = useModel('user');
10
+  const { setUser, countries } = useModel('user');
10 11
   const show = ref(false);
11 12
   
12 13
   const { share, getCode, redirect } = wxsdk();
@@ -19,11 +20,11 @@
19 20
       track(code).then(res => {
20 21
         const { user, num } = res;
21 22
 
22
-        // 随机设置国家种植数量
23
-        const avg = (num || 0) / 8;
24
-        Object.keys(contries).forEach(key => {
25
-          contries[key] = avg + Math.floor(Math.random() * 100)
26
-        });
23
+        try {
24
+          getCountryData().then(res => countries.value = res.records);
25
+        } catch(err) {
26
+          console.error(err)
27
+        }
27 28
 
28 29
         setUser({
29 30
           ...(user || {}),

+ 12
- 26
src/pages/loading/index.vue Zobrazit soubor

@@ -1,5 +1,5 @@
1 1
 <template>
2
-  <div class="page pg-bg loading-pg" @click="onClick" @touchmove="onClick">
2
+  <div class="page pg-bg loading-pg" @click.stop="onClick" @touchmove="onClick">
3 3
     <div class="header abs">
4 4
       <Bell />
5 5
     </div>
@@ -35,45 +35,31 @@
35 35
   import { computed, onMounted, ref } from 'vue';
36 36
   import Bell from '@/components/Bell.vue';
37 37
   import DownArrow from '@/components/DownArrow.vue';
38
-  import { preload } from '@/utils/preload'
38
+  import { preload } from '@/utils/preload';
39
+  import throttle from '@/utils/throttle';
39 40
 
40 41
   const emit = defineEmits(['ready']);
41
-  const finished = ref(false);
42 42
 
43 43
   const percent = ref(0);
44
+  const finished = ref(false);
44 45
 
45 46
   const onClick = () => {
46
-    if (percent.value !== '100%') return;
47
+    // if (!finished.value) return;
47 48
 
48
-    finished.value = true;
49
-    emit('ready');
50
-  }
51
-
52
-  const throttle = (fn, delay) => {
53
-    let t = null;
54
-    return (...args) => {
55
-      if (!t) {
56
-        fn(...args);
57
-        t = setTimeout(() => null, delay);
58
-        return;
59
-      } else {
60
-        clearTimeout(t);
61
-        t = setTimeout(() => fn(...args), delay);
62
-      }
63
-    }
49
+    // emit('ready');
64 50
   }
65 51
 
66 52
   const callback = (val) => {
53
+    console.log('------val----->', val)
67 54
     const p = Number(val * 100).toFixed(2);
68
-    if (p >= 100) {
69
-      return percent.value = '100%';
70
-    } else {
71
-      return percent.value = `${p}%`
72
-    }
55
+    percent.value = `${p}%`
73 56
   }
74 57
 
75 58
   onMounted(() => {
76
-    preload(throttle(callback, 10));
59
+    preload(throttle(callback, 100)).then(() => {
60
+      finished.value = true;
61
+      emit('ready');
62
+    });
77 63
   });
78 64
 </script>
79 65
 

+ 33
- 14
src/pages/pg1/InMap.vue Zobrazit soubor

@@ -4,14 +4,15 @@
4 4
     
5 5
     <template v-for="(item, inx) in flowers" :key="item.name">
6 6
       <div
7
-        class="flower"
8
-        :style="{left: item.left, top: item.top }"
7
+        class="flower animate__animated animate__fadeIn"
8
+        :style="{left: item.left, top: item.top, animationDelay: `${(inx+1) * 200}ms`}"
9 9
       >
10 10
         <div>
11 11
           <img
12
-            class="flower animate__animated animate__fadeIn animate__infinite"
13
-            :style="{animationDelay: `${(inx+1) * 200}ms`}"
12
+            class="flower"
13
+            :style="{}"
14 14
             src="/images/logo.png" alt="">
15
+          <!-- <img class="shine" src="/images/pg1/shine.png" alt=""> -->
15 16
           <div class="country" :style="getTxtStyle(item)">{{item.name}}</div>
16 17
         </div>
17 18
       </div>
@@ -25,20 +26,19 @@
25 26
   const flowers = ref([]);
26 27
 
27 28
   const getTxtStyle = (item) => {
28
-    const space = 16;
29 29
     switch (item.direct) {
30 30
       case 'top-left':
31
-        return { top: `-${space}px`, left: `-45px` };
31
+        return { top: `-16px`, left: `-45px` };
32 32
       case 'top-right':
33
-        return { top: `-${space}px`, right: `-45px` };
33
+        return { top: `-16px`, right: `-45px` };
34 34
       case 'right':
35
-        return { top: `-${space / 3}px`, right: `-85px`, textAlign: 'left' };
35
+        return { top: `-6px`, right: `-85px`, textAlign: 'left' };
36 36
       case 'left':
37 37
         return { top: `0px`, left: `-85px`, textAlign: 'right' };
38 38
       case 'top':
39
-        return { top: `-${space}px`, left: `-35px` };
39
+        return { top: `-16px`, left: `-35px` };
40 40
       default:
41
-        return { bottom: `-${space}px`, left: `-35px` };
41
+        return { bottom: `-22px`, left: `-35px` };
42 42
     }
43 43
   };
44 44
 
@@ -72,8 +72,6 @@
72 72
       }
73 73
     });
74 74
     
75
-console.log('------onLoad-----', list);
76
-
77 75
     flowers.value = list;
78 76
   }
79 77
 
@@ -84,10 +82,12 @@ console.log('------onLoad-----', list);
84 82
 .in-map-wrapper {
85 83
   position: relative;
86 84
 
85
+  @size: 8px;
86
+
87 87
   .flower {
88 88
     position: absolute;
89
-    width: 8px;
90
-    height: 8px;
89
+    width: @size;
90
+    height: @size;
91 91
     z-index: 2;
92 92
 
93 93
     & > div {
@@ -103,5 +103,24 @@ console.log('------onLoad-----', list);
103 103
       color: #C18FC8;
104 104
     }
105 105
   }
106
+
107
+  .shine {
108
+    position: absolute;
109
+    width: @size * 4;
110
+    height: @size * 4;
111
+    left: -@size * 2 + 4px;
112
+    top: -@size * 2 + 4px;
113
+
114
+    animation: shine-scale 1s ease-in-out alternate;
115
+  }
116
+
117
+  @keyframes shine-scale {
118
+    from {
119
+      transform: scale(1);
120
+    }
121
+    to {
122
+      transform: scale(1.2);
123
+    }
124
+  }
106 125
 }
107 126
 </style>

+ 3
- 3
src/pages/pg2-2/index.vue Zobrazit soubor

@@ -11,7 +11,7 @@
11 11
         :ready="true"
12 12
       >
13 13
         85年前,
14
-        <br />日本侵略者制造了惨绝人寰的南京大屠杀惨案, <br />30万同胞惨遭杀戮。
14
+        <br />日本侵略者制造了惨绝人寰的<br />南京大屠杀惨案, <br />30万同胞惨遭杀戮。
15 15
         <br />
16 16
       </Animate>
17 17
     </div>
@@ -126,12 +126,12 @@
126 126
             comp="span"
127 127
             class="animate__infinite"
128 128
             name="animate__headShake"
129
-            style="display: inline-block; font-size: 1.1em; font-family: sans serif; font-weight: 700;"
129
+            style="display: inline-block; width: 50vw; margin-top: 10px;"
130 130
             delay="300ms"
131 131
             :ready="show3"
132 132
             @click="onGoFoward"
133 133
           >
134
-            “紫金草行动”再启航。
134
+            <img src="/images/pg2-2/goAgain.png" alt="">
135 135
           </Animate>
136 136
         </p>
137 137
       </Animate>

+ 21
- 14
src/pages/pg4/Flower.vue Zobrazit soubor

@@ -1,10 +1,10 @@
1 1
 <template>
2 2
   <Modal v-if="show" :close="false">
3 3
     <div class="txt modal-flower">
4
-      <img class="close abs" src="/images/pg4/close.png" alt="" @click="onCancel">
4
+      <img class="close abs" src="/images/pg4/close.png" alt="" @click="emit('cancel')">
5 5
       <img class="open-flower" src="/images/pg4/flower-open.gif" alt="">
6
-      <p class="title">全球总种植数量: {{ user?.num }}</p>
7
-      <p class="planting" @click="animate">
6
+      <p class="title">{{countryData.name}}种植数量: {{ countryData.num }}</p>
7
+      <p class="planting" @click="onPlanting">
8 8
         <img src="/images/pg4/planting.png" alt="">
9 9
       </p>
10 10
     </div>
@@ -12,9 +12,12 @@
12 12
 </template>
13 13
 
14 14
 <script setup>
15
+  import { computed } from 'vue';
15 16
   import { useModel } from '@zjxpcyc/vue-tiny-store';
16 17
   import Modal from '@/components/Modal.vue';
17 18
   import track from '@/utils/track';
19
+  import { updateCountry as updateCountryAPI } from '@/services/country';
20
+  import throttle from '@/utils/throttle';
18 21
 
19 22
   const props = defineProps({
20 23
     country: String,
@@ -23,7 +26,12 @@
23 26
 
24 27
   const emit = defineEmits(['cancel', 'planted']);
25 28
 
26
-  const { user, updateContries } = useModel('user');
29
+  const { user, countries, updateCountries } = useModel('user');
30
+
31
+  const countryData = computed(() => {
32
+    const it = (countries.value || []).filter(x => x.name === props.country)[0];
33
+    return it || ({ name: props.country, num: 0 });
34
+  });
27 35
   
28 36
   const animate = (e) => {
29 37
     var n = 1;
@@ -55,19 +63,18 @@
55 63
       }
56 64
     );
57 65
     e.stopPropagation();
58
-
59
-    updateContries(props.country);
60
-    track();
61 66
   };
62 67
 
63
-  const onPlanting = () => {
64
-    //
65
-    // emit('planted');
66
-  }
68
+  const onPlanting = throttle((e) => {
69
+    animate(e);
67 70
 
68
-  const onCancel = () => {
69
-    emit('planted');
70
-  }
71
+    updateCountries(props.country);
72
+    updateCountryAPI(props.country);
73
+    track();
74
+    
75
+    // 可以无限种植
76
+    emit('planted', countryData.value);
77
+  }, 1000);
71 78
 
72 79
 </script>
73 80
 

+ 42
- 116
src/pages/pg4/Map.vue Zobrazit soubor

@@ -4,143 +4,69 @@
4 4
 </template>
5 5
 
6 6
 <script setup>
7
-  import { onMounted, ref, watch } from 'vue';
7
+  import { computed, onMounted, ref, watch } from 'vue';
8
+  import { useModel } from '@zjxpcyc/vue-tiny-store';
8 9
   import PageLoading from '@/components/PageLoading.vue';
9
-  import countryGPS from '@/utils/country_gps';
10
+  // import countryGPS from '@/utils/country_gps';
10 11
   import { getCountry } from '@/utils/maputil';
12
+  import throttle from '@/utils/throttle';
11 13
 
12 14
   const emit = defineEmits(['click']);
15
+  const { countries } = useModel('user');
13 16
 
14 17
   const el = ref();
15 18
   const mapRef = ref();
19
+  const markers = ref([]);
16 20
   const loading = ref(false);
17 21
 
18
-  // 展示部分国家
19
-  const mockCountries = [
20
-    '中国',
21
-    '芬兰',
22
-    '土耳其',
23
-    '德国',
24
-    '英国',
25
-    '瑞士',
26
-    '美国',
27
-    '加拿大',
28
-    '日本',
29
-    '韩国',
30
-    '马来西亚',
31
-    '澳大利亚',
32
-    '新西兰',
33
-    '新加坡',
34
-  ];
35
-
36 22
   // getGPSOfBDCountries();
37 23
 
38
-  onMounted(() => {
39
-    const map = new BMap.Map(el.value);
40
-    // const point = new BMap.Point(116.404, 39.915); // 天安门
41
-    const point = new BMap.Point(118.749731,32.04067);
42
-    map.centerAndZoom(point, 3);
43
-    mapRef.value = map;
44
-
45
-    // 绑定事件
46
-    map.addEventListener('click', (e) => {
47
-      // console.log('-----start-----')
48
-      // loading.value = true;
49
-      // const { point } = e;
50
-      // getCountry(point.lng, point.lat).then(x => {
51
-      //   emit('click', x);
52
-      //   loading.value = false;
53
-      // console.log('-----end-----')
54
-      // }).catch((err) => {
55
-      //   console.error(err);
56
-      //   loading.value = false;
57
-      // });
24
+  const onClick = throttle((point) => {
25
+    console.log('-----point-----', point)
26
+    loading.value = true;
27
+    getCountry(point.lng, point.lat).then(x => {
28
+      emit('click', x);
29
+      loading.value = false;
30
+    }).catch((err) => {
58 31
       emit('click', '中国');
32
+      console.error(err);
33
+      loading.value = false;
59 34
     });
35
+  }, 1000);
60 36
 
61
-    // 显示 marker
62
-    const icon = new BMap.Icon('./images/logo.png', new BMap.Size(16, 16));    
63
-    mockCountries.forEach(country => {
64
-        const target = countryGPS[country];
65
-        if (!target) {
66
-          console.error(`${country} 在世界GPS列表中不存在`)
67
-          return;
68
-        }
69
-        
70
-        const point = new BMap.Point(target[0], target[1]);
71
-        const marker = new BMap.Marker(point, { icon });
37
+  const icon = new BMap.Icon('./images/logo.png', new BMap.Size(16, 16));
38
+  
39
+  const renderCountry = (country) => {
40
+      // 没有数字与定位的跳过
41
+      if (!country.num || !country.loc) return;
72 42
 
73
-        //
74
-        marker.addEventListener('click', (e) => {
75
-          console.log('------marker----->', e)
76
-          emit('click', '中国');
77
-        });
43
+      // 已经绘制的跳过
44
+      const exist = markers.value.filter(x => x.id === country.name)[0];
45
+      if (exist) return;
78 46
 
79
-        map.addOverlay(marker);
80
-        // marker.setAnimation(BMAP_ANIMATION_BOUNCE);
47
+      const loc = country.loc.split(',');
48
+      const point = new BMap.Point(loc[0], loc[1]);
49
+      const marker = new BMap.Marker(point, { icon });
50
+      marker.addEventListener('click', (e) => onClick(e.target.point));
81 51
 
82
-        // map.getOverlays().forEach((overlay) => {
83
-        //   console.log('------overlay-------', overlay)
84
-        //   overlay.setAnimation(BMAP_ANIMATION_BOUNCE);
85
-        // });
86
-      });
52
+      mapRef.value.addOverlay(marker);
53
+      markers.value.push({id: country.name, marker});  
54
+  }
87 55
 
88
-    // window._AMapSecurityConfig = {
89
-    //   securityJsCode:'f33684b9573195f9f91a4c8bc779d7e2',
90
-    // }
91
-    // AMapLoader.load({
92
-    //   key: "378f2af0c01b00ec919ace1699f2466f",              // 申请好的Web端开发者Key,首次调用 load 时必填
93
-    //   version: "2.0",   // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
94
-    //   plugins: [],           // 需要使用的的插件列表,如比例尺'AMap.Scale'等
95
-    // }).then((AMap)=>{
96
-    //   const map = new AMap.Map(el.value, {
97
-    //     mapStyle: 'amap://styles/bff59c60c62af794ee93f1befde78625',
98
-    //     zoom: 3,
99
-    //   });
56
+  defineExpose({ renderCountry, map: mapRef });
100 57
 
101
-    //   const countries = Object.keys(countryGPS);
102
-    //   countries.forEach((country) => {
103
-    //     const position = countryGPS[country];
104
-    //     const found = mockCountries.filter(x => x===country)[0];
105
-
106
-    //     console.log('----position---->', position);
107
-        
108
-    //     const marker = new AMap.Marker({
109
-    //       map,
110
-    //       offset:[-100, -16],
111
-    //       content: `
112
-    //         <div class="map-marker-box">
113
-    //           <div class="map-marker-title">${country}</div>
114
-    //           ${found ? '<div class="map-marker-icon"/>' : ''}
115
-    //         </div>
116
-    //       `,
117
-    //       position,
118
-    //     });
119
-      // });
58
+  onMounted(() => {
59
+    const map = new BMap.Map(el.value);
60
+    // const point = new BMap.Point(116.404, 39.915); // 天安门
61
+    const point = new BMap.Point(118.749731,32.04067);
62
+    map.centerAndZoom(point, 3);
63
+    mapRef.value = map;
120 64
 
121
-      // mockCountries.forEach(country => {
122
-      //   const target = countryGPS[country];
123
-      //   if (!target) {
124
-      //     console.error(`${country} 在世界GPS列表中不存在`)
125
-      //     return;
126
-      //   }
127
-        
128
-      //   const marker = new AMap.Marker({
129
-      //     map,
130
-      //     offset:[-100, -16],
131
-      //     content: `
132
-      //       <div class="map-marker-box">
133
-      //         <div class="map-marker-title">${country}</div>
134
-      //         <div class="map-marker-icon"/>
135
-      //       </div>
136
-      //     `,
137
-      //     position: target,
138
-      //   });
139
-      // });
65
+    // 绑定事件
66
+    map.addEventListener('click', (e) => onClick(e.point));
140 67
 
141
-    // }).catch(e => {
142
-    //   console.error(e);
143
-    // })
68
+    // 显示 marker
69
+    countries.value.forEach(renderCountry);
144 70
   });
145 71
 
146 72
 </script>

+ 2
- 1
src/pages/pg4/Rule.vue Zobrazit soubor

@@ -4,7 +4,7 @@
4 4
       <h3>参与规则</h3>
5 5
       <ul>
6 6
         <li>选择要播撒的种子,并进行播种。</li>
7
-        <li>种植完成后,分享海报至“南京广播电视台”微信公众号领取实体徽章一枚。</li>
7
+        <li>种植完成后,分享证书至“南京广播电视台”微信公众号领取实体徽章一枚。</li>
8 8
       </ul>
9 9
     </div>
10 10
   </Modal>
@@ -17,6 +17,7 @@
17 17
   const show = ref(true);
18 18
 
19 19
   const onCancel = () => {
20
+    console.log('----------')
20 21
     show.value = false;
21 22
   }
22 23
 </script>

+ 7
- 15
src/pages/pg4/index.vue Zobrazit soubor

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
   <div class="page pg-bg pg4">
3
-    <Map @click="onMapClick" />
3
+    <Map @click="onMapClick" ref="mapRef" />
4 4
     <Rule />
5 5
     <Flower
6 6
       :show="flowerShow"
@@ -33,33 +33,25 @@
33 33
   const planted = ref(false);
34 34
   const badgeShow = ref(false);
35 35
   const el = ref();
36
+  const mapRef = ref();
36 37
 
37 38
   const onMapClick = (country) => {
38 39
     countryRef.value = country;
39 40
     flowerShow.value = true;
40 41
   }
41 42
 
42
-  const onPlanted = () => {
43
+  const onPlanted = (country) => {
43 44
     planted.value = true;
44
-    flowerShow.value = false;
45
+
46
+    if (mapRef.value) {
47
+      mapRef.value.renderCountry(country);
48
+    }
45 49
   }
46 50
 
47 51
   const onShare = () => {
48 52
     router.push('/share')
49 53
   }
50 54
 
51
-  onMounted(() => {
52
-    const t = setTimeout(() => {
53
-      // 中国显示正中间
54
-      el.value.scroll(300, 0);
55
-      clearTimeout(t);
56
-    }, 500);
57
-
58
-    // 绘制紫金草
59
-
60
-
61
-  })
62
-
63 55
 </script>
64 56
 
65 57
 <style lang="less">

+ 2
- 2
src/pages/pg4/plant.vue Zobrazit soubor

@@ -48,7 +48,7 @@ import Share from "./Share.vue";
48 48
 import Badge from "./Badge.vue";
49 49
 import Rule from "./Rule.vue";
50 50
 
51
-const { user, contries, updateContries } = useModel("user");
51
+const { user, contries, updateCountries } = useModel("user");
52 52
 
53 53
 const router = useRouter();
54 54
 const choise = ref([]);
@@ -101,7 +101,7 @@ const onShare = () => {
101 101
 };
102 102
 const click = (item, e) => {
103 103
   const arr = choise.value;
104
-  updateContries(item.name);
104
+  updateCountries(item.name);
105 105
   animate(1, e);
106 106
   choise.value = [...new Set(arr.concat([item.name]))];
107 107
 };

+ 36
- 27
src/pages/pg4/video.vue Zobrazit soubor

@@ -1,23 +1,29 @@
1 1
 <template>
2 2
   <div class="page pg-bg video-pg">
3 3
     <div class="content">
4
-      <video
5
-        webkit-playsinline
6
-        playsinline
7
-        src="/video/和平宣言.mp4"
8
-        preload="preload"
9
-        autoplay="autoplay"
10
-        :controls="controls"
11
-        poster="/images/pg4/vid-poster.png"
12
-        ref="mediaRef"
13
-        @ended="show = true"
14
-        @play="pause()"
15
-        @pause="play()"
16
-      ></video>
17
-      <div class="play-action animate__animated animate__fadeIn">
18
-        <img src="/images/pg4/重播.png" @click="onReplay" alt="" />
19
-        <img src="/images/pg4/播撒种子.png" @click="onNext" alt="" />
4
+      <div class="title">
5
+        <div class="txt">六写《和平宣言》</div>
6
+        <div class="txt" style="font-size: 0.9em">
7
+          冯亦同用心用情用音向世界发出和平之声
8
+        </div>
20 9
       </div>
10
+      <video
11
+          webkit-playsinline
12
+          playsinline
13
+          src="/video/和平宣言.mp4"
14
+          preload="preload"
15
+          autoplay="autoplay"
16
+          :controls="controls"
17
+          poster="/images/pg4/vid-poster.png"
18
+          ref="mediaRef"
19
+          @ended="show = true"
20
+          @play="pause()"
21
+          @pause="play()"
22
+        ></video>
23
+        <div class="play-action animate__animated animate__fadeIn">
24
+          <img src="/images/pg4/重播.png" @click="onReplay" alt="" />
25
+          <img src="/images/pg4/播撒种子.png" @click="onNext" alt="" />
26
+        </div>
21 27
     </div>
22 28
   </div>
23 29
 </template>
@@ -31,7 +37,7 @@
31 37
   const router = useRouter();
32 38
   const route = useRoute();
33 39
   const mediaRef = ref();
34
-  const show = ref(false);
40
+  const show = ref(true);
35 41
   const controls = ref();
36 42
 
37 43
   const onReplay = () => {
@@ -82,19 +88,24 @@
82 88
   background-size: 100% 100%;
83 89
   display: flex;
84 90
   align-items: center;
91
+  justify-content: center;
92
+
85 93
   .content {
86 94
     position: relative;
95
+
96
+    .title {
97
+      text-align: center;
98
+      margin-bottom: 24px;
99
+    }
100
+
87 101
     video {
88 102
       // width: 100%;
89 103
       width: 100vw;
90 104
       z-index: 1;
91 105
     }
92 106
     .play-action {
93
-      position: absolute;
94
-      z-index: 2;
95
-      bottom: -80px;
96 107
       width: 100%;
97
-      height: 80px;
108
+      margin-top: 24px;
98 109
       display: flex;
99 110
       align-items: center;
100 111
       justify-content: center;
@@ -103,12 +114,10 @@
103 114
         width: 100px;
104 115
         width: 30vw;
105 116
         height: 10vw;
106
-      }
107
-      img:first-child {
108
-        margin-right: 20px;
109
-      }
110
-      img:last-child {
111
-        margin-left: 20px;
117
+
118
+        & + img {
119
+          margin-left: 40px;
120
+        }
112 121
       }
113 122
     }
114 123
   }

+ 5
- 0
src/services/country.js Zobrazit soubor

@@ -0,0 +1,5 @@
1
+import request from '@/utils/request';
2
+
3
+export const getCountryData = () => request('/api/wx/taCountry?pageSize=300');
4
+
5
+export const updateCountry = name => request.put('/api/wx/taCountry', { name });

+ 4
- 0
src/services/track.js Zobrazit soubor

@@ -0,0 +1,4 @@
1
+import request from '@/utils/request';
2
+
3
+export const saveTrack = data => request.post('/api/wx/taTrack', data);
4
+

+ 11
- 20
src/store/index.js Zobrazit soubor

@@ -38,25 +38,16 @@ const useUser = () => {
38 38
 
39 39
   const setUser = v => user.value = v;
40 40
 
41
-  const contries = reactive({
42
-    "中国": 0,
43
-    "芬兰": 0,
44
-    "土耳其": 0,
45
-    "德国": 0,
46
-    "英国": 0,
47
-    "瑞士": 0,
48
-    "美国": 0,
49
-    "加拿大": 0,
50
-    "日本": 0,
51
-    "韩国": 0,
52
-    "马来西亚": 0,
53
-    "澳大利亚": 0,
54
-    "新西兰": 0,
55
-    "新加坡": 0,
56
-  });
41
+  const countries = ref([]);
42
+
43
+  const updateCountries = (key) => {
44
+    const country = countries.value.filter(x => x.name === key)[0] || { name: key, num: 0 };
45
+    country.num += 1;
46
+
47
+    if (!country.id) {
48
+      countries.value = [...countries.value].concat(country)
49
+    }
57 50
 
58
-  const updateContries = (key) => {
59
-    contries[key] += 1;
60 51
     if (user.value) {
61 52
       user.value.num += 1;
62 53
     }
@@ -65,8 +56,8 @@ const useUser = () => {
65 56
   return {
66 57
     user,
67 58
     setUser,
68
-    contries,
69
-    updateContries,
59
+    countries,
60
+    updateCountries,
70 61
   }
71 62
 }
72 63
 

+ 0
- 13
src/utils/country_gps.js Zobrazit soubor

@@ -15,7 +15,6 @@ export default {
15 15
   "阿塞拜疆": [47.53841, 40.371428],
16 16
   "巴哈马": [-77.394555, 25.009396],
17 17
   "日本": [139.828928,37.721421],
18
-
19 18
   "孟加拉国": [89.93617, 23.754802],
20 19
   "巴巴多斯": [-59.5317, 13.093871],
21 20
   "白俄罗斯": [27.434815, 53.225932],
@@ -40,7 +39,6 @@ export default {
40 39
   "中非共和国": [18.810124, 6.041238],
41 40
   "乍得": [18.447049, 14.768537],
42 41
   "智利": [-69.977876, -25.138942],
43
-  // "中国": [116.416833, 39.948327],
44 42
   "中国": [118.749731,32.04067],
45 43
   "哥伦比亚": [-73.478806, 2.776096],
46 44
   "科摩罗": [43.375844, -11.78857],
@@ -65,7 +63,6 @@ export default {
65 63
   "厄立特里亚": [37.648078, 15.784249],
66 64
   "爱沙尼亚": [25.476342, 58.478596],
67 65
   "埃塞俄比亚": [38.786169, 7.794486],
68
-
69 66
   "法罗群岛": [-6.797398, 61.97106],
70 67
   "斐济": [177.672622, -17.921157],
71 68
   "芬兰": [25.674431, 67.904553],
@@ -81,12 +78,10 @@ export default {
81 78
   "格陵兰": [-42.715567, 76.109625],
82 79
   "瓜德罗普岛": [-61.44, 16.00],
83 80
   "危地马拉": [-91.102574, 14.574812],
84
-
85 81
   "几内亚": [-9.920862, 9.507233],
86 82
   "几内亚比绍": [-15.258858, 11.72377],
87 83
   "圭亚那": [-58.825875, 2.121864],
88 84
   "海地": [-72.463939, 19.188571],
89
-
90 85
   "洪都拉斯": [-85.755474, 15.090622],
91 86
   "匈牙利": [19.131732, 46.477001],
92 87
   "冰岛": [-18.347671, 64.920607],
@@ -95,7 +90,6 @@ export default {
95 90
   "伊朗": [53.25111, 31.557465],
96 91
   "伊拉克": [42.709565, 32.494493],
97 92
   "爱尔兰": [-8.873846, 52.611764],
98
-
99 93
   "意大利": [12.380236, 42.789341],
100 94
   "牙买加": [-77.705921, 17.998272],
101 95
   "约旦": [35.688762, 30.054147],
@@ -122,7 +116,6 @@ export default {
122 116
   "马提尼克岛": [-60.962083, 14.601499],
123 117
   "毛里塔尼亚": [-11.585315, 20.304108],
124 118
   "新加坡": [103.861805,1.310129],
125
-
126 119
   "墨西哥": [-104.700828, 25.155423],
127 120
   "密克罗尼西亚(联邦) ": [158.202146, 6.84037],
128 121
   "摩尔多瓦共和国": [28.222509, 47.201738],
@@ -156,10 +149,7 @@ export default {
156 149
   "罗马尼亚": [24.554627,44.822581],
157 150
   "俄罗斯": [105.125642,60.284459],
158 151
   "卢旺达": [29.708849,-2.571033],
159
- 
160
-
161 152
   "圣皮埃尔和密克隆": [-56.193589,46.421843],
162
-  
163 153
   "萨摩亚": [-172.015124,-14.183153],
164 154
   "圣马力诺": [12.318397,43.536617],
165 155
   "圣多美和普林西比": [6.546377,-0.094488],
@@ -177,16 +167,13 @@ export default {
177 167
   "斯威士兰": [31.522017,-27.033699],
178 168
   "瑞典": [16.583656,63.159047],
179 169
   "瑞士": [7.88977,46.727455],
180
- 
181 170
   "塔吉克斯坦": [71.165934,38.539916],
182 171
   "泰国": [100.988803,16.062762],
183 172
   "马其顿": [21.609549,41.361815],
184
-
185 173
   "汤加": [-175.145232,-21.255308],
186 174
   "突尼斯": [10.192788,36.551971],
187 175
   "土耳其": [34.821265,39.413194],
188 176
   "土库曼斯坦": [54.593227,39.369869],
189
-
190 177
   "乌干达": [32.238125,0.172108],
191 178
   "乌克兰": [31.243127,48.468653],
192 179
   "阿联酋": [54.004622,23.088022],

+ 1
- 0
src/utils/preload.js Zobrazit soubor

@@ -23,6 +23,7 @@ export function preload(onProgress) {
23 23
 
24 24
     const callback = (e, isError) => {
25 25
       cursor += 1;
26
+      console.log('-----loading------>', cursor / total);
26 27
       onProgress(cursor / total);
27 28
       if (cursor >= total) {
28 29
         resolve(resources)

+ 2
- 2
src/utils/resources.js Zobrazit soubor

@@ -38,7 +38,7 @@ export const resources = [
38 38
   { image: './images/pg1/light-2.png' },
39 39
   { image: './images/pg1/light.png' },
40 40
   { image: './images/pg1/logo.png' },
41
-  { image: './images/pg1/md1-1.jpg' },
41
+  { image: './images/pg1/md1-1.png' },
42 42
   { image: './images/pg1/md2-header.png' },
43 43
   { image: './images/pg1/peace.png' },
44 44
 
@@ -71,7 +71,7 @@ export const resources = [
71 71
   { image: './images/pg3/btn.png' },
72 72
   { image: './images/pg3/jing.png' },
73 73
   { image: './images/pg3/left-bg.png' },
74
-  { image: './images/pg3/map.gif' },
74
+  // { image: './images/pg3/map.gif' },
75 75
   { image: './images/pg3/nan.png' },
76 76
   { image: './images/pg3/right-bg.png' },
77 77
   { image: './images/pg3/stele.png' },

+ 14
- 0
src/utils/throttle.js Zobrazit soubor

@@ -0,0 +1,14 @@
1
+
2
+export default (fn, delay) => {
3
+  let t = null;
4
+  return (...args) => {
5
+    if (t) return;
6
+
7
+    t = setTimeout(() => {
8
+      clearTimeout(t);
9
+      t = null;
10
+    }, delay);
11
+
12
+    return fn(...args);
13
+  }
14
+}

+ 2
- 2
src/utils/track.js Zobrazit soubor

@@ -1,4 +1,4 @@
1
-import request from './request'
1
+import { saveTrack } from "@/services/track";
2 2
 
3 3
 export default function(code) {
4 4
   const data = {
@@ -7,5 +7,5 @@ export default function(code) {
7 7
     ua: window.navigator.userAgent,
8 8
   }
9 9
 
10
-  return request.post('/api/wx/taTrack', data);
10
+  return saveTrack(data);
11 11
 }