Yansen 2 years ago
parent
commit
cda89ee0cf

BIN
public/map/bottom.png View File


BIN
public/map/left.png View File


BIN
public/map/map.png View File


BIN
public/map/right.png View File


BIN
public/map/top.png View File


+ 60
- 4
src/components/CustMap.vue View File

19
         <AudioVue :audio="scenicSpots.audio" ref="audioRef" @play="playing = true" @stop="playing = false" />
19
         <AudioVue :audio="scenicSpots.audio" ref="audioRef" @play="playing = true" @stop="playing = false" />
20
       </div>
20
       </div>
21
     </div>
21
     </div>
22
+    <img class="map-border border-top" src="map/top.png" alt="" @load="onBorderTopLoad">
23
+    <img class="map-border border-bottom" src="map/bottom.png" alt=""  @load="onBorderBottomLoad">
24
+    <img class="map-border border-left" src="map/left.png" alt="" :style="borderLRStyle">
25
+    <img class="map-border border-right" src="map/right.png" alt="" :style="borderLRStyle">
22
   </div>
26
   </div>
23
 </template>
27
 </template>
24
 
28
 
28
   import { useModel } from "@zjxpcyc/vue-tiny-store";
32
   import { useModel } from "@zjxpcyc/vue-tiny-store";
29
   import { newMarker } from '@/utils/amap';
33
   import { newMarker } from '@/utils/amap';
30
   import { resources } from '@/utils/resources';
34
   import { resources } from '@/utils/resources';
31
-import wxsdk from "../utils/wx";
35
+  import wxsdk from "../utils/wx";
32
 
36
 
33
   const props = defineProps({
37
   const props = defineProps({
34
     image: {
38
     image: {
51
   const scenicSpots = ref({});
55
   const scenicSpots = ref({});
52
   const audioRef = ref();
56
   const audioRef = ref();
53
   const playing = ref(false);
57
   const playing = ref(false);
58
+  const borderTopSize = ref();
59
+  const borderBottomSize = ref();
54
 
60
 
55
   const isReady = computed(() => imgRef.value && mapIsReady.value);
61
   const isReady = computed(() => imgRef.value && mapIsReady.value);
62
+  const borderLRStyle = computed(() => {
63
+    if (borderTopSize.value && borderBottomSize.value) {
64
+      return {
65
+        top: `${borderTopSize.value.height}px`,
66
+        height: `calc(100% - ${borderTopSize.value.height + borderBottomSize.value.height}px)`,
67
+      }
68
+    } else {
69
+      return {};
70
+    }
71
+  });
56
 
72
 
57
   watch(() => isReady.value, (nw, od) => {
73
   watch(() => isReady.value, (nw, od) => {
58
     if (nw && !od) {
74
     if (nw && !od) {
59
       mapInit();
75
       mapInit();
60
     }
76
     }
61
   });
77
   });
78
+
79
+  document.body.addEventListener('click', () => {
80
+    if (audioRef.value) {
81
+      audioRef.value.toggle();
82
+      show.value = false;
83
+    }
84
+  });
62
   
85
   
63
   const onLoad = e => (imgRef.value = e.target);
86
   const onLoad = e => (imgRef.value = e.target);
64
   const onClickAudio = () => audioRef.value.toggle();
87
   const onClickAudio = () => audioRef.value.toggle();
75
     }
98
     }
76
   }
99
   }
77
 
100
 
101
+  const onBorderTopLoad = (e) => {
102
+    const { width, height } = e.target;
103
+    borderTopSize.value = { width, height };
104
+  }
105
+  const onBorderBottomLoad = (e) => {
106
+    const { width, height } = e.target;
107
+    borderBottomSize.value = { width, height };
108
+  }
109
+
78
   const onMapClick = (e) => {
110
   const onMapClick = (e) => {
79
     const { lnglat } = e;
111
     const { lnglat } = e;
80
 
112
 
129
       bounds,
161
       bounds,
130
       zooms,
162
       zooms,
131
     });
163
     });
132
-    map.setLayers([imageLayer])
164
+    map.setLayers([imageLayer]);
133
 
165
 
134
     // 背景层
166
     // 背景层
135
     const backCovers = [
167
     const backCovers = [
150
     const polygon = new AMap.Polygon({
182
     const polygon = new AMap.Polygon({
151
         pathL: backCovers,
183
         pathL: backCovers,
152
         strokeWeight: 0,
184
         strokeWeight: 0,
153
-        fillColor: '#E2E3D6',
154
-        fillOpacity: 0.5
185
+        fillColor: '#FBF8EF',
186
+        fillOpacity: 1,
155
     });
187
     });
156
     polygon.setPath(backCovers);
188
     polygon.setPath(backCovers);
157
     map.add(polygon);
189
     map.add(polygon);
214
       // padding: 1em;
246
       // padding: 1em;
215
       border: 1em solid #fff;
247
       border: 1em solid #fff;
216
       border-radius: 8px;
248
       border-radius: 8px;
249
+      box-shadow:2px 2px 3px #aaaaaa;
217
       box-sizing: border-box;
250
       box-sizing: border-box;
218
       background: #fff;
251
       background: #fff;
219
       overflow-y: auto;
252
       overflow-y: auto;
249
       }
282
       }
250
     }
283
     }
251
   }
284
   }
285
+
286
+  .map-border {
287
+    display: block;
288
+    position: absolute;
289
+    z-index: 20;
290
+  }
291
+  
292
+  .border-top {
293
+    width: 100%;
294
+    left: 0;
295
+    top: 0;
296
+  }
297
+  .border-bottom {
298
+    width: 100%;
299
+    left: 0;
300
+    bottom: 0;
301
+  }  
302
+  .border-left {
303
+    left: 0;
304
+  }
305
+  .border-right {
306
+    right: 0;
307
+  }
252
 }
308
 }
253
 
309
 
254
 </style>
310
 </style>

+ 16
- 0
src/utils/resources.js View File

16
       key: AMAP_KEY,
16
       key: AMAP_KEY,
17
     },
17
     },
18
   },
18
   },
19
+  {
20
+    image: './map/top.png',
21
+    hidden: true,
22
+  },
23
+  {
24
+    image: './map/bottom.png',
25
+    hidden: true,
26
+  },
27
+  {
28
+    image: './map/left.png',
29
+    hidden: true,
30
+  },
31
+  {
32
+    image: './map/right.png',
33
+    hidden: true,
34
+  },
19
   {
35
   {
20
     name: '文德桥',
36
     name: '文德桥',
21
     showGesture: true,
37
     showGesture: true,