bill пре 1 година
родитељ
комит
a0ca27bdb6
4 измењених фајлова са 27 додато и 9 уклоњено
  1. 1 1
      src/view/map/map-right.vue
  2. 22 4
      src/view/map/map.vue
  3. 3 3
      src/view/map/pc4Helper.ts
  4. 1 1
      src/view/scene.vue

+ 1 - 1
src/view/map/map-right.vue

@@ -96,7 +96,7 @@
       type="primary"
       :icon="Document"
       style="width: 100%; margin-top: 20px; margin-left: 0"
-      @click="exportImage(getSelectPoints())"
+      @click="exportImage(getSelectPoints(), relics?.name)"
     >
       下载全景图
     </el-button>

+ 22 - 4
src/view/map/map.vue

@@ -1,10 +1,11 @@
 <template>
-  <div class="map-layout">
+  <div class="map-layout" @click="activeId = null">
     <div
       id="map"
       class="map-container"
       ref="container"
       :class="{ active: !!activeId }"
+      @click.stop
       @mousedown="activeId = null"
       @wheel="activeId = null"
     >
@@ -52,7 +53,6 @@ import { initRelics, initSelfRelics, relics } from "@/store/relics";
 import { computed, onMounted, ref, watchEffect, watch } from "vue";
 import { Manage } from "./manage";
 
-const center = [109.47293862712675, 30.26530938156551];
 const activeId = ref<ScenePoint["id"] | null>();
 const active = computed(() =>
   scenePoints.value.find((point) => point.id === activeId.value)
@@ -89,9 +89,23 @@ const gotoPoint = (point: ScenePoint) => {
   });
 };
 
+const flyUserCenter = () => {
+  navigator.geolocation.getCurrentPosition(
+    (pos) => {
+      mapManage.setCenter([pos.coords.longitude, pos.coords.latitude]);
+    },
+    () => console.error("获取中心位置失败"),
+    {
+      enableHighAccuracy: true,
+      timeout: 5000,
+      maximumAge: 0,
+    }
+  );
+};
+const center = [109.47293862712675, 30.26530938156551];
 const container = ref<HTMLDivElement>();
 let mapManage: Manage;
-onMounted(() => {
+onMounted(async () => {
   mapManage = createMap(container.value!);
   mapManage.setCenter(center);
   mapManage.hotsBus.on("active", (id) => {
@@ -165,7 +179,11 @@ watch(
         const scene = scenes.value.find(
           (scene) => !scene.scenePos.every((pos) => !pos.pos || pos.pos.length === 0)
         );
-        scene && flyScene(scene);
+        if (scene) {
+          flyScene(scene);
+        } else {
+          flyUserCenter();
+        }
       });
     }
   },

+ 3 - 3
src/view/map/pc4Helper.ts

@@ -43,7 +43,7 @@ export const exportFile = async (points: ScenePoint[], type: number) => {
   ElMessage.success("文件导出成功");
 };
 
-export const exportImage = async (points: ScenePoint[]) => {
+export const exportImage = async (points: ScenePoint[], name?: string) => {
   if (!points.length) {
     ElMessage.error("请选择要导出的点位");
     return;
@@ -51,7 +51,7 @@ export const exportImage = async (points: ScenePoint[]) => {
 
   openLoading();
   const zip = new JSZip();
-  const imgFolder = zip.folder("images")!;
+  const imgFolder = zip.folder(name || "images")!;
 
   const downloadImages = Promise.all(
     points.map((point) => {
@@ -70,7 +70,7 @@ export const exportImage = async (points: ScenePoint[]) => {
   await downloadImages;
 
   const content = await zip.generateAsync({ type: "blob" });
-  await saveAs(content, "images.zip");
+  await saveAs(content, `${name || "images"}.zip`);
   closeLoading();
 };
 

+ 1 - 1
src/view/scene.vue

@@ -98,7 +98,7 @@
         </el-table-column>
         <el-table-column label="点位数量" prop="shootCount"></el-table-column>
         <el-table-column label="拍摄位置" prop="gpsInfo"></el-table-column>
-        <el-table-column label="绑定账号" prop="userName"></el-table-column>
+        <!-- <el-table-column label="绑定账号" prop="userName"></el-table-column> -->
         <el-table-column label="状态" v-slot:default="{ row }">
           {{ SceneStatusDesc[(row.calcStatus as SceneStatus)] }}
         </el-table-column>