Showing
1 changed file
with
27 additions
and
1 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: 2025-03-06 12:14:54 | 4 | + * @LastEditTime: 2025-03-06 12:47:35 |
| 5 | * @FilePath: /map-demo/src/views/by/map.vue | 5 | * @FilePath: /map-demo/src/views/by/map.vue |
| 6 | * @Description: 公众地图主体页面 | 6 | * @Description: 公众地图主体页面 |
| 7 | --> | 7 | --> |
| ... | @@ -55,6 +55,12 @@ | ... | @@ -55,6 +55,12 @@ |
| 55 | 关闭步行导航 | 55 | 关闭步行导航 |
| 56 | </div> | 56 | </div> |
| 57 | 57 | ||
| 58 | + | ||
| 59 | + <!-- 新增关闭导航按钮 --> | ||
| 60 | + <div v-if="walking && !show_walk_route" class="walk-nav-text" @click="closeWalkingRoute"> | ||
| 61 | + 关闭步行导航 | ||
| 62 | + </div> | ||
| 63 | + | ||
| 58 | <van-dialog v-model:show="dialog_show" title="温馨提示"> | 64 | <van-dialog v-model:show="dialog_show" title="温馨提示"> |
| 59 | <div style="padding: 1rem; text-align: center;">{{ dialog_text }}</div> | 65 | <div style="padding: 1rem; text-align: center;">{{ dialog_text }}</div> |
| 60 | </van-dialog> | 66 | </van-dialog> |
| ... | @@ -1021,6 +1027,11 @@ export default { | ... | @@ -1021,6 +1027,11 @@ export default { |
| 1021 | this.walking.search(start, end, (status, result) => { | 1027 | this.walking.search(start, end, (status, result) => { |
| 1022 | if (status === 'complete') { | 1028 | if (status === 'complete') { |
| 1023 | console.log('步行路线规划成功'); | 1029 | console.log('步行路线规划成功'); |
| 1030 | + setTimeout(() =>{ | ||
| 1031 | + // 定位到当前位置中心 | ||
| 1032 | + this.getLocation(); | ||
| 1033 | + this.show_walk_route = false; | ||
| 1034 | + },500) | ||
| 1024 | } else { | 1035 | } else { |
| 1025 | console.error('步行路线规划失败:', status, result); | 1036 | console.error('步行路线规划失败:', status, result); |
| 1026 | ElMessage.error('步行路线规划失败,请稍后重试'); | 1037 | ElMessage.error('步行路线规划失败,请稍后重试'); |
| ... | @@ -1043,6 +1054,21 @@ export default { | ... | @@ -1043,6 +1054,21 @@ export default { |
| 1043 | this.current_lat = ''; | 1054 | this.current_lat = ''; |
| 1044 | this.map.remove(this.location_marker); // 删除当前定位标记 | 1055 | this.map.remove(this.location_marker); // 删除当前定位标记 |
| 1045 | }, | 1056 | }, |
| 1057 | + closeWalkingRoute() { | ||
| 1058 | + if (this.walking) { | ||
| 1059 | + this.walking.clear(); // 清除路线 | ||
| 1060 | + this.show_walk_route = true; // 恢复状态 | ||
| 1061 | + // 可选:移除面板内容 | ||
| 1062 | + document.getElementById('walking-panel').innerHTML = ''; | ||
| 1063 | + | ||
| 1064 | + // 显示提示 | ||
| 1065 | + this.show_toast = true; | ||
| 1066 | + this.toast_text = '已关闭步行导航'; | ||
| 1067 | + | ||
| 1068 | + // 可选:重新定位到当前位置 | ||
| 1069 | + this.getLocation(); | ||
| 1070 | + } | ||
| 1071 | + }, | ||
| 1046 | } | 1072 | } |
| 1047 | } | 1073 | } |
| 1048 | </script> | 1074 | </script> | ... | ... |
-
Please register or login to post a comment