Showing
2 changed files
with
34 additions
and
7 deletions
| ... | @@ -11,7 +11,6 @@ declare module '@vue/runtime-core' { | ... | @@ -11,7 +11,6 @@ declare module '@vue/runtime-core' { |
| 11 | export interface GlobalComponents { | 11 | export interface GlobalComponents { |
| 12 | AudioBackground: typeof import('./src/components/audioBackground.vue')['default'] | 12 | AudioBackground: typeof import('./src/components/audioBackground.vue')['default'] |
| 13 | AudioBackground1: typeof import('./src/components/audioBackground1.vue')['default'] | 13 | AudioBackground1: typeof import('./src/components/audioBackground1.vue')['default'] |
| 14 | - copy: typeof import('./src/components/audioBackground copy.vue')['default'] | ||
| 15 | Floor: typeof import('./src/components/Floor/index.vue')['default'] | 14 | Floor: typeof import('./src/components/Floor/index.vue')['default'] |
| 16 | InfoPopup: typeof import('./src/components/InfoPopup.vue')['default'] | 15 | InfoPopup: typeof import('./src/components/InfoPopup.vue')['default'] |
| 17 | InfoPopupLite: typeof import('./src/components/InfoPopupLite.vue')['default'] | 16 | InfoPopupLite: typeof import('./src/components/InfoPopupLite.vue')['default'] | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2023-05-19 14:54:27 | 2 | * @Date: 2023-05-19 14:54:27 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-09-21 11:01:31 | 4 | + * @LastEditTime: 2024-09-21 12:03:00 |
| 5 | * @FilePath: /map-demo/src/views/bieyuan/map.vue | 5 | * @FilePath: /map-demo/src/views/bieyuan/map.vue |
| 6 | * @Description: 公众地图主体页面 | 6 | * @Description: 公众地图主体页面 |
| 7 | --> | 7 | --> |
| ... | @@ -59,6 +59,19 @@ | ... | @@ -59,6 +59,19 @@ |
| 59 | 59 | ||
| 60 | <!-- 背景音乐控制 --> | 60 | <!-- 背景音乐控制 --> |
| 61 | <!-- <audioBackground1></audioBackground1> --> | 61 | <!-- <audioBackground1></audioBackground1> --> |
| 62 | + | ||
| 63 | + <div class="operate-bar-wrapper"> | ||
| 64 | + <div class="box-wrapper"> | ||
| 65 | + <div v-if="open_current_location" class="item" @click="handleLocation(true)"> | ||
| 66 | + <van-icon name="https://cdn.ipadbiz.cn/xys/map/%E5%AE%9A%E4%BD%8Dloc@2x.png" size="1.5rem" | ||
| 67 | + style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);;" /> | ||
| 68 | + </div> | ||
| 69 | + <div v-else class="item" @click="handleLocation(false)"> | ||
| 70 | + <van-icon name="https://cdn.ipadbiz.cn/xys/map/%E5%AE%9A%E4%BD%8Dloc@2x.png" size="1.5rem" | ||
| 71 | + style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);" /> | ||
| 72 | + </div> | ||
| 73 | + </div> | ||
| 74 | + </div> | ||
| 62 | </div> | 75 | </div> |
| 63 | </template> | 76 | </template> |
| 64 | 77 | ||
| ... | @@ -203,6 +216,7 @@ export default { | ... | @@ -203,6 +216,7 @@ export default { |
| 203 | current_safe_route: [], | 216 | current_safe_route: [], |
| 204 | route_safe_marker: [], | 217 | route_safe_marker: [], |
| 205 | show_walk_route: true, | 218 | show_walk_route: true, |
| 219 | + open_current_location: true, | ||
| 206 | } | 220 | } |
| 207 | }, | 221 | }, |
| 208 | async mounted() { | 222 | async mounted() { |
| ... | @@ -373,10 +387,10 @@ export default { | ... | @@ -373,10 +387,10 @@ export default { |
| 373 | }); | 387 | }); |
| 374 | this.map.add(this.markerSum); | 388 | this.map.add(this.markerSum); |
| 375 | // | 389 | // |
| 376 | - setTimeout(() => { | 390 | + // setTimeout(() => { |
| 377 | - // 获取定位打标记 | 391 | + // // 获取定位打标记 |
| 378 | - this.setLocation(); | 392 | + // this.setLocation(); |
| 379 | - }, 1000); | 393 | + // }, 1000); |
| 380 | }, | 394 | }, |
| 381 | isPointInRing() { // 是否在景区范围 | 395 | isPointInRing() { // 是否在景区范围 |
| 382 | let isPointInRing = AMap.GeometryUtil.isPointInRing([this.current_lng, this.current_lat], [ | 396 | let isPointInRing = AMap.GeometryUtil.isPointInRing([this.current_lng, this.current_lat], [ |
| ... | @@ -763,7 +777,21 @@ export default { | ... | @@ -763,7 +777,21 @@ export default { |
| 763 | console.warn(marker_id); | 777 | console.warn(marker_id); |
| 764 | // 模拟新增路线 | 778 | // 模拟新增路线 |
| 765 | this.addSafeRoute(this.data_path_list[0]); | 779 | this.addSafeRoute(this.data_path_list[0]); |
| 766 | - } | 780 | + }, |
| 781 | + handleLocation(status) { // 打开/关闭 当前定位 | ||
| 782 | + if (status) { | ||
| 783 | + this.setLocation() | ||
| 784 | + this.open_current_location = false; | ||
| 785 | + } else { | ||
| 786 | + this.removeLocation() | ||
| 787 | + this.open_current_location = true; | ||
| 788 | + } | ||
| 789 | + }, | ||
| 790 | + removeLocation() { // 移除定位标记 | ||
| 791 | + this.current_lng = ''; | ||
| 792 | + this.current_lat = ''; | ||
| 793 | + this.map.remove(this.location_marker); // 删除当前定位标记 | ||
| 794 | + }, | ||
| 767 | } | 795 | } |
| 768 | } | 796 | } |
| 769 | </script> | 797 | </script> | ... | ... |
-
Please register or login to post a comment