hookehuyr

详情页数据查询后显示调整

This diff is collapsed. Click to expand it.
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 12:03:00 4 + * @LastEditTime: 2024-09-22 13:43:45
5 * @FilePath: /map-demo/src/views/bieyuan/map.vue 5 * @FilePath: /map-demo/src/views/bieyuan/map.vue
6 * @Description: 公众地图主体页面 6 * @Description: 公众地图主体页面
7 --> 7 -->
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
42 <button @click="show = false">关闭</button> 42 <button @click="show = false">关闭</button>
43 </div> 43 </div>
44 </template> --> 44 </template> -->
45 - <page-info ref="pageInfo" @close-float="onCloseFloat" @route="onRoute"></page-info> 45 + <page-info ref="pageInfo" :info="itemInfo" @close-float="onCloseFloat" @route="onRoute"></page-info>
46 <!-- <div v-if="showClose" @click="closeFloatPanel" class="close-float-panel"> 46 <!-- <div v-if="showClose" @click="closeFloatPanel" class="close-float-panel">
47 <van-icon name="arrow-left" color="#FFF" size="1.5rem" /> 47 <van-icon name="arrow-left" color="#FFF" size="1.5rem" />
48 </div> --> 48 </div> -->
...@@ -72,6 +72,12 @@ ...@@ -72,6 +72,12 @@
72 </div> 72 </div>
73 </div> 73 </div>
74 </div> 74 </div>
75 +
76 + <van-toast v-model:show="show_toast" style="padding: 0">
77 + <template #message>
78 + <p style="padding: 0.5rem 1rem;">{{ toast_text }}</p>
79 + </template>
80 + </van-toast>
75 </div> 81 </div>
76 </template> 82 </template>
77 83
...@@ -217,6 +223,8 @@ export default { ...@@ -217,6 +223,8 @@ export default {
217 route_safe_marker: [], 223 route_safe_marker: [],
218 show_walk_route: true, 224 show_walk_route: true,
219 open_current_location: true, 225 open_current_location: true,
226 + show_toast: false,
227 + toast_text: '',
220 } 228 }
221 }, 229 },
222 async mounted() { 230 async mounted() {
...@@ -358,6 +366,14 @@ export default { ...@@ -358,6 +366,14 @@ export default {
358 // console.warn(e); 366 // console.warn(e);
359 this.itemInfo = entity_info[i]; 367 this.itemInfo = entity_info[i];
360 368
369 + // 详情为空提示
370 + if (!this.itemInfo.details.length) {
371 + this.show_toast = true;
372 + this.toast_text = '该景点暂无详情'
373 + return;
374 + }
375 +
376 +
361 // 打开浮动面板 377 // 打开浮动面板
362 this.info_height = (0.45 * window.innerHeight); 378 this.info_height = (0.45 * window.innerHeight);
363 // 浮动面板样式 379 // 浮动面板样式
...@@ -368,8 +384,8 @@ export default { ...@@ -368,8 +384,8 @@ export default {
368 this.map.setZoomAndCenter(this.zoom, this.itemInfo.position); 384 this.map.setZoomAndCenter(this.zoom, this.itemInfo.position);
369 }) 385 })
370 } 386 }
387 + // TODO: ID问题看看实际名称叫什么
371 // 导航路径 388 // 导航路径
372 - console.warn(entity_info[i]);
373 let marker_id = this.$route.query.marker_id; 389 let marker_id = this.$route.query.marker_id;
374 if (marker_id) { 390 if (marker_id) {
375 this.$nextTick(() => { 391 this.$nextTick(() => {
...@@ -615,7 +631,7 @@ export default { ...@@ -615,7 +631,7 @@ export default {
615 // 还原样式 631 // 还原样式
616 this.resetMarkStyle();*/ 632 this.resetMarkStyle();*/
617 }, 633 },
618 - scanQrcode() { 634 + scanQrcode() { // 扫码跳转详情页
619 wx.scanQRCode({ 635 wx.scanQRCode({
620 needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果, 636 needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
621 scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码,默认二者都有 637 scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码,默认二者都有
...@@ -648,6 +664,7 @@ export default { ...@@ -648,6 +664,7 @@ export default {
648 path: '/bieyuan/info', 664 path: '/bieyuan/info',
649 query: { 665 query: {
650 id: this.$route.query.id, 666 id: this.$route.query.id,
667 + marker_id: this.itemInfo.id
651 } 668 }
652 }) 669 })
653 } else { 670 } else {
...@@ -777,6 +794,8 @@ export default { ...@@ -777,6 +794,8 @@ export default {
777 console.warn(marker_id); 794 console.warn(marker_id);
778 // 模拟新增路线 795 // 模拟新增路线
779 this.addSafeRoute(this.data_path_list[0]); 796 this.addSafeRoute(this.data_path_list[0]);
797 + // 定位到当前位置中心
798 + this.map.setZoomAndCenter(this.zoom, this.data_center);
780 }, 799 },
781 handleLocation(status) { // 打开/关闭 当前定位 800 handleLocation(status) { // 打开/关闭 当前定位
782 if (status) { 801 if (status) {
......