Showing
1 changed file
with
11 additions
and
29 deletions
| 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-19 14:12:11 | 4 | + * @LastEditTime: 2024-09-19 15:36:09 |
| 5 | * @FilePath: /map-demo/src/views/bieyuan/map.vue | 5 | * @FilePath: /map-demo/src/views/bieyuan/map.vue |
| 6 | * @Description: 公众地图主体页面 | 6 | * @Description: 公众地图主体页面 |
| 7 | --> | 7 | --> |
| ... | @@ -52,6 +52,10 @@ | ... | @@ -52,6 +52,10 @@ |
| 52 | <div v-if="!show_walk_route" @click="removeSafeRoute('test')" class="walk-nav-text"> | 52 | <div v-if="!show_walk_route" @click="removeSafeRoute('test')" class="walk-nav-text"> |
| 53 | 关闭步行导航 | 53 | 关闭步行导航 |
| 54 | </div> | 54 | </div> |
| 55 | + | ||
| 56 | + <van-dialog v-model:show="dialog_show" title="温馨提示"> | ||
| 57 | + <div style="padding: 1rem; text-align: center;">{{ dialog_text }}</div> | ||
| 58 | + </van-dialog> | ||
| 55 | </div> | 59 | </div> |
| 56 | </template> | 60 | </template> |
| 57 | 61 | ||
| ... | @@ -357,10 +361,13 @@ export default { | ... | @@ -357,10 +361,13 @@ export default { |
| 357 | } | 361 | } |
| 358 | }); | 362 | }); |
| 359 | this.map.add(this.markerSum); | 363 | this.map.add(this.markerSum); |
| 364 | + // 获取定位打标记 | ||
| 365 | + this.setLocation(); | ||
| 366 | + // | ||
| 360 | }, | 367 | }, |
| 361 | isPointInRing() { // 是否在景区范围 | 368 | isPointInRing() { // 是否在景区范围 |
| 362 | let isPointInRing = AMap.GeometryUtil.isPointInRing([this.current_lng, this.current_lat], [ | 369 | let isPointInRing = AMap.GeometryUtil.isPointInRing([this.current_lng, this.current_lat], [ |
| 363 | - [120.585111, 31.316084], [120.585111, 31.316084], [120.589488, 31.313197], [120.585422, 31.313005] | 370 | + [117.044223,26.835105], [117.044227,26.842448], [117.0552,26.842452], [117.055195,26.8351] |
| 364 | ]); | 371 | ]); |
| 365 | return isPointInRing | 372 | return isPointInRing |
| 366 | }, | 373 | }, |
| ... | @@ -371,31 +378,6 @@ export default { | ... | @@ -371,31 +378,6 @@ export default { |
| 371 | this.dialog_text = '获取经纬度失败'; | 378 | this.dialog_text = '获取经纬度失败'; |
| 372 | } | 379 | } |
| 373 | this.getLocation(); | 380 | this.getLocation(); |
| 374 | - // // this.map.addControl(this.geolocation); // 添加定位图标 自动跳转当前位置 | ||
| 375 | - // if (!this.current_lng || !this.current_lat) { | ||
| 376 | - // this.getLocation() | ||
| 377 | - // } else { | ||
| 378 | - // // 判断是否在范围内 | ||
| 379 | - // if (!this.isPointInRing()) { | ||
| 380 | - // this.dialog_show = true; | ||
| 381 | - // this.dialog_text = '您不在景区范围内'; | ||
| 382 | - // } else { | ||
| 383 | - // // this.current_lng = '120.587643' | ||
| 384 | - // // this.current_lat = '31.314853' | ||
| 385 | - // // 使用纠正偏移后的地址,打一个定位标记 | ||
| 386 | - // this.location_marker = new AMap.LabelMarker({ | ||
| 387 | - // icon: { | ||
| 388 | - // image: 'https://cdn.ipadbiz.cn/xys/map/%E5%AE%9A.png', | ||
| 389 | - // anchor: 'bottom-center', | ||
| 390 | - // size: [36, 36], | ||
| 391 | - // }, | ||
| 392 | - // position: new AMap.LngLat(this.current_lng, this.current_lat), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9] | ||
| 393 | - // }); | ||
| 394 | - // this.map.add(this.location_marker); | ||
| 395 | - // // 定位到当前位置中心 | ||
| 396 | - // this.map.setZoomAndCenter(this.zoom, [this.current_lng, this.current_lat]); | ||
| 397 | - // } | ||
| 398 | - // } | ||
| 399 | }, | 381 | }, |
| 400 | getLocation() { // 获取经纬度 | 382 | getLocation() { // 获取经纬度 |
| 401 | // PC端无法获取定位 | 383 | // PC端无法获取定位 |
| ... | @@ -417,9 +399,9 @@ export default { | ... | @@ -417,9 +399,9 @@ export default { |
| 417 | // 使用纠正偏移后的地址,打一个定位标记 | 399 | // 使用纠正偏移后的地址,打一个定位标记 |
| 418 | this.location_marker = new AMap.LabelMarker({ | 400 | this.location_marker = new AMap.LabelMarker({ |
| 419 | icon: { | 401 | icon: { |
| 420 | - image: 'https://cdn.ipadbiz.cn/xys/map/%E5%AE%9A.png', | 402 | + image: 'https://cdn.ipadbiz.cn/bieyuan/map/icon/Group%2034@3x.png', |
| 421 | anchor: 'bottom-center', | 403 | anchor: 'bottom-center', |
| 422 | - size: [36, 36], | 404 | + size: [65, 65], |
| 423 | }, | 405 | }, |
| 424 | position: new AMap.LngLat(this.current_lng, this.current_lat), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9] | 406 | position: new AMap.LngLat(this.current_lng, this.current_lat), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9] |
| 425 | }); | 407 | }); | ... | ... |
-
Please register or login to post a comment