bill 1 месяц назад
Родитель
Сommit
fc4b0fff17
5 измененных файлов с 40 добавлено и 4 удалено
  1. 3 0
      src/sdk/types/sdk.ts
  2. 4 0
      src/store/reshoot.ts
  3. 16 2
      src/store/sync.ts
  4. 14 1
      src/views/scene/container.vue
  5. 3 1
      src/views/scene/menus/actions.ts

+ 3 - 0
src/sdk/types/sdk.ts

@@ -515,6 +515,9 @@ export type EditCrop = {
 export type LaserSDK = {
   map: Map;
   scene: Scene;
+  initReshoot(data: any): any;
+  reshoot(data: any): any;
+  delReshoot(data: any): any;
   enterDatasetsManage: () => any;
   enterTopView: () => any;
   leaveTopView: () => any;

+ 4 - 0
src/store/reshoot.ts

@@ -0,0 +1,4 @@
+import { Pos3D } from "@/sdk";
+import { ref } from "vue";
+
+export const reshootData = ref<{ image: string; position: Pos3D }[]>([]);

+ 16 - 2
src/store/sync.ts

@@ -23,6 +23,7 @@ import { sceneSeting } from "./sceneSeting";
 import { tables } from "./tables";
 import { drawSetting } from "./drawSetting";
 import { Pos3D } from "@/sdk";
+import { reshootData } from "./reshoot";
 
 const global = window as any;
 
@@ -133,6 +134,8 @@ export const api = !global.android
         return router.push({ name: writeRouteName.scene });
       },
       async reshoot(pos: Pos3D) {
+        console.log("reshoot参数:");
+        console.log(JSON.stringify(pos));
         await asyncTimeout(5000);
         return "";
       },
@@ -306,6 +309,19 @@ export const back = () => {
 
 const loadStore = async () => {
   const data: any = await api.getStore();
+  if (params.temp) {
+    try {
+      const str = await api.getFile("panoReshot.json");
+      const data = await (await fetch(str).then()).text();
+      reshootData.value = JSON.parse(data).map((item) => ({
+        ...item,
+        position: JSON.parse(item.position),
+      }));
+    } catch (e) {
+      console.error(e);
+      reshootData.value = [];
+    }
+  }
   list.value = data?.measures || [];
   baseLines.value = data?.baseLines || [];
   basePoints.value = data?.basePoints || [];
@@ -317,8 +333,6 @@ const loadStore = async () => {
   uses.value = data?.uses || defaultUses;
   tables.value = data?.tables || {};
   drawSetting.value = data?.drawSetting || {};
-
-  syncSceneStore();
 };
 
 export const updateSceneStore = debounce(api.setStore, 300);

+ 14 - 1
src/views/scene/container.vue

@@ -9,13 +9,21 @@
 
 <script setup lang="ts">
 import { onActivated, onDeactivated, onMounted, ref, watchEffect } from "vue";
-import { customMap, disabledMap, setupLaser, useLoading, useParams } from "@/hook";
+import {
+  customMap,
+  disabledMap,
+  params,
+  setupLaser,
+  useLoading,
+  useParams,
+} from "@/hook";
 import { store } from "@/store";
 import { currentApp } from "@/store/app";
 import { Loading } from "@kankan/components/index";
 import { LaserSDK, Mode, SeSceneCropSetting } from "@/sdk";
 import { api } from "@/store/sync";
 import { sceneSeting } from "@/store/sceneSeting";
+import { reshootData } from "@/store/reshoot";
 
 const emit = defineEmits<{ (e: "loaded"): void }>();
 const sceneLayoutRef = ref<HTMLCanvasElement>();
@@ -52,6 +60,11 @@ onMounted(async () => {
     })
   );
 
+  if (params.temp) {
+    console.log("-->", reshootData.value);
+    reshootData.value.forEach((data) => sdk.reshoot && sdk.reshoot(data));
+  }
+
   console.error("sdk loaded");
   emit("loaded");
 

+ 3 - 1
src/views/scene/menus/actions.ts

@@ -387,11 +387,13 @@ const menuActions = {
     };
   },
   [menuEnum.DEL_RESHOOT]: genUseLoading(async () => {
-    const pano = useSDK().getCurrentPano();
+    const sdk = useSDK();
+    const pano = sdk.getCurrentPano();
     if (!pano) {
       return Message.success({ msg: "当前位置不存在全景图", time: 2000 });
     }
     await api.delPano(pano);
+    sdk.delReshoot({ image: pano.image });
   }),
 };