hookehuyr

建筑景点样式调整

...@@ -12,8 +12,12 @@ declare module '@vue/runtime-core' { ...@@ -12,8 +12,12 @@ declare module '@vue/runtime-core' {
12 InfoWindow: typeof import('./src/components/InfoWindow.vue')['default'] 12 InfoWindow: typeof import('./src/components/InfoWindow.vue')['default']
13 RouterLink: typeof import('vue-router')['RouterLink'] 13 RouterLink: typeof import('vue-router')['RouterLink']
14 RouterView: typeof import('vue-router')['RouterView'] 14 RouterView: typeof import('vue-router')['RouterView']
15 + VanCol: typeof import('vant/es')['Col']
15 VanDialog: typeof import('vant/es')['Dialog'] 16 VanDialog: typeof import('vant/es')['Dialog']
16 VanIcon: typeof import('vant/es')['Icon'] 17 VanIcon: typeof import('vant/es')['Icon']
17 VanPopup: typeof import('vant/es')['Popup'] 18 VanPopup: typeof import('vant/es')['Popup']
19 + VanRow: typeof import('vant/es')['Row']
20 + VanTab: typeof import('vant/es')['Tab']
21 + VanTabs: typeof import('vant/es')['Tabs']
18 } 22 }
19 } 23 }
......
This diff is collapsed. Click to expand it.
...@@ -2,16 +2,19 @@ ...@@ -2,16 +2,19 @@
2 <div style="position: relative;"> 2 <div style="position: relative;">
3 <div class="info-window-wrapper"> 3 <div class="info-window-wrapper">
4 <div :style="{ width: (widow_info.width * 0.8) + 'px', overflow: 'auto' }"> 4 <div :style="{ width: (widow_info.width * 0.8) + 'px', overflow: 'auto' }">
5 - <div style="color: #AB8F57; font-size: 1.5rem; margin-bottom: 0.5rem;">三宝楼</div> 5 + <div class="hideScrollBar info-window-title">
6 - <div> 6 + <div v-for="(item, index) in info.details" :key="index" @click="handleTitle(index)"
7 - <div class="info-text van-multi-ellipsis--l3"> 7 + :class="[isActive === index ? 'checked' : '', 'item']">
8 - 大雄宝殿是寺院的中心建筑,兴建于清末民初时期。重檐歇山,面阔七楹,飞檐翘角,气势雄伟,风格挺秀。梁枋均施苏式彩绘,典雅富丽,绚丽夺目。 8 + <span>{{ item.name }}</span>
9 - 9 + </div>
10 - 大殿二重檐下,悬“大雄宝殿”四个遒劲有力的金字,气势雄浑,据说这四个字是陆润庠所提。陆润庠是苏州历史上第五十五位,也是最后一位状元,官至一品、大学士(即宰相级别)。大雄宝殿是佛教寺院中供奉佛像的正殿,是整座寺院的核心建筑,也是僧众朝暮集中修持的地方。因释迦牟尼佛德号“大雄”,所以称大雄宝殿。为什么叫大雄?大者,是包含万有的意思;雄者,是摄伏群魔的意思。释迦牟尼佛具足圆觉智慧,能雄镇大千世界,降伏四魔(烦恼魔、阴魔、死魔、自在天魔),因此尊称佛陀为大雄。 10 + </div>
11 - 11 + <div v-if="info?.details?.length > 3" @click="handleNavScroll()" style="position: fixed; right: 0.75rem; width: 1rem; background-color: #FFF;top: 1.5rem;">
12 - 檐枋悬有三块匾额,中门之上为“西乾应迹”匾额。西者西方,乾者天也,西乾即是指佛教的发源地古印度,因当时地处中国的西方而得名,相应地,中国则被称为东土。应迹谓应化垂迹,即佛、菩萨应众生之机缘而将其本体示现种种身以济度众生。 12 + <van-icon v-if="!nav_scroll" name="arrow" color="#888" size="1.25rem" style="vertical-align: sub;" />
13 + <van-icon v-else name="arrow-left" color="#888" size="1.25rem" style="vertical-align: sub;" />
13 </div> 14 </div>
14 - <div class="info-control"> 15 + <div v-for="(item, index) in info.details" :key="index">
16 + <div v-if="isActive === index" :class=" [item.audio ? 'info-text-audio' : 'info-text', 'van-multi-ellipsis--l3'] ">{{ item.note }}</div>
17 + <div v-if="isActive === index && item.audio" class="info-control">
15 <div v-if="!is_play" @click="play()" class="control-play"> 18 <div v-if="!is_play" @click="play()" class="control-play">
16 <van-icon name="https://cdn.ipadbiz.cn/xys/map/%E6%92%AD%E6%94%BE%E6%9A%82%E5%81%9C@2x.png" size="3rem" 19 <van-icon name="https://cdn.ipadbiz.cn/xys/map/%E6%92%AD%E6%94%BE%E6%9A%82%E5%81%9C@2x.png" size="3rem"
17 color="#FFF" style="margin-top: 0.5rem;" /> 20 color="#FFF" style="margin-top: 0.5rem;" />
...@@ -25,14 +28,15 @@ ...@@ -25,14 +28,15 @@
25 </div> 28 </div>
26 </div> 29 </div>
27 <div class="van-hairline--top" style="margin: 1rem 0;"> 30 <div class="van-hairline--top" style="margin: 1rem 0;">
28 - <div style="width: 50%; float: left; text-align: center; margin-top: 1rem;" class="van-hairline--right"> 31 + <div @click="goTo()" style="width: 50%; float: left; text-align: center; margin-top: 1rem;"
32 + class="van-hairline--right">
29 <van-icon name="https://cdn.ipadbiz.cn/xys/map/%E5%89%8D%E5%BE%80@2x.png" size="1.5rem" color="#FFF" 33 <van-icon name="https://cdn.ipadbiz.cn/xys/map/%E5%89%8D%E5%BE%80@2x.png" size="1.5rem" color="#FFF"
30 - style="vertical-align: bottom;" />&nbsp; 34 + style="vertical-align: bottom;" />&nbsp;
31 <span style="color: #AB8F57; font-size: 1.1rem;">详情</span> 35 <span style="color: #AB8F57; font-size: 1.1rem;">详情</span>
32 </div> 36 </div>
33 <div style="width: 50%; float: left; text-align: center; margin-top: 1rem;"> 37 <div style="width: 50%; float: left; text-align: center; margin-top: 1rem;">
34 <van-icon name="https://cdn.ipadbiz.cn/xys/map/%E5%89%8D%E5%BE%80@2x.png" size="1.5rem" color="#FFF" 38 <van-icon name="https://cdn.ipadbiz.cn/xys/map/%E5%89%8D%E5%BE%80@2x.png" size="1.5rem" color="#FFF"
35 - style="vertical-align: bottom;" />&nbsp; 39 + style="vertical-align: bottom;" />&nbsp;
36 <span style="color: #AB8F57; font-size: 1.1rem;">前往</span> 40 <span style="color: #AB8F57; font-size: 1.1rem;">前往</span>
37 </div> 41 </div>
38 </div> 42 </div>
...@@ -59,6 +63,7 @@ ...@@ -59,6 +63,7 @@
59 </template> 63 </template>
60 64
61 <script> 65 <script>
66 +import $ from 'jquery'
62 67
63 export default { 68 export default {
64 props: { 69 props: {
...@@ -66,9 +71,9 @@ export default { ...@@ -66,9 +71,9 @@ export default {
66 type: Object, 71 type: Object,
67 default: () => { } 72 default: () => { }
68 }, 73 },
69 - title: { 74 + info: {
70 - type: String, 75 + type: Object,
71 - default: '' 76 + default: () => { }
72 }, 77 },
73 rect: { 78 rect: {
74 type: Object, 79 type: Object,
...@@ -76,7 +81,6 @@ export default { ...@@ -76,7 +81,6 @@ export default {
76 }, 81 },
77 }, 82 },
78 mounted() { 83 mounted() {
79 -
80 }, 84 },
81 watch: { 85 watch: {
82 rect(val) { 86 rect(val) {
...@@ -85,7 +89,7 @@ export default { ...@@ -85,7 +89,7 @@ export default {
85 infoWindow(val) { 89 infoWindow(val) {
86 if (val) { 90 if (val) {
87 // 加载录音 91 // 加载录音
88 - this.audio.src = 'https://file.365daoyou.cn/mimi-001_1505799708494-k3xkyzv8'; 92 + this.audio.src = this.info.details[this.isActive]['audio'];
89 let play_status = this.audio.play() // 播放 93 let play_status = this.audio.play() // 播放
90 if (play_status) { 94 if (play_status) {
91 play_status.then(() => { 95 play_status.then(() => {
...@@ -110,11 +114,13 @@ export default { ...@@ -110,11 +114,13 @@ export default {
110 is_play: false, 114 is_play: false,
111 audio: new Audio(), 115 audio: new Audio(),
112 widow_info: {}, 116 widow_info: {},
113 - play_time: '00:00' 117 + play_time: '00:00',
118 + isActive: 0,
119 + nav_scroll: false,
114 } 120 }
115 }, 121 },
116 methods: { 122 methods: {
117 - getAudioTime (audio) { 123 + getAudioTime(audio) {
118 let time = Math.floor(audio); 124 let time = Math.floor(audio);
119 var minute = time / 60; 125 var minute = time / 60;
120 var minutes = parseInt(minute); 126 var minutes = parseInt(minute);
...@@ -145,6 +151,10 @@ export default { ...@@ -145,6 +151,10 @@ export default {
145 // 处理音频 151 // 处理音频
146 this.voice_pause(); 152 this.voice_pause();
147 this.audio.currentTime = 0 153 this.audio.currentTime = 0
154 + // 默认选中项
155 + this.isActive = 0;
156 + // 滚动状态
157 + this.nav_scroll = false;
148 }, 158 },
149 showDetail() { 159 showDetail() {
150 this.show_popup = true; 160 this.show_popup = true;
...@@ -153,7 +163,7 @@ export default { ...@@ -153,7 +163,7 @@ export default {
153 this.video_src = 'https://video.pearvideo.com/mp4/short/20200209/cont-1650197-14888002-hd.mp4' 163 this.video_src = 'https://video.pearvideo.com/mp4/short/20200209/cont-1650197-14888002-hd.mp4'
154 }, 164 },
155 play() { 165 play() {
156 - this.voice_play('https://file.365daoyou.cn/mimi-001_1505799708494-k3xkyzv8', 0) 166 + this.voice_play(this.info.details[this.isActive]['audio'], 0)
157 }, 167 },
158 pause() { 168 pause() {
159 this.voice_pause() 169 this.voice_pause()
...@@ -189,6 +199,33 @@ export default { ...@@ -189,6 +199,33 @@ export default {
189 voice_pause() { 199 voice_pause() {
190 this.audio.pause(); 200 this.audio.pause();
191 this.is_play = false; 201 this.is_play = false;
202 + },
203 + goTo(url) {
204 + location.href = this.info.details[this.isActive].url;
205 + },
206 + handleTitle (index) {
207 + this.isActive = index;
208 + this.voice_pause()
209 + // 标题滚动
210 + if (index === 2 && this.info.details.length > 3) {
211 + this.handleNavScroll()
212 + }
213 + },
214 + handleNavScroll () { // 滚动标题
215 + this.nav_scroll = !this.nav_scroll;
216 + if (this.nav_scroll) {
217 + setTimeout(() => {
218 + $('.info-window-title').animate({
219 + scrollLeft: $('.info-window-title').outerWidth()
220 + }, 1000);
221 + }, 100);
222 + } else {
223 + setTimeout(() => {
224 + $('.info-window-title').animate({
225 + scrollLeft: 0
226 + }, 1000);
227 + }, 100);
228 + }
192 } 229 }
193 } 230 }
194 } 231 }
...@@ -202,10 +239,16 @@ export default { ...@@ -202,10 +239,16 @@ export default {
202 box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4); 239 box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
203 text-align: left; 240 text-align: left;
204 border-radius: 5px; 241 border-radius: 5px;
205 - padding: 1rem 1.25rem; 242 + padding: 1.5rem 1.25rem;
206 overflow: auto; 243 overflow: auto;
207 244
208 .info-text { 245 .info-text {
246 + width: 100%;
247 + line-height: 1.5;
248 + float: left;
249 + color: #7A6C6C;
250 + }
251 + .info-text-audio {
209 width: 80%; 252 width: 80%;
210 line-height: 1.5; 253 line-height: 1.5;
211 float: left; 254 float: left;
...@@ -318,4 +361,29 @@ export default { ...@@ -318,4 +361,29 @@ export default {
318 background-size: 1rem 1rem; 361 background-size: 1rem 1rem;
319 box-shadow: none; 362 box-shadow: none;
320 } 363 }
364 +
365 +.info-window-title {
366 + display: flex;
367 + overflow-x: scroll;
368 + overflow-y: hidden;
369 + -webkit-overflow-scrolling: touch;
370 + position: relative;
371 + text-align: left;
372 +
373 + .item {
374 + width: 33.333%;
375 + flex-shrink: 0;
376 + color: #888;
377 + font-size: 1.2rem;
378 + margin-bottom: 0.75rem;
379 + display: inline-block;
380 + }
381 +
382 + .checked {
383 + color: #AB8F57;
384 + span {
385 + border-bottom: 1.5px solid #AB8F57; padding-bottom: 3px;
386 + }
387 + }
388 +}
321 </style> 389 </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: 2023-06-05 11:38:09 4 + * @LastEditTime: 2023-06-05 16:47:36
5 * @FilePath: /map-demo/src/views/index.vue 5 * @FilePath: /map-demo/src/views/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -9,8 +9,7 @@ ...@@ -9,8 +9,7 @@
9 <div ref="root" style="height: 100vh; position: relative; overflow: hidden;"> 9 <div ref="root" style="height: 100vh; position: relative; overflow: hidden;">
10 <div id="container"></div> 10 <div id="container"></div>
11 <div class="nav-bar-wrapper"> 11 <div class="nav-bar-wrapper">
12 - <div class="hideScrollBar" 12 + <div class="hideScrollBar" style="display: flex; overflow-x: scroll; overflow-y: hidden; -webkit-overflow-scrolling: touch; position: relative;">
13 - style="display: flex; overflow-x: scroll; overflow-y: hidden; -webkit-overflow-scrolling: touch; position: relative;">
14 <div v-for="(item, index) in navBarList" :key="index" style="width: 30%; flex-shrink: 0; padding-top: 1rem;" :class="[isActive === index ? 'checked' : '', 'item']" 13 <div v-for="(item, index) in navBarList" :key="index" style="width: 30%; flex-shrink: 0; padding-top: 1rem;" :class="[isActive === index ? 'checked' : '', 'item']"
15 @click="setNavLayer(item, index)"> 14 @click="setNavLayer(item, index)">
16 <van-icon name="shop-o" size="1.5rem" /><br /> 15 <van-icon name="shop-o" size="1.5rem" /><br />
...@@ -28,10 +27,9 @@ ...@@ -28,10 +27,9 @@
28 <van-popup v-model:show="show_nav_popup" position="bottom" duration="0" :overlay="false" 27 <van-popup v-model:show="show_nav_popup" position="bottom" duration="0" :overlay="false"
29 :style="{ padding: '1rem', bottom: '4.5rem' }"> 28 :style="{ padding: '1rem', bottom: '4.5rem' }">
30 <div style="text-align: left;"> 29 <div style="text-align: left;">
31 - <div @click="positionMarker()" style="margin-bottom: 1rem; font-size: 1.15rem;"><van-icon name="fire-o" color="red" />&nbsp;&nbsp;三宝楼</div> 30 + <div v-for="(item, index) in navList[navName]" :key="index" @click="positionMarker(item)" style="margin-bottom: 1rem; font-size: 1.15rem;">
32 - <div style="margin-bottom: 1rem; font-size: 1.15rem;"><van-icon name="fire-o" color="red" />&nbsp;&nbsp;法云堂</div> 31 + <van-icon name="fire-o" color="red" />&nbsp;&nbsp;{{ item.name }}
33 - <div style="margin-bottom: 1rem; font-size: 1.15rem;"><van-icon name="fire-o" color="red" />&nbsp;&nbsp;罗汉堂</div> 32 + </div>
34 - <div style="margin-bottom: 1rem; font-size: 1.15rem;"><van-icon name="fire-o" color="red" />&nbsp;&nbsp;大雄宝殿</div>
35 </div> 33 </div>
36 </van-popup> 34 </van-popup>
37 </div> 35 </div>
...@@ -92,7 +90,7 @@ ...@@ -92,7 +90,7 @@
92 90
93 <!-- 自定义组件InfoWindow,初始时需要隐藏 --> 91 <!-- 自定义组件InfoWindow,初始时需要隐藏 -->
94 <!-- 隐藏不要使用v-if,因为我们需要渲染完成后的原生html结构作为信息框的dom对象使用 --> 92 <!-- 隐藏不要使用v-if,因为我们需要渲染完成后的原生html结构作为信息框的dom对象使用 -->
95 - <InfoWindow v-show="showInfoWindow" ref="infoWindow" :info-window="infoWindow" :title="infoWindowTitle" :rect="rect"></InfoWindow> 93 + <InfoWindow v-show="showInfoWindow" ref="infoWindow" :info-window="infoWindow" :info="itemInfo" :rect="rect"></InfoWindow>
96 </div> 94 </div>
97 </template> 95 </template>
98 96
...@@ -215,21 +213,23 @@ export default { ...@@ -215,21 +213,23 @@ export default {
215 show_nav_popup: false, 213 show_nav_popup: false,
216 showInfoWindow: false, 214 showInfoWindow: false,
217 infoWindow: {}, 215 infoWindow: {},
218 - infoWindowTitle: '', 216 + itemInfo: '',
219 navBarList: [], 217 navBarList: [],
220 - rect: {} 218 + rect: {},
219 + navList: [],
220 + navName: 'spotInfo'
221 } 221 }
222 }, 222 },
223 mounted() { 223 mounted() {
224 this.navBarList = [{ 224 this.navBarList = [{
225 key: 'spot', 225 key: 'spot',
226 - name: '景区信息' 226 + name: '景'
227 }, { 227 }, {
228 key: 'activity', 228 key: 'activity',
229 - name: '活动设施' 229 + name: '餐饮'
230 }, { 230 }, {
231 key: 'public', 231 key: 'public',
232 - name: '公共设施' 232 + name: '出入口'
233 }, { 233 }, {
234 key: 'toilet', 234 key: 'toilet',
235 name: '卫生间' 235 name: '卫生间'
...@@ -244,6 +244,7 @@ export default { ...@@ -244,6 +244,7 @@ export default {
244 this.getLocation() 244 this.getLocation()
245 // 打开贴片地图 245 // 打开贴片地图
246 this.setTitleLayer() 246 this.setTitleLayer()
247 + this.navList = coord;
247 }, 248 },
248 watch: { 249 watch: {
249 show_popup(val) { 250 show_popup(val) {
...@@ -459,23 +460,22 @@ export default { ...@@ -459,23 +460,22 @@ export default {
459 }, 460 },
460 label: { 461 label: {
461 content: coord.spotInfo[i].name, 462 content: coord.spotInfo[i].name,
462 - position: 'TM', 463 + position: 'BM',
464 + offset: new AMap.Pixel(0, 10),
463 minZoom: 18 465 minZoom: 18
464 } 466 }
467 + }, {
468 + icon: {},
469 + label: {}
465 }], 470 }],
466 - zoomStyleMapping 471 + zoomStyleMapping: coord.spotInfo[i].zoom ? coord.spotInfo[i].zoom : zoomStyleMapping
467 }); 472 });
468 if (clickListener) { 473 if (clickListener) {
469 marker.off('click', clickListener) 474 marker.off('click', clickListener)
470 } 475 }
471 // 绑定景点的点击事件 - 文字出现才能触发 476 // 绑定景点的点击事件 - 文字出现才能触发
472 var clickListener = marker.on('click', (e) => { 477 var clickListener = marker.on('click', (e) => {
473 - // this.show_popup = true; 478 + this.positionMarker(coord.spotInfo[i]);
474 - // this.popup_title = x.name;
475 - // this.popup_content = x.note;
476 - // this.video_src = 'https://video.pearvideo.com/mp4/short/20200209/cont-1650197-14888002-hd.mp4'
477 - // this.positionMarker(coord.spotInfo[i].position);
478 - this.positionMarker([120.587519, 31.315924]);
479 }) 479 })
480 // 480 //
481 this.spotInfo.push(marker); 481 this.spotInfo.push(marker);
...@@ -899,15 +899,19 @@ export default { ...@@ -899,15 +899,19 @@ export default {
899 setNavLayer({ key }, index) { // 选择地图图层显示 899 setNavLayer({ key }, index) { // 选择地图图层显示
900 this.isActive = index; 900 this.isActive = index;
901 if (key === 'spot') { 901 if (key === 'spot') {
902 + this.navName = 'spotInfo'
902 this.setSpotLayer() 903 this.setSpotLayer()
903 } 904 }
904 if (key === 'toilet') { 905 if (key === 'toilet') {
906 + this.navName = 'toiletInfo'
905 this.setToiletLayer() 907 this.setToiletLayer()
906 } 908 }
907 if (key === 'activity') { 909 if (key === 'activity') {
910 + this.navName = 'activityInfo'
908 this.setActivityLayer() 911 this.setActivityLayer()
909 } 912 }
910 if (key === 'public') { 913 if (key === 'public') {
914 + this.navName = 'publicInfo'
911 this.setPublicLayer() 915 this.setPublicLayer()
912 } 916 }
913 }, 917 },
...@@ -923,11 +927,11 @@ export default { ...@@ -923,11 +927,11 @@ export default {
923 handleNavPopup() { 927 handleNavPopup() {
924 this.show_nav_popup = !this.show_nav_popup 928 this.show_nav_popup = !this.show_nav_popup
925 }, 929 },
926 - positionMarker(position = [120.587519, 31.315924]) { 930 + positionMarker(item) {
927 // 点击后创建自定义信息窗口 931 // 点击后创建自定义信息窗口
928 - this.setInfoWindows(position) 932 + this.setInfoWindows(item)
929 // 把地图中心点设置为当前点击的标记点 933 // 把地图中心点设置为当前点击的标记点
930 - this.map.setZoomAndCenter(this.zoom, position); 934 + this.map.setZoomAndCenter(this.zoom, item.position);
931 // 935 //
932 this.show_nav_popup = false; 936 this.show_nav_popup = false;
933 // 禁止缩放 937 // 禁止缩放
...@@ -935,7 +939,7 @@ export default { ...@@ -935,7 +939,7 @@ export default {
935 zoomEnable: false 939 zoomEnable: false
936 }); 940 });
937 }, 941 },
938 - setInfoWindows(position) { 942 + setInfoWindows(item) {
939 // 此时需要把组件的样式设置为可见 943 // 此时需要把组件的样式设置为可见
940 this.showInfoWindow = true 944 this.showInfoWindow = true
941 // 设置marker头部的标题信息窗口 945 // 设置marker头部的标题信息窗口
...@@ -948,9 +952,9 @@ export default { ...@@ -948,9 +952,9 @@ export default {
948 offset: new AMap.Pixel(0, -30), 952 offset: new AMap.Pixel(0, -30),
949 }) 953 })
950 this.infoWindow = infoWindow; 954 this.infoWindow = infoWindow;
951 - this.infoWindowTitle = 'xxxx' 955 + this.itemInfo = item
952 // 信息窗口打开 956 // 信息窗口打开
953 - infoWindow.open(this.map, position) 957 + infoWindow.open(this.map, item.position)
954 } 958 }
955 959
956 } 960 }
......