bill 1 jaar geleden
bovenliggende
commit
9c361a1244
5 gewijzigde bestanden met toevoegingen van 69 en 12 verwijderingen
  1. 1 1
      index.html
  2. BIN
      public/wbyh.ico
  3. 13 6
      src/components/tex-tooltip.vue
  4. 7 5
      src/view/map/map-right.vue
  5. 48 0
      src/view/map/map.vue

+ 1 - 1
index.html

@@ -3,7 +3,7 @@
 
 <head>
   <meta charset="UTF-8" />
-  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
+  <link rel="icon" type="image/svg+xml" href="/wbyh.ico" />
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>不可移动文物管理平台</title>
 </head>

BIN
public/wbyh.ico


+ 13 - 6
src/components/tex-tooltip.vue

@@ -1,6 +1,12 @@
 <template>
   <span class="text" v-if="!sample" ref="dom">{{ text }}</span>
-  <el-tooltip class="box-item" effect="dark" :content="text" placement="top" v-else>
+  <el-tooltip
+    class="box-item"
+    :content="text"
+    placement="top"
+    popper-class="sample-tip"
+    v-else
+  >
     <span class="text sample">{{ text }}</span>
   </el-tooltip>
 </template>
@@ -18,10 +24,6 @@ const initSample = () => {
   if (dom.value) {
     timeId = setTimeout(() => {
       sample.value = dom.value!.offsetHeight > 50;
-      if (sample.value) {
-        console.log(dom.value);
-      }
-      console.log(sample.value);
     }, 100);
   }
 };
@@ -29,7 +31,6 @@ const initSample = () => {
 onMounted(initSample);
 onUnmounted(() => {
   window.removeEventListener("resize", initSample);
-  console.log("remove");
 });
 window.addEventListener("resize", initSample);
 </script>
@@ -49,3 +50,9 @@ window.addEventListener("resize", initSample);
   -webkit-box-orient: vertical;
 }
 </style>
+
+<style>
+.sample-tip {
+  max-width: 500px;
+}
+</style>

+ 7 - 5
src/view/map/map-right.vue

@@ -46,7 +46,8 @@
               </el-tooltip>
               <span :class="{ disable: data.disable }" class="title" v-else>
                 <el-icon>
-                  <LocationInformation />
+                  <LocationInformation v-if="!data.disable" />
+                  <DeleteLocation v-else />
                 </el-icon>
                 {{ node.label }}
               </span>
@@ -77,7 +78,7 @@
 
     <el-button
       type="primary"
-      :icon="Document"
+      :icon="Download"
       style="width: 100%"
       @click="exportFile(getSelectPoints(), 2)"
     >
@@ -85,7 +86,7 @@
     </el-button>
     <el-button
       type="primary"
-      :icon="Document"
+      :icon="Download"
       style="width: 100%; margin-top: 20px; margin-left: 0"
       @click="exportFile(getSelectPoints(), 1)"
     >
@@ -94,7 +95,7 @@
 
     <el-button
       type="primary"
-      :icon="Document"
+      :icon="Download"
       style="width: 100%; margin-top: 20px; margin-left: 0"
       @click="exportImage(getSelectPoints(), relics?.name)"
     >
@@ -115,9 +116,10 @@
 import {
   Plus,
   Delete,
-  Document,
   Grid,
+  Download,
   LocationInformation,
+  DeleteLocation,
   Edit,
   Link,
 } from "@element-plus/icons-vue";

+ 48 - 0
src/view/map/map.vue

@@ -52,11 +52,13 @@ import { ScenePoint, Scene, scenePoints, scenes } from "@/store/scene";
 import { initRelics, initSelfRelics, relics } from "@/store/relics";
 import { computed, onMounted, ref, watchEffect, watch } from "vue";
 import { Manage } from "./manage";
+import ScaleLine from "ol/control/ScaleLine";
 
 const activeId = ref<ScenePoint["id"] | null>();
 const active = computed(() =>
   scenePoints.value.find((point) => point.id === activeId.value)
 );
+
 const activePixel = ref<number[] | null>();
 const triggerRef = ref({
   getBoundingClientRect() {
@@ -123,6 +125,24 @@ onMounted(async () => {
   });
   refreshHots();
   refreshTileType();
+  const scaleLine = new ScaleLine({
+    className: "scale-view",
+    maxWidth: 150,
+    minWidth: 100,
+    units: "metric",
+  });
+  // 加载比例尺
+  mapManage.map.addControl(scaleLine);
+  watch(
+    tileType,
+    (type) => {
+      const el = (scaleLine as any).element as HTMLDivElement;
+      el.classList.add(type === "影像底图" ? "light" : "dark");
+      el.classList.remove(type === "影像底图" ? "dark" : "light");
+      console.log(el, type);
+    },
+    { flush: "post", immediate: true }
+  );
 });
 
 const activeScenePoint = (point: ScenePoint) => {
@@ -257,4 +277,32 @@ watchEffect(() => {
   right: 10px;
   top: 10px;
 }
+
+.scale-view {
+  --color: #fff;
+  position: absolute;
+  left: 20px;
+  bottom: 20px;
+  height: 8px;
+  color: var(--color);
+  text-align: center;
+  border: 1px solid var(--color);
+  border-top: none;
+  z-index: 1;
+  font-size: 14px;
+  display: flex;
+  align-items: end;
+  &.light {
+    --color: #fff;
+    > div {
+      text-shadow: 0 0 2px #000;
+    }
+  }
+  &.dark {
+    --color: #000;
+    > div {
+      text-shadow: 0 0 2px #fff;
+    }
+  }
+}
 </style>