hookehuyr

fix 导航逻辑修改 从marker里面获取

1 <!-- 1 <!--
2 * @Date: 2024-09-15 22:08:49 2 * @Date: 2024-09-15 22:08:49
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-09-23 14:03:31 4 + * @LastEditTime: 2024-09-23 14:55:02
5 * @FilePath: /map-demo/src/views/bieyuan/info.vue 5 * @FilePath: /map-demo/src/views/bieyuan/info.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
47 </div> 47 </div>
48 <div v-if="page_details.experience_audio.length" class="audio-wrapper"> 48 <div v-if="page_details.experience_audio.length" class="audio-wrapper">
49 <div :class="['audio-item', play_audio_index === index ? 'click' : '']" v-for="(item, index) in page_details.experience_audio" :key="index"> 49 <div :class="['audio-item', play_audio_index === index ? 'click' : '']" v-for="(item, index) in page_details.experience_audio" :key="index">
50 - <div>{{ item.name }}</div> 50 + <div>{{ item.description }}</div>
51 <!-- <div :class="['audio-icon', play_audio_index === index ? 'click' : '']"></div> --> 51 <!-- <div :class="['audio-icon', play_audio_index === index ? 'click' : '']"></div> -->
52 <van-icon @click="stopAudio(item, index)" v-if="item.play" size="2rem" name="stop-circle-o" color="#DD7850" /> 52 <van-icon @click="stopAudio(item, index)" v-if="item.play" size="2rem" name="stop-circle-o" color="#DD7850" />
53 <van-icon v-else @click="playAudio(item, index)" size="2rem" name="https://cdn.ipadbiz.cn/bieyuan/map/icon/audio_icon.png" /> 53 <van-icon v-else @click="playAudio(item, index)" size="2rem" name="https://cdn.ipadbiz.cn/bieyuan/map/icon/audio_icon.png" />
...@@ -98,7 +98,7 @@ watch( ...@@ -98,7 +98,7 @@ watch(
98 () => props.info, 98 () => props.info,
99 (v) => { 99 (v) => {
100 if (v.details.length) { 100 if (v.details.length) {
101 - page_details.value = { ...v.details[0], position: v.position }; 101 + page_details.value = { ...v.details[0], position: v.position, path: v.path };
102 // 获取浏览器可视范围的高度 102 // 获取浏览器可视范围的高度
103 $('.info-page').height(props.height + 'px'); 103 $('.info-page').height(props.height + 'px');
104 } 104 }
...@@ -169,11 +169,12 @@ onMounted(async () => { ...@@ -169,11 +169,12 @@ onMounted(async () => {
169 const marker_id = $route.query.marker_id; 169 const marker_id = $route.query.marker_id;
170 const current_marker = raw_list.filter(item => item.id == marker_id)[0]; 170 const current_marker = raw_list.filter(item => item.id == marker_id)[0];
171 // 171 //
172 - page_details.value = { ...current_marker.details[0], position: current_marker.position }; 172 + page_details.value = { ...current_marker.details[0], position: current_marker.position, path: current_marker.path };
173 // 富文本转义, 分割线样式转换 173 // 富文本转义, 分割线样式转换
174 page_details.value.introduction = page_details.value.introduction?.replace(/\<hr\>/g, '<div class="van-hairline--bottom" style="margin: 1rem 0;"></div>') 174 page_details.value.introduction = page_details.value.introduction?.replace(/\<hr\>/g, '<div class="van-hairline--bottom" style="margin: 1rem 0;"></div>')
175 page_details.value.story = page_details.value.story?.replace(/\<hr\>/g, '<div class="van-hairline--bottom" style="margin: 1rem 0;"></div>') 175 page_details.value.story = page_details.value.story?.replace(/\<hr\>/g, '<div class="van-hairline--bottom" style="margin: 1rem 0;"></div>')
176 page_details.value.experience = page_details.value.experience?.replace(/\<hr\>/g, '<div class="van-hairline--bottom" style="margin: 1rem 0;"></div>') 176 page_details.value.experience = page_details.value.experience?.replace(/\<hr\>/g, '<div class="van-hairline--bottom" style="margin: 1rem 0;"></div>')
177 + console.log("🚀 ~ file: info.vue:177 ~ onMounted ~ page_details.value:", page_details.value);
177 } 178 }
178 }); 179 });
179 180
...@@ -197,14 +198,14 @@ const goTo = () => { // 打开标记地图显示 ...@@ -197,14 +198,14 @@ const goTo = () => { // 打开标记地图显示
197 path: '/bieyuan/map', 198 path: '/bieyuan/map',
198 query: { 199 query: {
199 id: $route.query.id, 200 id: $route.query.id,
200 - marker_id: '12345' 201 + marker_id: $route.query.marker_id
201 } 202 }
202 }) 203 })
203 } else { // 地图页 204 } else { // 地图页
204 // 205 //
205 emit("closeFloat", false); 206 emit("closeFloat", false);
206 // 207 //
207 - emit("route", 'marker_id'); 208 + emit("route", {name: 'marker', path: page_details.value.path});
208 } 209 }
209 } 210 }
210 211
......
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-23 11:11:19 4 + * @LastEditTime: 2024-09-23 14:54:34
5 * @FilePath: /map-demo/src/views/bieyuan/map.vue 5 * @FilePath: /map-demo/src/views/bieyuan/map.vue
6 * @Description: 公众地图主体页面 6 * @Description: 公众地图主体页面
7 --> 7 -->
...@@ -384,12 +384,14 @@ export default { ...@@ -384,12 +384,14 @@ export default {
384 // this.map.setZoomAndCenter(this.zoom, this.itemInfo.position); 384 // this.map.setZoomAndCenter(this.zoom, this.itemInfo.position);
385 }) 385 })
386 } 386 }
387 - // TODO: ID问题看看实际名称叫什么 387 + // TODO: 获取详情定位信息用来导航
388 // 导航路径 388 // 导航路径
389 let marker_id = this.$route.query.marker_id; 389 let marker_id = this.$route.query.marker_id;
390 if (marker_id) { 390 if (marker_id) {
391 this.$nextTick(() => { 391 this.$nextTick(() => {
392 - this.addSafeRoute(this.data_path_list[0]); 392 + let marker = this.navBarList[0]['list'].filter(item => item.id == marker_id)
393 + let path = marker[0].path;
394 + this.addSafeRoute({name: 'marker', path});
393 // 获取当前 URL 的查询参数 395 // 获取当前 URL 的查询参数
394 let query = { ...this.$route.query }; 396 let query = { ...this.$route.query };
395 397
...@@ -791,10 +793,10 @@ export default { ...@@ -791,10 +793,10 @@ export default {
791 // 关闭导航提示 793 // 关闭导航提示
792 this.show_walk_route = true; 794 this.show_walk_route = true;
793 }, 795 },
794 - onRoute (marker_id) { 796 + onRoute (path) {
795 - console.warn(marker_id); 797 + console.warn(path);
796 // 模拟新增路线 798 // 模拟新增路线
797 - this.addSafeRoute(this.data_path_list[0]); 799 + this.addSafeRoute(path);
798 // 定位到当前位置中心 800 // 定位到当前位置中心
799 this.map.setZoomAndCenter(this.zoom, this.data_center); 801 this.map.setZoomAndCenter(this.zoom, this.data_center);
800 }, 802 },
......