hookehuyr

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

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-21 13:20:20 4 + * @LastEditTime: 2024-09-22 13:30:28
5 * @FilePath: /map-demo/src/views/bieyuan/info.vue 5 * @FilePath: /map-demo/src/views/bieyuan/info.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
8 <template> 8 <template>
9 <div class="info-page"> 9 <div class="info-page">
10 - <div style="position: relative;"> 10 + <div class="info-header-wrapper">
11 <van-config-provider :theme-vars="themeVars"> 11 <van-config-provider :theme-vars="themeVars">
12 <van-swipe class="my-swipe" indicator-color="#DD7850" lazy-render :autoplay="5000"> 12 <van-swipe class="my-swipe" indicator-color="#DD7850" lazy-render :autoplay="5000">
13 <van-swipe-item v-for="image in images" :key="image"> 13 <van-swipe-item v-for="image in images" :key="image">
...@@ -17,13 +17,11 @@ ...@@ -17,13 +17,11 @@
17 </van-config-provider> 17 </van-config-provider>
18 <div class="header-z"></div> 18 <div class="header-z"></div>
19 </div> 19 </div>
20 - <!-- <div style="position: absolute; top: 12.5rem;"> -->
21 - <div>
22 <div class="info-content-wrapper"> 20 <div class="info-content-wrapper">
23 <div class="info-header"> 21 <div class="info-header">
24 <div> 22 <div>
25 - <p class="info-title">选佛场</p> 23 + <p class="info-title">{{ page_details.name }}</p>
26 - <p class="info-sub-title">南楼2层</p> 24 + <p class="info-sub-title">{{ page_details.note }}</p>
27 </div> 25 </div>
28 <div @click="goTo()" class="info-btn">前往</div> 26 <div @click="goTo()" class="info-btn">前往</div>
29 </div> 27 </div>
...@@ -31,16 +29,17 @@ ...@@ -31,16 +29,17 @@
31 <van-tabs ref="tabsRef" v-model:active="active" @click-tab="clickTab" color="#DD7850" title-active-color="#DD7850" sticky animated> 29 <van-tabs ref="tabsRef" v-model:active="active" @click-tab="clickTab" color="#DD7850" title-active-color="#DD7850" sticky animated>
32 <van-tab title="介 绍"> 30 <van-tab title="介 绍">
33 <div class="info-content"> 31 <div class="info-content">
34 - <p style="line-height: 1.75; padding: 0 0.85rem; color: #47525F;">选佛场是一个宗教活动场所,集禅堂与讲堂功能于一体。其设计仿制古代石窟样式,把古代人修行的场所“石窟”搬进室内。禅堂内的释迦牟尼佛像,仿麦积山石窟第44号特窟“东方的微笑”的造型。禅堂设计自然古朴,匠心独运,星光、烛光、月光三光辉映,营造出“一个人不孤单,一千人不喧闹”的宁静祥和的氛围。禅堂可容纳千人,开展讲经、禅修、法会等多种活动,提供礼佛、供灯、静坐等体验。</p> 32 + <!-- <p style="line-height: 1.75; padding: 0 0.85rem; color: #47525F;">选佛场是一个宗教活动场所,集禅堂与讲堂功能于一体。其设计仿制古代石窟样式,把古代人修行的场所“石窟”搬进室内。禅堂内的释迦牟尼佛像,仿麦积山石窟第44号特窟“东方的微笑”的造型。禅堂设计自然古朴,匠心独运,星光、烛光、月光三光辉映,营造出“一个人不孤单,一千人不喧闹”的宁静祥和的氛围。禅堂可容纳千人,开展讲经、禅修、法会等多种活动,提供礼佛、供灯、静坐等体验。</p>
35 <div class="van-hairline--bottom" style="margin: 1rem 0;"></div> 33 <div class="van-hairline--bottom" style="margin: 1rem 0;"></div>
36 <div style="padding: 1rem;"> 34 <div style="padding: 1rem;">
37 <div style="color: #DD7850;">•&nbsp;五方塔</div> 35 <div style="color: #DD7850;">•&nbsp;五方塔</div>
38 <div style="color: #47525F; margin-top: 1rem; line-height: 1.75;">禅堂外的草坪,安立着大小不一五座佛塔。信众可绕塔或悬挂风铃祝愿祈福,在肃静庄严的氛围中得到佛力加持,自净其意,心想事成。</div> 36 <div style="color: #47525F; margin-top: 1rem; line-height: 1.75;">禅堂外的草坪,安立着大小不一五座佛塔。信众可绕塔或悬挂风铃祝愿祈福,在肃静庄严的氛围中得到佛力加持,自净其意,心想事成。</div>
39 - </div> 37 + </div> -->
38 + <div v-html="page_details.introduction"></div>
40 </div> 39 </div>
41 </van-tab> 40 </van-tab>
42 <van-tab title="故 事"> 41 <van-tab title="故 事">
43 - <div style="padding: 0 1rem;"> 42 + <!-- <div style="padding: 0 1rem;">
44 <div style="padding: 1rem;"> 43 <div style="padding: 1rem;">
45 <div style="color: #DD7850;">•&nbsp;选官何如选佛</div> 44 <div style="color: #DD7850;">•&nbsp;选官何如选佛</div>
46 </div> 45 </div>
...@@ -63,10 +62,13 @@ ...@@ -63,10 +62,13 @@
63 <p style="color: #47525F; line-height: 1.75;">洞窟,是传统的佛教建筑形式,最早在印度盛行,古代僧人喜欢在崇山峻岭的幽僻处开凿洞窟,遁世修行。选佛场集禅堂与讲堂的功能于一体,把洞窟搬进讲堂,既有回归佛教本怀的宁静温暖,又体现出融入泰宁岩穴文化的祥和之气。</p> 62 <p style="color: #47525F; line-height: 1.75;">洞窟,是传统的佛教建筑形式,最早在印度盛行,古代僧人喜欢在崇山峻岭的幽僻处开凿洞窟,遁世修行。选佛场集禅堂与讲堂的功能于一体,把洞窟搬进讲堂,既有回归佛教本怀的宁静温暖,又体现出融入泰宁岩穴文化的祥和之气。</p>
64 </div> 63 </div>
65 <div class="van-hairline--bottom" style="margin: 0 1rem;"></div> 64 <div class="van-hairline--bottom" style="margin: 0 1rem;"></div>
65 + </div> -->
66 + <div class="info-content">
67 + <div v-html="page_details.story"></div>
66 </div> 68 </div>
67 </van-tab> 69 </van-tab>
68 <van-tab title="体 验" id="tab-3"> 70 <van-tab title="体 验" id="tab-3">
69 - <div style="padding: 0 1rem;"> 71 + <!-- <div style="padding: 0 1rem;">
70 <div style="padding: 1rem;"> 72 <div style="padding: 1rem;">
71 <div style="color: #DD7850;">•&nbsp;供灯</div> 73 <div style="color: #DD7850;">•&nbsp;供灯</div>
72 <div style="color: #47525F; margin-top: 1rem; line-height: 1.75;">禅堂内自助供灯。</div> 74 <div style="color: #47525F; margin-top: 1rem; line-height: 1.75;">禅堂内自助供灯。</div>
...@@ -75,6 +77,9 @@ ...@@ -75,6 +77,9 @@
75 <van-image width="100%" height="11rem" fit="cover" src="https://cdn.ipadbiz.cn/bieyuan/map/Mix_20240815_211927.png" /> 77 <van-image width="100%" height="11rem" fit="cover" src="https://cdn.ipadbiz.cn/bieyuan/map/Mix_20240815_211927.png" />
76 </div> 78 </div>
77 <div class="van-hairline--bottom" style="margin: 0 1rem;"></div> 79 <div class="van-hairline--bottom" style="margin: 0 1rem;"></div>
80 + </div> -->
81 + <div class="info-content">
82 + <div v-html="page_details.experience"></div>
78 </div> 83 </div>
79 <div class="audio-wrapper"> 84 <div class="audio-wrapper">
80 <div :class="['audio-item', play_audio_index === index ? 'click' : '']" v-for="(item, index) in audioList" :key="index"> 85 <div :class="['audio-item', play_audio_index === index ? 'click' : '']" v-for="(item, index) in audioList" :key="index">
...@@ -84,21 +89,15 @@ ...@@ -84,21 +89,15 @@
84 <van-icon v-else @click="playAudio(item, index)" size="2rem" name="https://cdn.ipadbiz.cn/bieyuan/map/icon/audio_icon.png" /> 89 <van-icon v-else @click="playAudio(item, index)" size="2rem" name="https://cdn.ipadbiz.cn/bieyuan/map/icon/audio_icon.png" />
85 </div> 90 </div>
86 </div> 91 </div>
87 - <div style="padding: 0 1rem;"> 92 + <!-- <div style="padding: 0 1rem;">
88 <img src="https://cdn.ipadbiz.cn/bieyuan/map/xcx.png" style="width: 100%;"> 93 <img src="https://cdn.ipadbiz.cn/bieyuan/map/xcx.png" style="width: 100%;">
89 - </div> 94 + </div> -->
90 </van-tab> 95 </van-tab>
91 </van-tabs> 96 </van-tabs>
92 </div> 97 </div>
93 </div> 98 </div>
94 - <div style="display: flex; justify-content: center; margin: 3rem;"> 99 + <div class="info-logo">
95 - <van-image 100 + <van-image width="3rem" height="3rem" fit="contain" src="https://cdn.ipadbiz.cn/bieyuan/map/icon/scan_logo.png" />
96 - width="3rem"
97 - height="3rem"
98 - fit="contain"
99 - src="https://cdn.ipadbiz.cn/bieyuan/map/icon/scan_logo.png"
100 - />
101 - </div>
102 </div> 101 </div>
103 </div> 102 </div>
104 </template> 103 </template>
...@@ -112,6 +111,8 @@ import { mainStore } from '@/store'; ...@@ -112,6 +111,8 @@ import { mainStore } from '@/store';
112 111
113 import $ from 'jquery'; 112 import $ from 'jquery';
114 113
114 +import { mapAPI } from '@/api/map.js'
115 +
115 const store = mainStore(); 116 const store = mainStore();
116 const { audio_status, audio_entity } = storeToRefs(store); 117 const { audio_status, audio_entity } = storeToRefs(store);
117 118
...@@ -123,6 +124,22 @@ const themeVars = ref({ ...@@ -123,6 +124,22 @@ const themeVars = ref({
123 swipeIndicatorMargin: '1.5rem' 124 swipeIndicatorMargin: '1.5rem'
124 }); 125 });
125 126
127 +const props = defineProps({
128 + info: Object,
129 +});
130 +
131 +const page_details = ref({});
132 +
133 +watch(
134 + () => props.info,
135 + (v) => {
136 + // TODO:获取标记点详情进行后续处理
137 + if (v.details.length) {
138 + page_details.value = { ...v.details[0], position: v.position };
139 + }
140 + }
141 +)
142 +
126 const images = ref([ 143 const images = ref([
127 'https://cdn.ipadbiz.cn/bieyuan/map/swiper_img.png', 144 'https://cdn.ipadbiz.cn/bieyuan/map/swiper_img.png',
128 'https://cdn.ipadbiz.cn/bieyuan/map/Mix_20230612_201951.png', 145 'https://cdn.ipadbiz.cn/bieyuan/map/Mix_20230612_201951.png',
...@@ -178,8 +195,19 @@ const stopAudio = (item, index) => { ...@@ -178,8 +195,19 @@ const stopAudio = (item, index) => {
178 195
179 const audio = ref(new Audio()); 196 const audio = ref(new Audio());
180 197
181 -onMounted(() => { 198 +onMounted(async () => {
182 -}) 199 + // 通过ID查询到标记点详情
200 + if (!props.info) {
201 + let id = $route.query.id;
202 + const { data } = await mapAPI({ i: id });
203 + const raw_list = data.list[0].list; // 获取标记点列表
204 + const marker_id = $route.query.marker_id;
205 + const current_marker = raw_list.filter(item => item.id == marker_id)[0];
206 + //
207 + page_details.value = { ...current_marker.details[0], position: current_marker.position };
208 + console.log("🚀 ~ file: info.vue:201 ~ onMounted ~ page_details.value:", page_details.value);
209 + }
210 +});
183 211
184 onUnmounted(() => { // 离开页面时关闭音频播放 212 onUnmounted(() => { // 离开页面时关闭音频播放
185 audio.value.pause(); 213 audio.value.pause();
...@@ -244,6 +272,8 @@ defineExpose({ ...@@ -244,6 +272,8 @@ defineExpose({
244 height: 100vh; 272 height: 100vh;
245 overflow: scroll; 273 overflow: scroll;
246 position: relative; 274 position: relative;
275 + .info-header-wrapper {
276 + position: relative;
247 .header-z { 277 .header-z {
248 position: absolute; 278 position: absolute;
249 bottom: 0; 279 bottom: 0;
...@@ -256,6 +286,7 @@ defineExpose({ ...@@ -256,6 +286,7 @@ defineExpose({
256 border-top-left-radius: 0.5rem; 286 border-top-left-radius: 0.5rem;
257 border-top-right-radius: 0.5rem; 287 border-top-right-radius: 0.5rem;
258 } 288 }
289 + }
259 .info-content-wrapper { 290 .info-content-wrapper {
260 box-shadow: 0px -3px 6px 0 rgba(241, 242, 248, 0.8); 291 box-shadow: 0px -3px 6px 0 rgba(241, 242, 248, 0.8);
261 margin: 1rem; 292 margin: 1rem;
...@@ -290,6 +321,14 @@ defineExpose({ ...@@ -290,6 +321,14 @@ defineExpose({
290 } 321 }
291 .info-content { 322 .info-content {
292 padding: 1rem; 323 padding: 1rem;
324 + p {
325 + line-height: 1.75;
326 + padding: 0 0.85rem;
327 + text-align: justify;
328 + img {
329 + width: 100%;
330 + }
331 + }
293 } 332 }
294 .audio-wrapper { 333 .audio-wrapper {
295 padding: 1rem; 334 padding: 1rem;
...@@ -330,5 +369,10 @@ defineExpose({ ...@@ -330,5 +369,10 @@ defineExpose({
330 } 369 }
331 } 370 }
332 } 371 }
372 + .info-logo {
373 + display: flex;
374 + justify-content: center;
375 + margin: 3rem;
376 + }
333 } 377 }
334 </style> 378 </style>
......
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) {
......