hookehuyr

3D地图优化处理

...@@ -20,9 +20,11 @@ declare module '@vue/runtime-core' { ...@@ -20,9 +20,11 @@ declare module '@vue/runtime-core' {
20 SvgIcon: typeof import('./src/components/Floor/svgIcon.vue')['default'] 20 SvgIcon: typeof import('./src/components/Floor/svgIcon.vue')['default']
21 VanCol: typeof import('vant/es')['Col'] 21 VanCol: typeof import('vant/es')['Col']
22 VanDialog: typeof import('vant/es')['Dialog'] 22 VanDialog: typeof import('vant/es')['Dialog']
23 + VanField: typeof import('vant/es')['Field']
23 VanIcon: typeof import('vant/es')['Icon'] 24 VanIcon: typeof import('vant/es')['Icon']
24 VanImage: typeof import('vant/es')['Image'] 25 VanImage: typeof import('vant/es')['Image']
25 VanPopup: typeof import('vant/es')['Popup'] 26 VanPopup: typeof import('vant/es')['Popup']
26 VanRow: typeof import('vant/es')['Row'] 27 VanRow: typeof import('vant/es')['Row']
28 + VanSearch: typeof import('vant/es')['Search']
27 } 29 }
28 } 30 }
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
33 "unplugin-vue-components": "^0.24.1", 33 "unplugin-vue-components": "^0.24.1",
34 "uuid": "^8.3.2", 34 "uuid": "^8.3.2",
35 "v-viewer": "^3.0.11", 35 "v-viewer": "^3.0.11",
36 - "vant": "^4.0.0-alpha.3", 36 + "vant": "^4.6.3",
37 "vconsole": "^3.14.6", 37 "vconsole": "^3.14.6",
38 "video.js": "^8.3.0", 38 "video.js": "^8.3.0",
39 "vite-plugin-dynamic-import": "^0.9.6", 39 "vite-plugin-dynamic-import": "^0.9.6",
......
1 <!-- 1 <!--
2 * @Date: 2023-07-27 11:04:04 2 * @Date: 2023-07-27 11:04:04
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-07-28 13:42:20 4 + * @LastEditTime: 2023-07-31 14:49:42
5 * @FilePath: /map-demo/src/components/Floor/index.vue 5 * @FilePath: /map-demo/src/components/Floor/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -18,12 +18,20 @@ ...@@ -18,12 +18,20 @@
18 <div @click="onCloseLevel" style="position: absolute; z-index: 100; top: 0; right: 100px; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; padding: 1.5em 1em; text-align: center;"> 18 <div @click="onCloseLevel" style="position: absolute; z-index: 100; top: 0; right: 100px; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; padding: 1.5em 1em; text-align: center;">
19 关闭图层 19 关闭图层
20 </div> 20 </div>
21 + <div v-if="level_show" style="position: absolute; z-index: 100; top: 50px; right: 0; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; padding: 1.5em 1em; text-align: center;">
22 + <span @click="switchFloor('left')"><van-icon name="arrow-left" /></span>
23 + <span>&nbsp;切换&nbsp;</span>
24 + <span @click="switchFloor('right')"><van-icon name="arrow" /></span>
25 + </div>
26 + <div @click="onSearch" style="position: absolute; z-index: 100; top: 50px; right: 100px; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; padding: 1.5em 1em; text-align: center;">
27 + 搜索
28 + </div>
21 <div class="mall"> 29 <div class="mall">
22 <!-- <div class="surroundings"> 30 <!-- <div class="surroundings">
23 <img class="surroundings__map" src="./surroundings.svg" alt="Surroundings" /> 31 <img class="surroundings__map" src="./surroundings.svg" alt="Surroundings" />
24 </div> --> 32 </div> -->
25 <div class="levels"> 33 <div class="levels">
26 - <div @click="onClick(1)" class="level level--1" aria-label="Level 1"> 34 + <div @click="onFloorClick(1)" class="level level--1" aria-label="Level 1">
27 <svg class="map map--1" viewBox="0 0 1200 800" width="100%" height="100%" preserveAspectRatio="xMidYMid meet"> 35 <svg class="map map--1" viewBox="0 0 1200 800" width="100%" height="100%" preserveAspectRatio="xMidYMid meet">
28 <title>Map Level 1</title> 36 <title>Map Level 1</title>
29 <polygon 37 <polygon
...@@ -185,7 +193,7 @@ ...@@ -185,7 +193,7 @@
185 </div> 193 </div>
186 <!-- /level__pins --> 194 <!-- /level__pins -->
187 </div> 195 </div>
188 - <div @click="onClick(2)" class="level level--2" aria-label="Level 2"> 196 + <div @click="onFloorClick(2)" class="level level--2" aria-label="Level 2">
189 <svg class="map map--2" viewBox="0 0 1200 800" width="100%" height="100%" preserveAspectRatio="xMidYMid meet"> 197 <svg class="map map--2" viewBox="0 0 1200 800" width="100%" height="100%" preserveAspectRatio="xMidYMid meet">
190 <title>Map Level 2</title> 198 <title>Map Level 2</title>
191 <polygon points="1035.94 787.41 1035.94 423.16 855.37 423.16 855.37 350.52 1187.28 350.52 1187.28 12.59 548.09 12.59 548.09 68.87 437.36 68.87 437.36 12.59 49.37 12.59 49.37 366.5 12.72 366.5 12.72 787.41 356.2 787.41 414.93 584.41 554.4 584.41 627.81 787.41 1035.94 787.41" class="map__ground" /> 199 <polygon points="1035.94 787.41 1035.94 423.16 855.37 423.16 855.37 350.52 1187.28 350.52 1187.28 12.59 548.09 12.59 548.09 68.87 437.36 68.87 437.36 12.59 49.37 12.59 49.37 366.5 12.72 366.5 12.72 787.41 356.2 787.41 414.93 584.41 554.4 584.41 627.81 787.41 1035.94 787.41" class="map__ground" />
...@@ -261,7 +269,7 @@ ...@@ -261,7 +269,7 @@
261 </a> 269 </a>
262 </div> 270 </div>
263 </div> 271 </div>
264 - <div @click="onClick(3)" class="level level--3" aria-label="Level 3"> 272 + <div @click="onFloorClick(3)" class="level level--3" aria-label="Level 3">
265 <svg class="map map--3" viewBox="0 0 1200 800" width="100%" height="100%" preserveAspectRatio="xMidYMid meet"> 273 <svg class="map map--3" viewBox="0 0 1200 800" width="100%" height="100%" preserveAspectRatio="xMidYMid meet">
266 <title>Map Level 3</title> 274 <title>Map Level 3</title>
267 <polygon points="1035.94 787.41 1035.94 423.16 855.37 423.16 855.37 350.52 1187.28 350.52 1187.28 12.59 548.09 12.59 548.09 68.87 437.36 68.87 437.36 12.59 49.37 12.59 49.37 366.5 12.72 366.5 12.72 787.41 356.2 787.41 414.93 584.41 554.4 584.41 627.81 787.41 1035.94 787.41" class="map__ground" /> 275 <polygon points="1035.94 787.41 1035.94 423.16 855.37 423.16 855.37 350.52 1187.28 350.52 1187.28 12.59 548.09 12.59 548.09 68.87 437.36 68.87 437.36 12.59 49.37 12.59 49.37 366.5 12.72 366.5 12.72 787.41 356.2 787.41 414.93 584.41 554.4 584.41 627.81 787.41 1035.94 787.41" class="map__ground" />
...@@ -330,7 +338,7 @@ ...@@ -330,7 +338,7 @@
330 </a> 338 </a>
331 </div> 339 </div>
332 </div> 340 </div>
333 - <div @click="onClick(4)" class="level level--4" aria-label="Level 4"> 341 + <div @click="onFloorClick(4)" class="level level--4" aria-label="Level 4">
334 <svg class="map map--4" viewBox="0 0 1200 800" width="100%" height="100%" preserveAspectRatio="xMidYMid meet"> 342 <svg class="map map--4" viewBox="0 0 1200 800" width="100%" height="100%" preserveAspectRatio="xMidYMid meet">
335 <title>Map Level 2</title> 343 <title>Map Level 2</title>
336 <polygon points="1035.94 787.41 1035.94 423.16 855.37 423.16 855.37 350.52 1187.28 350.52 1187.28 12.59 548.09 12.59 548.09 68.87 437.36 68.87 437.36 12.59 49.37 12.59 49.37 366.5 12.72 366.5 12.72 787.41 356.2 787.41 414.93 584.41 554.4 584.41 627.81 787.41 1035.94 787.41" class="map__ground" /> 344 <polygon points="1035.94 787.41 1035.94 423.16 855.37 423.16 855.37 350.52 1187.28 350.52 1187.28 12.59 548.09 12.59 548.09 68.87 437.36 68.87 437.36 12.59 49.37 12.59 49.37 366.5 12.72 366.5 12.72 787.41 356.2 787.41 414.93 584.41 554.4 584.41 627.81 787.41 1035.94 787.41" class="map__ground" />
...@@ -406,16 +414,51 @@ ...@@ -406,16 +414,51 @@
406 </div> 414 </div>
407 </div> 415 </div>
408 416
409 - <van-popup v-model:show="show_popup" position="bottom" @close="onClickCloseIcon" :overlay="false" :style="{ height: '40%', background: '#FFF' }"> 417 + <van-popup v-model:show="show_popup" position="bottom" :overlay="false" :style="{ height: '50%', background: '#FFF' }">
410 <div @click="show_popup=false" style="text-align: right; padding: 1rem;"> 418 <div @click="show_popup=false" style="text-align: right; padding: 1rem;">
411 <van-icon name="cross" size="1.5rem" /> 419 <van-icon name="cross" size="1.5rem" />
412 </div> 420 </div>
413 <div style="margin: 0 1rem"> 421 <div style="margin: 0 1rem">
414 - Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repudiandae officia amet eveniet labore voluptatem nisi, ullam dolores placeat nobis necessitatibus, corporis magnam quos. Officiis quam perspiciatis voluptate autem hic nobis. 422 + <div style="font-size: 1.25rem; margin-bottom: 1rem;">大雄宝殿</div>
423 + <div>
424 + 大雄宝殿是寺院的中心建筑,兴建于清末民初时期。重檐歇山,面阔七楹,飞檐翘角,气势雄伟,风格挺秀。梁枋均施苏式彩绘,典雅富丽,绚丽夺目。
425 + </div>
415 </div> 426 </div>
416 </van-popup> 427 </van-popup>
417 428
418 <svg-icon></svg-icon> 429 <svg-icon></svg-icon>
430 +
431 + <van-popup v-model:show="show_search_popup" position="right" :overlay="true" :style="{ height: '100%', width: '80%', background: '#FFF' }">
432 + <div style="background-color: #F7f8fa; padding: 1rem;">
433 + <van-field v-model="search_value" placeholder="请输入搜索关键词" style="border-radius: 5px; padding: 0.5rem 1rem;" />
434 + </div>
435 + <div class="search_box">
436 + <div class="search_box_title">4-客房</div>
437 + <div>
438 + <van-row @click="onSearchRow(4.01)" style="color: #aaa; margin-bottom: 0.5rem;">
439 + <van-col span="20">401~410室</van-col>
440 + <van-col span="4" style="text-align: right;">L1</van-col>
441 + </van-row>
442 + <van-row @click="onSearchRow(4.02)" style="color: #aaa; margin-bottom: 0.5rem;">
443 + <van-col span="20">411~419室</van-col>
444 + <van-col span="4" style="text-align: right;">L1</van-col>
445 + </van-row>
446 + </div>
447 + </div>
448 + <div style="padding: 1rem;">
449 + <div style="color: #000; margin-bottom: 1rem; font-size: 1.15rem;">3-客房</div>
450 + <div>
451 + <van-row @click="onSearchRow(3.01)" style="color: #aaa; margin-bottom: 0.5rem;">
452 + <van-col span="20">301~310室</van-col>
453 + <van-col span="4" style="text-align: right;">L1</van-col>
454 + </van-row>
455 + <van-row @click="onSearchRow(3.02)" style="color: #aaa; margin-bottom: 0.5rem;">
456 + <van-col span="20">311~319室</van-col>
457 + <van-col span="4" style="text-align: right;">L1</van-col>
458 + </van-row>
459 + </div>
460 + </div>
461 + </van-popup>
419 </div> 462 </div>
420 </template> 463 </template>
421 464
...@@ -428,21 +471,26 @@ export default { ...@@ -428,21 +471,26 @@ export default {
428 data() { 471 data() {
429 return { 472 return {
430 level_show: '', 473 level_show: '',
474 + search_value: '',
431 show_popup: false, 475 show_popup: false,
476 + show_search_popup: false,
432 } 477 }
433 }, 478 },
434 async mounted() { 479 async mounted() {
435 // 绑定选择点后回调 480 // 绑定选择点后回调
436 $('.level__pins').children('.pin').on('click', (evt) => { 481 $('.level__pins').children('.pin').on('click', (evt) => {
437 - $('.level__pins').children('.pin').each((index, ele) => { 482 + this.clearPinShow();
438 - $(ele).removeClass('pin--active');
439 - })
440 $(evt.currentTarget).addClass('pin--active'); 483 $(evt.currentTarget).addClass('pin--active');
441 this.show_popup = true; 484 this.show_popup = true;
442 }); 485 });
443 }, 486 },
444 methods: { 487 methods: {
445 - onClick(level) { 488 + clearPinShow () {
489 + $('.level__pins').children('.pin').each((index, ele) => {
490 + $(ele).removeClass('pin--active');
491 + })
492 + },
493 + onFloorClick(level) {
446 this.level_show = level; 494 this.level_show = level;
447 $('.mall').addClass('mall--content-open'); 495 $('.mall').addClass('mall--content-open');
448 $('.levels').addClass('levels--open').addClass(`levels--selected-${level}`); 496 $('.levels').addClass('levels--open').addClass(`levels--selected-${level}`);
...@@ -457,14 +505,53 @@ export default { ...@@ -457,14 +505,53 @@ export default {
457 $(`.level--${level}`).removeClass('level--current'); 505 $(`.level--${level}`).removeClass('level--current');
458 $(`.level--${level} .level__pins`).removeClass('level__pins--active'); 506 $(`.level--${level} .level__pins`).removeClass('level__pins--active');
459 this.level_show = ''; 507 this.level_show = '';
508 + this.clearPinShow();
460 }, 509 },
461 onClose () { 510 onClose () {
462 this.$emit('close') 511 this.$emit('close')
463 }, 512 },
464 onClickCloseIcon () { 513 onClickCloseIcon () {
514 + this.clearPinShow();
515 + },
516 + switchFloor (type) { // 切换楼层
517 + let level = this.level_show;
518 + if (type === 'right') {
519 + level = level - 1 < 1 ? 1 : level - 1;
520 + }
521 + if (type === 'left') {
522 + level = level + 1 > 4 ? 4 : level + 1;
523 + }
524 + this.onCloseLevel();
525 + this.onFloorClick(level);
526 + },
527 + onSearch () {
528 + this.show_search_popup = true;
529 + },
530 + onSearchRow (val) {
531 + // 清空图层显示
532 + this.onCloseLevel();
533 + this.show_popup = false;
534 + // 测试锚点
535 + let currentTarget = null;
536 + let category = null;
465 $('.level__pins').children('.pin').each((index, ele) => { 537 $('.level__pins').children('.pin').each((index, ele) => {
538 + let space = $(ele).data('space'); // 锚点标记
539 + if (space === val) { // 匹配符合的dom节点
540 + category = parseInt(space);// 获取图层标记
541 + currentTarget = ele;
542 + }
466 $(ele).removeClass('pin--active'); 543 $(ele).removeClass('pin--active');
467 - }) 544 + });
545 + // 选择图层
546 + this.onFloorClick(category);
547 + // 选择锚点样式
548 + $(currentTarget).addClass('pin--active');
549 + setTimeout(() => {
550 + // 打开锚点详情
551 + this.show_popup = true;
552 + }, 500);
553 + // 关闭搜索弹框
554 + this.show_search_popup = false;
468 } 555 }
469 } 556 }
470 } 557 }
...@@ -474,4 +561,11 @@ export default { ...@@ -474,4 +561,11 @@ export default {
474 .test { 561 .test {
475 opacity: 0; 562 opacity: 0;
476 } 563 }
564 +
565 + .search_box {
566 + padding: 1rem;
567 + .search_box_title {
568 + color: #000; margin-bottom: 1rem; font-size: 1.15rem;
569 + }
570 + }
477 </style> 571 </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-07-26 06:02:36 4 + * @LastEditTime: 2023-07-31 11:56:15
5 * @FilePath: /map-demo/src/views/index.vue 5 * @FilePath: /map-demo/src/views/index.vue
6 * @Description: 公众地图主体页面 6 * @Description: 公众地图主体页面
7 --> 7 -->
......
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-07-31 11:31:06 4 + * @LastEditTime: 2023-07-31 11:56:35
5 * @FilePath: /map-demo/src/views/inner.vue 5 * @FilePath: /map-demo/src/views/inner.vue
6 * @Description: 内部地图主体页面 6 * @Description: 内部地图主体页面
7 --> 7 -->
...@@ -277,7 +277,7 @@ export default { ...@@ -277,7 +277,7 @@ export default {
277 point_range: [ // 景区范围经纬度 277 point_range: [ // 景区范围经纬度
278 [120.585111, 31.316084], [120.585111, 31.316084], [120.589488, 31.313197], [120.585422, 31.313005] 278 [120.585111, 31.316084], [120.585111, 31.316084], [120.589488, 31.313197], [120.585422, 31.313005]
279 ], 279 ],
280 - show_floor_popup: false, 280 + show_floor_popup: true,
281 } 281 }
282 }, 282 },
283 async mounted() { 283 async mounted() {
......
...@@ -394,7 +394,7 @@ ...@@ -394,7 +394,7 @@
394 "@vue/compiler-ssr" "3.3.4" 394 "@vue/compiler-ssr" "3.3.4"
395 "@vue/shared" "3.3.4" 395 "@vue/shared" "3.3.4"
396 396
397 -"@vue/shared@3.3.4": 397 +"@vue/shared@3.3.4", "@vue/shared@^3.0.0":
398 version "3.3.4" 398 version "3.3.4"
399 resolved "https://mirrors.cloud.tencent.com/npm/@vue/shared/-/shared-3.3.4.tgz" 399 resolved "https://mirrors.cloud.tencent.com/npm/@vue/shared/-/shared-3.3.4.tgz"
400 integrity sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ== 400 integrity sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==
...@@ -3065,13 +3065,14 @@ v-viewer@^3.0.11: ...@@ -3065,13 +3065,14 @@ v-viewer@^3.0.11:
3065 lodash "^4.17.21" 3065 lodash "^4.17.21"
3066 viewerjs "^1.9.0" 3066 viewerjs "^1.9.0"
3067 3067
3068 -vant@^4.0.0-alpha.3: 3068 +vant@^4.6.3:
3069 - version "4.4.0" 3069 + version "4.6.3"
3070 - resolved "https://mirrors.cloud.tencent.com/npm/vant/-/vant-4.4.0.tgz" 3070 + resolved "https://mirrors.cloud.tencent.com/npm/vant/-/vant-4.6.3.tgz#e36a2dc2fa94253b8218094d88e9b0cd62b3437d"
3071 - integrity sha512-vVIVqZTmA425cbRhzY9krBfI1myknc1Sv3Kt9f4a1D+pTTSlodUhNhyPe3zttYdKnRl2thZg940CFGt65Rr5iQ== 3071 + integrity sha512-hkiBzM1dhEj9EWSjRnyB7gd6SiVa3/+qthNZtlJdj42C+pXIN+oq0UhKz5PRHWi8fHyPfycnqRzyvEJxouT+zw==
3072 dependencies: 3072 dependencies:
3073 "@vant/popperjs" "^1.3.0" 3073 "@vant/popperjs" "^1.3.0"
3074 "@vant/use" "^1.5.1" 3074 "@vant/use" "^1.5.1"
3075 + "@vue/shared" "^3.0.0"
3075 3076
3076 vconsole@^3.14.6: 3077 vconsole@^3.14.6:
3077 version "3.15.0" 3078 version "3.15.0"
......