Yansen 2 years ago
parent
commit
ea6543f2e2
5 changed files with 48 additions and 24 deletions
  1. 1
    1
      src/pages/pg4/Flower.vue
  2. 22
    13
      src/pages/pg4/Map.vue
  3. 10
    3
      src/pages/pg4/video.vue
  4. 13
    6
      src/pages/share/index.vue
  5. 2
    1
      src/utils/country_gps.js

+ 1
- 1
src/pages/pg4/Flower.vue View File

@@ -3,7 +3,7 @@
3 3
     <div class="txt modal-flower">
4 4
       <img class="close abs" src="/images/pg4/close.png" alt="" @click="onCancel">
5 5
       <img class="open-flower" src="/images/pg4/flower-open.gif" alt="">
6
-      <p class="title">{{country}}, 全球总种植数量: {{ user?.num }}</p>
6
+      <p class="title">全球总种植数量: {{ user?.num }}</p>
7 7
       <p class="planting" @click="animate">
8 8
         <img src="/images/pg4/planting.png" alt="">
9 9
       </p>

+ 22
- 13
src/pages/pg4/Map.vue View File

@@ -37,23 +37,25 @@
37 37
 
38 38
   onMounted(() => {
39 39
     const map = new BMap.Map(el.value);
40
-    const point = new BMap.Point(116.404, 39.915); // 天安门
40
+    // const point = new BMap.Point(116.404, 39.915); // 天安门
41
+    const point = new BMap.Point(118.749731,32.04067);
41 42
     map.centerAndZoom(point, 3);
42 43
     mapRef.value = map;
43 44
 
44 45
     // 绑定事件
45 46
     map.addEventListener('click', (e) => {
46
-      console.log('-----start-----')
47
-      loading.value = true;
48
-      const { point } = e;
49
-      getCountry(point.lng, point.lat).then(x => {
50
-        emit('click', x);
51
-        loading.value = false;
52
-      console.log('-----end-----')
53
-      }).catch((err) => {
54
-        console.error(err);
55
-        loading.value = false;
56
-      });
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
+      // });
58
+      emit('click', '中国');
57 59
     });
58 60
 
59 61
     // 显示 marker
@@ -67,8 +69,15 @@
67 69
         
68 70
         const point = new BMap.Point(target[0], target[1]);
69 71
         const marker = new BMap.Marker(point, { icon });
72
+
73
+        //
74
+        marker.addEventListener('click', (e) => {
75
+          console.log('------marker----->', e)
76
+          emit('click', '中国');
77
+        });
78
+
70 79
         map.addOverlay(marker);
71
-        marker.setAnimation(BMAP_ANIMATION_BOUNCE);
80
+        // marker.setAnimation(BMAP_ANIMATION_BOUNCE);
72 81
 
73 82
         // map.getOverlays().forEach((overlay) => {
74 83
         //   console.log('------overlay-------', overlay)

+ 10
- 3
src/pages/pg4/video.vue View File

@@ -37,9 +37,16 @@
37 37
   const { query } = route;
38 38
   const { from } = query;
39 39
 
40
-  // if (from) {
41
-  //   window.location.href = decodeURIComponent(from);
42
-  // }
40
+  if (from) {
41
+    // window.location.href = decodeURIComponent(from);
42
+    // const link = document.createElement('a');
43
+    // link.target = "_blank";
44
+    // link.href = from;
45
+    // link.click();
46
+    // history.pushState('', '', from);
47
+    alert(123)
48
+    router.push(from);
49
+  }
43 50
 
44 51
   const onReplay = () => {
45 52
     mediaRef.value.play();

+ 13
- 6
src/pages/share/index.vue View File

@@ -30,17 +30,22 @@ const src = ref();
30 30
 
31 31
 
32 32
 onMounted(() => {
33
-  setTimeout(()=>{
33
+  const t = setTimeout(()=>{
34 34
     html2canvas(src.value).then((canvas) => {
35
-    imgData.value = canvas.toDataURL("image/jpg", 0.8);
36
-  });
37
-  },1000)
35
+      imgData.value = canvas.toDataURL("image/jpg", 0.8);
36
+    });
37
+
38
+    clearTimeout(t);
39
+  }, 200);
38 40
 });
39 41
 </script>
40 42
 
41 43
 <style lang="less" scoped>
42 44
 .share-pg {
43 45
   position: relative;
46
+  overflow: hidden;
47
+  height: 100%;
48
+
44 49
   .goback{
45 50
     z-index: 100;
46 51
     left: 10px;
@@ -48,10 +53,12 @@ onMounted(() => {
48 53
   }
49 54
 
50 55
   .will-copy {
51
-    position: relative;
56
+    position: absolute;
52 57
     z-index: 1;
53 58
     width: 100vw;
54 59
     height: 100vh;
60
+    left: -200vw;
61
+    top: 0;
55 62
 
56 63
     .copy-img {
57 64
       width: 100%;
@@ -74,7 +81,7 @@ onMounted(() => {
74 81
 
75 82
   .img-target {
76 83
     position: absolute;
77
-    z-index: 2;
84
+    z-index: 20;
78 85
     width: 100vw;
79 86
     height: 100vh;
80 87
     top: 0;

+ 2
- 1
src/utils/country_gps.js View File

@@ -40,7 +40,8 @@ export default {
40 40
   "中非共和国": [18.810124, 6.041238],
41 41
   "乍得": [18.447049, 14.768537],
42 42
   "智利": [-69.977876, -25.138942],
43
-  "中国": [116.416833, 39.948327],
43
+  // "中国": [116.416833, 39.948327],
44
+  "中国": [118.749731,32.04067],
44 45
   "哥伦比亚": [-73.478806, 2.776096],
45 46
   "科摩罗": [43.375844, -11.78857],
46 47
   "刚果": [21.743027,-2.573788],