Bladeren bron

fix: 修改bug

bill 2 jaren geleden
bovenliggende
commit
39e3a04fce
2 gewijzigde bestanden met toevoegingen van 10 en 12 verwijderingen
  1. 5 10
      src/hook/useGraphic.ts
  2. 5 2
      src/views/graphic/header.vue

+ 5 - 10
src/hook/useGraphic.ts

@@ -1,12 +1,4 @@
-import {
-  computed,
-  nextTick,
-  reactive,
-  Ref,
-  ref,
-  watch,
-  watchEffect,
-} from "vue";
+import { computed, nextTick, reactive, Ref, ref, watch, watchEffect } from "vue";
 import { structureDraw } from "@/graphic";
 import VectorType from "@/graphic/enum/VectorType";
 import UIType from "@/graphic/enum/UIEvents";
@@ -14,7 +6,9 @@ import type { RoadPhoto } from "@/store/roadPhotos";
 import type { AccidentPhoto } from "@/store/accidentPhotos";
 import { api } from "@/store/sync";
 import { genUseLoading } from "./useLoading.js";
+import mitt from "mitt";
 
+export const bus = mitt();
 export type UITypeT = typeof UIType;
 export type VectorTypeT = typeof VectorType;
 export type FocusVector = {
@@ -58,10 +52,11 @@ export const loadData = genUseLoading(
     if (data) {
       oldId && drawRef.value.load.clear();
       console.log("load", data);
-      drawRef.value.load.load(data.data, {
+      await drawRef.value.load.load(data.data, {
         ...data.sceneData,
         backImage: data.photoUrl,
       });
+      bus.emit("graphicLoader");
     } else {
       drawRef.value.load.clear();
     }

+ 5 - 2
src/views/graphic/header.vue

@@ -73,7 +73,7 @@ import UiInput from "@/components/base/components/input/index.vue";
 import { roadPhotos } from "@/store/roadPhotos";
 import { uploadImage } from "@/store/sync";
 import { genUseLoading } from "@/hook";
-import { loadData } from "@/hook/useGraphic";
+import { loadData, bus } from "@/hook/useGraphic";
 
 import { dataService } from "@/graphic/Service/DataService";
 
@@ -114,8 +114,11 @@ watch(
       backImageChang(true);
     }
   },
-  { immediate: true }
+  { immediate: true, flush: "post" }
 );
+bus.on("graphicLoader", () => {
+  backImageChang(graphicState.value.showBackImage);
+});
 
 type Menu = { disable?: boolean; text: string; icon: string; onClick: () => void };
 const menus = computed<Menu[]>(() => {