Jelajahi Sumber

fix: 小地图配置切换速度过快出现bug

sunhongyao341504 2 tahun lalu
induk
melakukan
eedf1d3405

+ 15 - 14
src/views/map-config/mini-map/MiniMapConfig.vue

@@ -209,20 +209,21 @@
   };
 
   const getShopContent = (code: string) => {
-    getShowCameras(code);
-    getMapLayout(code).then((res) => {
-      if (!res) {
-        return;
-      }
-      hasBg.value = true;
-      isMap.value = res.isUploadBg;
-      if (res.isUploadBg) {
-        isUploadBg.value = true;
-        konvaMap.value.createMap(res);
-      } else {
-        hasBg.value = false;
-        isUploadBg.value = res.isUploadBg;
-      }
+    getShowCameras(code).then(() => {
+      getMapLayout(code).then((res) => {
+        if (!res) {
+          return;
+        }
+        hasBg.value = true;
+        isMap.value = res.isUploadBg;
+        if (res.isUploadBg) {
+          isUploadBg.value = true;
+          konvaMap.value.createMap(res);
+        } else {
+          hasBg.value = false;
+          isUploadBg.value = res.isUploadBg;
+        }
+      });
     });
   };
 

+ 2 - 2
src/views/map-config/mini-map/use-mini-map.ts

@@ -35,9 +35,9 @@ export const useMiniMap = defineStore('mini-map', () => {
 
     if (!id) {
       ElMessage.error('摄像头code未找到对应信息');
-      return;
+      return Promise.resolve();
     }
-    getCameraList(id).then((res) => {
+    return getCameraList(id).then((res) => {
       res.forEach((space) => {
         if (space.cameraList && space.cameraList.length > 0) {
           space.cameraList.forEach((camera) => {