Showing
3 changed files
with
73 additions
and
64 deletions
| ... | @@ -18,6 +18,7 @@ | ... | @@ -18,6 +18,7 @@ |
| 18 | "@photo-sphere-viewer/markers-plugin": "^5.7.3", | 18 | "@photo-sphere-viewer/markers-plugin": "^5.7.3", |
| 19 | "@photo-sphere-viewer/stereo-plugin": "^5.7.3", | 19 | "@photo-sphere-viewer/stereo-plugin": "^5.7.3", |
| 20 | "@photo-sphere-viewer/virtual-tour-plugin": "^5.7.3", | 20 | "@photo-sphere-viewer/virtual-tour-plugin": "^5.7.3", |
| 21 | + "@vant/touch-emulator": "^1.4.0", | ||
| 21 | "@videojs-player/vue": "^1.0.0", | 22 | "@videojs-player/vue": "^1.0.0", |
| 22 | "@vitejs/plugin-legacy": "^1.8.2", | 23 | "@vitejs/plugin-legacy": "^1.8.2", |
| 23 | "@vueuse/core": "^8.5.0", | 24 | "@vueuse/core": "^8.5.0", | ... | ... |
| 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 17:24:37 | 4 | + * @LastEditTime: 2024-09-18 18:39:01 |
| 5 | * @FilePath: /map-demo/src/views/bieyuan/map.vue | 5 | * @FilePath: /map-demo/src/views/bieyuan/map.vue |
| 6 | * @Description: 公众地图主体页面 | 6 | * @Description: 公众地图主体页面 |
| 7 | --> | 7 | --> |
| ... | @@ -9,7 +9,7 @@ | ... | @@ -9,7 +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 style="position: absolute; top: 2rem; right: 1rem; display: flex; flex-direction: column;"> | 11 | <div style="position: absolute; top: 2rem; right: 1rem; display: flex; flex-direction: column;"> |
| 12 | - <van-icon size="2rem" name="search" color="#DD7850" style="margin-bottom: 1rem;" /> | 12 | + <!-- <van-icon size="2rem" name="search" color="#DD7850" style="margin-bottom: 1rem;" /> --> |
| 13 | <van-image | 13 | <van-image |
| 14 | width="2rem" | 14 | width="2rem" |
| 15 | height="2rem" | 15 | height="2rem" |
| ... | @@ -35,13 +35,13 @@ | ... | @@ -35,13 +35,13 @@ |
| 35 | </div> | 35 | </div> |
| 36 | 36 | ||
| 37 | <van-config-provider :theme-vars="themeVars"> | 37 | <van-config-provider :theme-vars="themeVars"> |
| 38 | - <van-floating-panel v-model:height="info_height" :anchors="anchors" @height-change="onHeightChange" :content-draggable="true"> | 38 | + <van-floating-panel v-model:height="info_height" :anchors="anchors" @height-change="onHeightChange"> |
| 39 | - <template #header> | 39 | + <!-- <template #header> |
| 40 | <div class="custom-header"> | 40 | <div class="custom-header"> |
| 41 | <h3>自定义标题</h3> | 41 | <h3>自定义标题</h3> |
| 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"></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" /> |
| ... | @@ -52,6 +52,7 @@ | ... | @@ -52,6 +52,7 @@ |
| 52 | </template> | 52 | </template> |
| 53 | 53 | ||
| 54 | <script> | 54 | <script> |
| 55 | +import "@vant/touch-emulator"; | ||
| 55 | // import { mapState } from 'vuex' | 56 | // import { mapState } from 'vuex' |
| 56 | import coord from '@/common/map_data' | 57 | import coord from '@/common/map_data' |
| 57 | import my_router from '@/common/my_router' | 58 | import my_router from '@/common/my_router' |
| ... | @@ -145,8 +146,46 @@ export default { | ... | @@ -145,8 +146,46 @@ export default { |
| 145 | anchors: [0, (0.5 * window.innerHeight), (1 * window.innerHeight)], | 146 | anchors: [0, (0.5 * window.innerHeight), (1 * window.innerHeight)], |
| 146 | themeVars: { | 147 | themeVars: { |
| 147 | floatingPanelHeaderHeight: 0, | 148 | floatingPanelHeaderHeight: 0, |
| 149 | + floatingPanelBorderRadius: '1.25rem' | ||
| 148 | }, | 150 | }, |
| 149 | showClose: false, | 151 | showClose: false, |
| 152 | + markerStyle1: { // 未选中 | ||
| 153 | + //设置文本样式,Object 同 css 样式表 | ||
| 154 | + "padding": ".5rem .2rem .5rem .2rem", | ||
| 155 | + // "margin-bottom": "1rem", | ||
| 156 | + "border-radius": ".25rem", | ||
| 157 | + "background-color": "#DD7850", | ||
| 158 | + // "width": "1rem", | ||
| 159 | + // "border-width": 0, | ||
| 160 | + // "box-shadow": "0 2px 6px 0 rgba(114, 124, 245, .5)", | ||
| 161 | + // "text-align": "center", | ||
| 162 | + "font-size": "0.8rem", | ||
| 163 | + "color": "white", | ||
| 164 | + "writing-mode": "vertical-rl", | ||
| 165 | + "text-orientation": "mixed", | ||
| 166 | + "display": "flex", | ||
| 167 | + "justify-content": "center", | ||
| 168 | + "align-items": "center", | ||
| 169 | + }, | ||
| 170 | + markerStyle2: { // 选中 | ||
| 171 | + //设置文本样式,Object 同 css 样式表 | ||
| 172 | + "padding": ".5rem .2rem .5rem .2rem", | ||
| 173 | + // "margin-bottom": "1rem", | ||
| 174 | + "border-color": "#DD7850", | ||
| 175 | + "border-radius": ".25rem", | ||
| 176 | + "background-color": "#FFF", | ||
| 177 | + // "width": "1rem", | ||
| 178 | + // "border-width": 0, | ||
| 179 | + // "box-shadow": "0 2px 6px 0 rgba(114, 124, 245, .5)", | ||
| 180 | + // "text-align": "center", | ||
| 181 | + "font-size": "0.8rem", | ||
| 182 | + "color": "#DD7850", | ||
| 183 | + "writing-mode": "vertical-rl", | ||
| 184 | + "text-orientation": "mixed", | ||
| 185 | + "display": "flex", | ||
| 186 | + "justify-content": "center", | ||
| 187 | + "align-items": "center", | ||
| 188 | + }, | ||
| 150 | } | 189 | } |
| 151 | }, | 190 | }, |
| 152 | async mounted() { | 191 | async mounted() { |
| ... | @@ -192,7 +231,7 @@ export default { | ... | @@ -192,7 +231,7 @@ export default { |
| 192 | // setTimeout(() => { | 231 | // setTimeout(() => { |
| 193 | // this.info_height = (0.5 * window.innerHeight); | 232 | // this.info_height = (0.5 * window.innerHeight); |
| 194 | // // 浮动面板样式 | 233 | // // 浮动面板样式 |
| 195 | - // $('.van-floating-panel__content').css('borderRadius', '1rem'); | 234 | + // $('.van-floating-panel__content').css('borderRadius', '1.5rem'); |
| 196 | // }, 2000); | 235 | // }, 2000); |
| 197 | }, | 236 | }, |
| 198 | watch: { | 237 | watch: { |
| ... | @@ -247,24 +286,7 @@ export default { | ... | @@ -247,24 +286,7 @@ export default { |
| 247 | // draggable: true, //是否可拖拽 | 286 | // draggable: true, //是否可拖拽 |
| 248 | // cursor: "pointer", //指定鼠标悬停时的鼠标样式。 | 287 | // cursor: "pointer", //指定鼠标悬停时的鼠标样式。 |
| 249 | // angle: 10, //点标记的旋转角度 | 288 | // angle: 10, //点标记的旋转角度 |
| 250 | - style: { | 289 | + style: this.markerStyle1, |
| 251 | - //设置文本样式,Object 同 css 样式表 | ||
| 252 | - "padding": ".5rem .2rem .5rem .2rem", | ||
| 253 | - // "margin-bottom": "1rem", | ||
| 254 | - "border-radius": ".25rem", | ||
| 255 | - "background-color": "#DD7850", | ||
| 256 | - // "width": "1rem", | ||
| 257 | - // "border-width": 0, | ||
| 258 | - // "box-shadow": "0 2px 6px 0 rgba(114, 124, 245, .5)", | ||
| 259 | - // "text-align": "center", | ||
| 260 | - "font-size": "0.8rem", | ||
| 261 | - "color": "white", | ||
| 262 | - "writing-mode": "vertical-rl", | ||
| 263 | - "text-orientation": "mixed", | ||
| 264 | - "display": "flex", | ||
| 265 | - "justify-content": "center", | ||
| 266 | - "align-items": "center", | ||
| 267 | - }, | ||
| 268 | position: entity_info[i].position, //点标记在地图上显示的位置 | 290 | position: entity_info[i].position, //点标记在地图上显示的位置 |
| 269 | }); | 291 | }); |
| 270 | textMarker.setMap(this.map); //将文本标记设置到地图上 | 292 | textMarker.setMap(this.map); //将文本标记设置到地图上 |
| ... | @@ -278,46 +300,11 @@ export default { | ... | @@ -278,46 +300,11 @@ export default { |
| 278 | this.markerSum.forEach(item => { | 300 | this.markerSum.forEach(item => { |
| 279 | if (e.target.hS !== item.hS) { | 301 | if (e.target.hS !== item.hS) { |
| 280 | // 修改文本的样式 | 302 | // 修改文本的样式 |
| 281 | - item.setStyle({ | 303 | + item.setStyle(this.markerStyle1); |
| 282 | - //设置文本样式,Object 同 css 样式表 | ||
| 283 | - "padding": ".5rem .2rem .5rem .2rem", | ||
| 284 | - // "margin-bottom": "1rem", | ||
| 285 | - "border-radius": ".25rem", | ||
| 286 | - "background-color": "#DD7850", | ||
| 287 | - // "width": "1rem", | ||
| 288 | - // "border-width": 0, | ||
| 289 | - // "box-shadow": "0 2px 6px 0 rgba(114, 124, 245, .5)", | ||
| 290 | - // "text-align": "center", | ||
| 291 | - "font-size": "0.8rem", | ||
| 292 | - "color": "white", | ||
| 293 | - "writing-mode": "vertical-rl", | ||
| 294 | - "text-orientation": "mixed", | ||
| 295 | - "display": "flex", | ||
| 296 | - "justify-content": "center", | ||
| 297 | - "align-items": "center", | ||
| 298 | - }); | ||
| 299 | } | 304 | } |
| 300 | }) | 305 | }) |
| 301 | // 修改文本的样式 | 306 | // 修改文本的样式 |
| 302 | - e.target.setStyle({ | 307 | + e.target.setStyle(this.markerStyle2); |
| 303 | - //设置文本样式,Object 同 css 样式表 | ||
| 304 | - "padding": ".5rem .2rem .5rem .2rem", | ||
| 305 | - // "margin-bottom": "1rem", | ||
| 306 | - "border-color": "#DD7850", | ||
| 307 | - "border-radius": ".25rem", | ||
| 308 | - "background-color": "#FFF", | ||
| 309 | - // "width": "1rem", | ||
| 310 | - // "border-width": 0, | ||
| 311 | - // "box-shadow": "0 2px 6px 0 rgba(114, 124, 245, .5)", | ||
| 312 | - // "text-align": "center", | ||
| 313 | - "font-size": "0.8rem", | ||
| 314 | - "color": "#DD7850", | ||
| 315 | - "writing-mode": "vertical-rl", | ||
| 316 | - "text-orientation": "mixed", | ||
| 317 | - "display": "flex", | ||
| 318 | - "justify-content": "center", | ||
| 319 | - "align-items": "center", | ||
| 320 | - }); | ||
| 321 | 308 | ||
| 322 | // 修改文本内容 | 309 | // 修改文本内容 |
| 323 | // textMarker.setText('样式已修改'); | 310 | // textMarker.setText('样式已修改'); |
| ... | @@ -329,7 +316,8 @@ export default { | ... | @@ -329,7 +316,8 @@ export default { |
| 329 | // 打开浮动面板 | 316 | // 打开浮动面板 |
| 330 | this.info_height = (0.5 * window.innerHeight); | 317 | this.info_height = (0.5 * window.innerHeight); |
| 331 | // 浮动面板样式 | 318 | // 浮动面板样式 |
| 332 | - $('.van-floating-panel__content').css('borderRadius', '0.5rem'); | 319 | + $('.van-floating-panel__content').css('borderRadius', '1.25rem'); |
| 320 | + $('.van-floating-panel').css('boxShadow', '0 0 15px black'); | ||
| 333 | }) | 321 | }) |
| 334 | } | 322 | } |
| 335 | }); | 323 | }); |
| ... | @@ -582,6 +570,11 @@ export default { | ... | @@ -582,6 +570,11 @@ export default { |
| 582 | e.lnglat.getLat() + | 570 | e.lnglat.getLat() + |
| 583 | "]," | 571 | "]," |
| 584 | console.log(text); | 572 | console.log(text); |
| 573 | + // 关闭浮动面板 | ||
| 574 | + this.info_height = 0; | ||
| 575 | + $('.van-floating-panel').css('boxShadow', 'none'); | ||
| 576 | + // 还原样式 | ||
| 577 | + this.resetMarkStyle(); | ||
| 585 | }, | 578 | }, |
| 586 | scanQrcode() { | 579 | scanQrcode() { |
| 587 | wx.scanQRCode({ | 580 | wx.scanQRCode({ |
| ... | @@ -605,16 +598,22 @@ export default { | ... | @@ -605,16 +598,22 @@ export default { |
| 605 | path: '/bieyuan/info' | 598 | path: '/bieyuan/info' |
| 606 | }) | 599 | }) |
| 607 | } else { | 600 | } else { |
| 608 | - $('.van-floating-panel__content').css('borderRadius', '0.5rem'); | 601 | + $('.van-floating-panel__content').css('borderRadius', '1.25rem'); |
| 602 | + $('.van-floating-panel').css('boxShadow', 'none'); | ||
| 609 | this.showClose = false; | 603 | this.showClose = false; |
| 610 | } | 604 | } |
| 611 | }, | 605 | }, |
| 612 | closeFloatPanel () { | 606 | closeFloatPanel () { |
| 613 | this.info_height = (0.5 * window.innerHeight); | 607 | this.info_height = (0.5 * window.innerHeight); |
| 614 | - $('.van-floating-panel__content').css('borderRadius', '0.5rem'); | 608 | + $('.van-floating-panel__content').css('borderRadius', '1.25rem'); |
| 615 | this.showClose = false; | 609 | this.showClose = false; |
| 616 | // 关闭音频 | 610 | // 关闭音频 |
| 617 | this.$refs.pageInfo.outerStopAudio(); | 611 | this.$refs.pageInfo.outerStopAudio(); |
| 612 | + }, | ||
| 613 | + resetMarkStyle () { | ||
| 614 | + this.markerSum.forEach(item => { | ||
| 615 | + item.setStyle(this.markerStyle1); | ||
| 616 | + }) | ||
| 618 | } | 617 | } |
| 619 | } | 618 | } |
| 620 | } | 619 | } |
| ... | @@ -810,4 +809,8 @@ export default { | ... | @@ -810,4 +809,8 @@ export default { |
| 810 | padding: 10px; | 809 | padding: 10px; |
| 811 | background-color: #f7f8fa; | 810 | background-color: #f7f8fa; |
| 812 | } | 811 | } |
| 812 | + | ||
| 813 | +.van-floating-panel__header-bar { | ||
| 814 | + background: none; | ||
| 815 | +} | ||
| 813 | </style> | 816 | </style> | ... | ... |
| ... | @@ -269,6 +269,11 @@ | ... | @@ -269,6 +269,11 @@ |
| 269 | resolved "https://mirrors.cloud.tencent.com/npm/@vant/popperjs/-/popperjs-1.3.0.tgz" | 269 | resolved "https://mirrors.cloud.tencent.com/npm/@vant/popperjs/-/popperjs-1.3.0.tgz" |
| 270 | integrity sha512-hB+czUG+aHtjhaEmCJDuXOep0YTZjdlRR+4MSmIFnkCQIxJaXLQdSsR90XWvAI2yvKUI7TCGqR8pQg2RtvkMHw== | 270 | integrity sha512-hB+czUG+aHtjhaEmCJDuXOep0YTZjdlRR+4MSmIFnkCQIxJaXLQdSsR90XWvAI2yvKUI7TCGqR8pQg2RtvkMHw== |
| 271 | 271 | ||
| 272 | +"@vant/touch-emulator@^1.4.0": | ||
| 273 | + version "1.4.0" | ||
| 274 | + resolved "https://mirrors.cloud.tencent.com/npm/@vant/touch-emulator/-/touch-emulator-1.4.0.tgz#02420ca5f312a7eb6c36c349cbb8e80e6f29ff2f" | ||
| 275 | + integrity sha512-Zt+zISV0+wpOew2S1siOJ3G22y+hapHAKmXM+FhpvWzsRc4qahaYXatCAITuuXt0EcDp7WvEeTO4F7p9AtX/pw== | ||
| 276 | + | ||
| 272 | "@vant/use@^1.6.0": | 277 | "@vant/use@^1.6.0": |
| 273 | version "1.6.0" | 278 | version "1.6.0" |
| 274 | resolved "https://mirrors.cloud.tencent.com/npm/@vant/use/-/use-1.6.0.tgz#237df3091617255519552ca311ffdfea9de59001" | 279 | resolved "https://mirrors.cloud.tencent.com/npm/@vant/use/-/use-1.6.0.tgz#237df3091617255519552ca311ffdfea9de59001" | ... | ... |
-
Please register or login to post a comment