|
@@ -1,7 +1,25 @@
|
|
|
<template>
|
|
|
<div class="map-layout">
|
|
|
+
|
|
|
<Teleport to=".header" v-if="isMounted">
|
|
|
<div class="custom_bar">
|
|
|
+ <div class="back_container">
|
|
|
+ <el-button :icon="Back" circle type="default" @click="router.back()" />
|
|
|
+ </div>
|
|
|
+ <div class="nav_container">
|
|
|
+ <div class="nav_item " :class="{ active: isCurrentTab(0) }" @click="handleTabs(0)">
|
|
|
+ <el-icon size="20">
|
|
|
+ <LocationInformation />
|
|
|
+ </el-icon>
|
|
|
+ <span>坐标</span>
|
|
|
+ </div>
|
|
|
+ <div class="nav_item" :class="{ active: isCurrentTab(1) }" @click="handleTabs(1)">
|
|
|
+ <el-icon size="20">
|
|
|
+ <Grid />
|
|
|
+ </el-icon>
|
|
|
+ <span>矢量图</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
</div>
|
|
|
</Teleport>
|
|
@@ -15,8 +33,21 @@
|
|
|
<div class="board" ref="boardContainer"></div>
|
|
|
</div>
|
|
|
<div class="right-control">
|
|
|
- <MapRight @fly-point="flyScenePoint" @fly-scene="flyScene" @goto-point="gotoPointPage" />
|
|
|
+ <MapRight v-if="isCurrentTab(0)" @fly-point="flyScenePoint" @fly-scene="flyScene" @goto-point="gotoPointPage" />
|
|
|
+ <MapRightPoly v-if="isCurrentTab(1)"></MapRightPoly>
|
|
|
</div>
|
|
|
+
|
|
|
+ <Teleport to="body" v-if="isMounted">
|
|
|
+ <div class="draw-global-icon" v-if="isCurrentTab(1)" @click="handleBoardDraw">
|
|
|
+ <el-icon size="30">
|
|
|
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
|
+ <path fill="currentColor"
|
|
|
+ d="M2 4.621a.5.5 0 0 1 .854-.353l6.01 6.01c.126.126.17.31.15.487a2 2 0 1 0 1.751-1.751a.586.586 0 0 1-.487-.15l-6.01-6.01A.5.5 0 0 1 4.62 2H11a9 9 0 0 1 8.468 12.054l2.24 2.239a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.415 0l-2.239-2.239A9 9 0 0 1 2 11z" />
|
|
|
+ </svg>
|
|
|
+ </el-icon>
|
|
|
+ </div>
|
|
|
+ </Teleport>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -26,9 +57,15 @@ import { router, setDocTitle } from "@/router";
|
|
|
import { Manage } from "./openlayer";
|
|
|
import { ScenePoint, Scene, scenePoints, scenes } from "@/store/scene";
|
|
|
import { initRelics, initSelfRelics, relics } from "@/store/relics";
|
|
|
-import { onMounted, ref, watchEffect, watch, onUnmounted } from "vue";
|
|
|
+import { onMounted, ref, watchEffect, watch, onUnmounted, computed } from "vue";
|
|
|
import { createBoard, scenePosTransform } from "./board";
|
|
|
+import MapRightPoly from "./map-right-poly.vue";
|
|
|
+import { Back } from "@element-plus/icons-vue";
|
|
|
import { relicsPolyginsFetch } from "@/request";
|
|
|
+import {
|
|
|
+ Grid,
|
|
|
+ LocationInformation,
|
|
|
+} from "@element-plus/icons-vue";
|
|
|
|
|
|
import {
|
|
|
mapManageInit,
|
|
@@ -38,6 +75,8 @@ import {
|
|
|
tileType,
|
|
|
} from "./map-flow";
|
|
|
|
|
|
+const relicsId = computed(() => router.currentRoute.value.params.relicsId || '')
|
|
|
+
|
|
|
const gotoPointPage = (point: ScenePoint) => {
|
|
|
router.push({
|
|
|
name: router.currentRoute.value.name === "map" ? "pano" : "query-pano",
|
|
@@ -46,6 +85,10 @@ const gotoPointPage = (point: ScenePoint) => {
|
|
|
};
|
|
|
|
|
|
const isMounted = ref(false)
|
|
|
+const currentTab = ref(0);
|
|
|
+const isCurrentTab = ref((index: number) => currentTab.value === index)
|
|
|
+
|
|
|
+
|
|
|
|
|
|
const autoInitPos = () => {
|
|
|
const scene = scenes.value.find(
|
|
@@ -97,7 +140,7 @@ watch(
|
|
|
const points = scenePosTransform(scenes.value);
|
|
|
board.setData(
|
|
|
{
|
|
|
- points,
|
|
|
+ points: points,
|
|
|
lines: [],
|
|
|
polygons: [],
|
|
|
},
|
|
@@ -155,16 +198,50 @@ const boardContainer = ref<HTMLDivElement>();
|
|
|
let mapManage: Manage;
|
|
|
let board: ReturnType<typeof createBoard>;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
mapManage = mapManageInit(mapContainer.value!);
|
|
|
board = (window as any).board = boardInit(boardContainer.value!, mapManage);
|
|
|
isMounted.value = true
|
|
|
+
|
|
|
+ const borardPolyData = computed(() => board.getData());
|
|
|
+
|
|
|
+ watch(borardPolyData, (updater) => {
|
|
|
+ if (updater) {
|
|
|
+ console.log('borardPolyData', updater);
|
|
|
+ console.log('borardPolyData', JSON.stringify(updater));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }, { immediate: true, deep: true })
|
|
|
});
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
mapManage.map.dispose();
|
|
|
board.destory();
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
+const handleTabs = (index: number) => {
|
|
|
+ currentTab.value = index
|
|
|
+}
|
|
|
+
|
|
|
+const handleBoardDraw = () => {
|
|
|
+
|
|
|
+ console.log('handleBoardDraw--开始start draw', String(relicsId.value), board.polygon())
|
|
|
+ try {
|
|
|
+ board.polygon().editPolygon();
|
|
|
+ // const endHandler = board.polygon().editPolygon();
|
|
|
+
|
|
|
+ } catch (error) {
|
|
|
+ console.error('error', error)
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
@@ -277,5 +354,71 @@ onUnmounted(() => {
|
|
|
height: 100vh;
|
|
|
background-color: white;
|
|
|
|
|
|
+ // padding-top: 76px;
|
|
|
+ .back_container {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ color: #606266;
|
|
|
+ height: 76px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav_container {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ color: #606266;
|
|
|
+
|
|
|
+ .nav_item {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ padding: 10px 0;
|
|
|
+ cursor: pointer;
|
|
|
+ user-select: none;
|
|
|
+ width: 100%;
|
|
|
+
|
|
|
+ span {
|
|
|
+ line-height: 26px;
|
|
|
+ font-size: 13px;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.active {
|
|
|
+ color: #409EFF;
|
|
|
+ background-color: #ECF5FF;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ &::before {
|
|
|
+ content: "";
|
|
|
+ height: 100%;
|
|
|
+ width: 4px;
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ background-color: #409EFF;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+.draw-global-icon {
|
|
|
+ width: 64px;
|
|
|
+ height: 64px;
|
|
|
+ background: #FFFFFF;
|
|
|
+ border-radius: 50%;
|
|
|
+ position: fixed;
|
|
|
+ z-index: 1000;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ left: 50%;
|
|
|
+ top: 90%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ cursor: pointer;
|
|
|
+ color: #409EFF;
|
|
|
}
|
|
|
</style>
|