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-18 17:25:26 4 + * @LastEditTime: 2024-09-19 11:02:19
5 * @FilePath: /map-demo/src/views/bieyuan/info.vue 5 * @FilePath: /map-demo/src/views/bieyuan/info.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
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">
14 - <van-image fit="cover" width="100%" height="15rem" :src="image" /> 14 + <van-image fit="cover" width="100%" height="13rem" :src="image" />
15 </van-swipe-item> 15 </van-swipe-item>
16 </van-swipe> 16 </van-swipe>
17 </van-config-provider> 17 </van-config-provider>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
22 <p class="info-title">选佛场</p> 22 <p class="info-title">选佛场</p>
23 <p class="info-sub-title">南楼2层</p> 23 <p class="info-sub-title">南楼2层</p>
24 </div> 24 </div>
25 - <div class="info-btn">前往</div> 25 + <div @click="goTo()" class="info-btn">前往</div>
26 </div> 26 </div>
27 <div class="van-hairline--bottom"> 27 <div class="van-hairline--bottom">
28 <van-tabs v-model:active="active" color="#DD7850" title-active-color="#DD7850" sticky> 28 <van-tabs v-model:active="active" color="#DD7850" title-active-color="#DD7850" sticky>
...@@ -131,6 +131,16 @@ const outerStopAudio = () => { ...@@ -131,6 +131,16 @@ const outerStopAudio = () => {
131 audio.value.pause(); 131 audio.value.pause();
132 } 132 }
133 133
134 +const emit = defineEmits(["closeFloat"]);
135 +const goTo = () => { // 打开标记地图显示
136 + if ($router.currentRoute.value.path === '/bieyuan/info') { // 详情页
137 +
138 + } else { // 地图页
139 + //
140 + emit("closeFloat", false);
141 + }
142 +}
143 +
134 defineExpose({ 144 defineExpose({
135 outerStopAudio 145 outerStopAudio
136 }) 146 })
......
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-18 18:39:01 4 + * @LastEditTime: 2024-09-19 11:02:47
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,10 +42,10 @@ ...@@ -42,10 +42,10 @@
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"></page-info> 45 + <page-info ref="pageInfo" @close-float="onCloseFloat"></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> -->
49 </van-floating-panel> 49 </van-floating-panel>
50 </van-config-provider> 50 </van-config-provider>
51 </div> 51 </div>
...@@ -143,43 +143,43 @@ export default { ...@@ -143,43 +143,43 @@ export default {
143 data_paths: {}, // 接口获取-地图导航路径 143 data_paths: {}, // 接口获取-地图导航路径
144 data_path_list: [], // 接口获取-地图导航路径 144 data_path_list: [], // 接口获取-地图导航路径
145 info_height: 0, 145 info_height: 0,
146 - anchors: [0, (0.5 * window.innerHeight), (1 * window.innerHeight)], 146 + anchors: [0, (0.45 * window.innerHeight), (1 * window.innerHeight)],
147 themeVars: { 147 themeVars: {
148 floatingPanelHeaderHeight: 0, 148 floatingPanelHeaderHeight: 0,
149 floatingPanelBorderRadius: '1.25rem' 149 floatingPanelBorderRadius: '1.25rem'
150 }, 150 },
151 showClose: false, 151 showClose: false,
152 - markerStyle1: { // 选中 152 + markerStyle1: { // 选中
153 //设置文本样式,Object 同 css 样式表 153 //设置文本样式,Object 同 css 样式表
154 "padding": ".5rem .2rem .5rem .2rem", 154 "padding": ".5rem .2rem .5rem .2rem",
155 // "margin-bottom": "1rem", 155 // "margin-bottom": "1rem",
156 + "border-color": "#DD7850",
156 "border-radius": ".25rem", 157 "border-radius": ".25rem",
157 - "background-color": "#DD7850", 158 + "background-color": "#FFF",
158 // "width": "1rem", 159 // "width": "1rem",
159 // "border-width": 0, 160 // "border-width": 0,
160 // "box-shadow": "0 2px 6px 0 rgba(114, 124, 245, .5)", 161 // "box-shadow": "0 2px 6px 0 rgba(114, 124, 245, .5)",
161 // "text-align": "center", 162 // "text-align": "center",
162 "font-size": "0.8rem", 163 "font-size": "0.8rem",
163 - "color": "white", 164 + "color": "#DD7850",
164 "writing-mode": "vertical-rl", 165 "writing-mode": "vertical-rl",
165 "text-orientation": "mixed", 166 "text-orientation": "mixed",
166 "display": "flex", 167 "display": "flex",
167 "justify-content": "center", 168 "justify-content": "center",
168 "align-items": "center", 169 "align-items": "center",
169 }, 170 },
170 - markerStyle2: { // 选中 171 + markerStyle2: { // 选中
171 //设置文本样式,Object 同 css 样式表 172 //设置文本样式,Object 同 css 样式表
172 "padding": ".5rem .2rem .5rem .2rem", 173 "padding": ".5rem .2rem .5rem .2rem",
173 // "margin-bottom": "1rem", 174 // "margin-bottom": "1rem",
174 - "border-color": "#DD7850",
175 "border-radius": ".25rem", 175 "border-radius": ".25rem",
176 - "background-color": "#FFF", 176 + "background-color": "#DD7850",
177 // "width": "1rem", 177 // "width": "1rem",
178 // "border-width": 0, 178 // "border-width": 0,
179 // "box-shadow": "0 2px 6px 0 rgba(114, 124, 245, .5)", 179 // "box-shadow": "0 2px 6px 0 rgba(114, 124, 245, .5)",
180 // "text-align": "center", 180 // "text-align": "center",
181 "font-size": "0.8rem", 181 "font-size": "0.8rem",
182 - "color": "#DD7850", 182 + "color": "white",
183 "writing-mode": "vertical-rl", 183 "writing-mode": "vertical-rl",
184 "text-orientation": "mixed", 184 "text-orientation": "mixed",
185 "display": "flex", 185 "display": "flex",
...@@ -314,10 +314,13 @@ export default { ...@@ -314,10 +314,13 @@ export default {
314 this.itemInfo = entity_info[i]; 314 this.itemInfo = entity_info[i];
315 315
316 // 打开浮动面板 316 // 打开浮动面板
317 - this.info_height = (0.5 * window.innerHeight); 317 + this.info_height = (0.45 * window.innerHeight);
318 // 浮动面板样式 318 // 浮动面板样式
319 $('.van-floating-panel__content').css('borderRadius', '1.25rem'); 319 $('.van-floating-panel__content').css('borderRadius', '1.25rem');
320 $('.van-floating-panel').css('boxShadow', '0 0 15px black'); 320 $('.van-floating-panel').css('boxShadow', '0 0 15px black');
321 +
322 + // 定位到当前位置中心
323 + this.map.setZoomAndCenter(this.zoom, this.itemInfo.position);
321 }) 324 })
322 } 325 }
323 }); 326 });
...@@ -570,11 +573,11 @@ export default { ...@@ -570,11 +573,11 @@ export default {
570 e.lnglat.getLat() + 573 e.lnglat.getLat() +
571 "]," 574 "],"
572 console.log(text); 575 console.log(text);
573 - // 关闭浮动面板 576 + /*// 关闭浮动面板
574 this.info_height = 0; 577 this.info_height = 0;
575 $('.van-floating-panel').css('boxShadow', 'none'); 578 $('.van-floating-panel').css('boxShadow', 'none');
576 // 还原样式 579 // 还原样式
577 - this.resetMarkStyle(); 580 + this.resetMarkStyle();*/
578 }, 581 },
579 scanQrcode() { 582 scanQrcode() {
580 wx.scanQRCode({ 583 wx.scanQRCode({
...@@ -604,7 +607,7 @@ export default { ...@@ -604,7 +607,7 @@ export default {
604 } 607 }
605 }, 608 },
606 closeFloatPanel () { 609 closeFloatPanel () {
607 - this.info_height = (0.5 * window.innerHeight); 610 + this.info_height = (0.45 * window.innerHeight);
608 $('.van-floating-panel__content').css('borderRadius', '1.25rem'); 611 $('.van-floating-panel__content').css('borderRadius', '1.25rem');
609 this.showClose = false; 612 this.showClose = false;
610 // 关闭音频 613 // 关闭音频
...@@ -614,6 +617,12 @@ export default { ...@@ -614,6 +617,12 @@ export default {
614 this.markerSum.forEach(item => { 617 this.markerSum.forEach(item => {
615 item.setStyle(this.markerStyle1); 618 item.setStyle(this.markerStyle1);
616 }) 619 })
620 + },
621 + onCloseFloat () {
622 + this.info_height = 0;
623 + $('.van-floating-panel__content').css('borderRadius', '1.25rem');
624 + $('.van-floating-panel').css('boxShadow', 'none');
625 + this.resetMarkStyle();
617 } 626 }
618 } 627 }
619 } 628 }
......