瀏覽代碼

更改creatpath方法

wangfumin 1 周之前
父節點
當前提交
5daa4b9ffe
共有 5 個文件被更改,包括 30 次插入14 次删除
  1. 1 0
      src/api/path.ts
  2. 3 1
      src/components/path/sign.vue
  3. 9 9
      src/hook/use-fly.ts
  4. 2 0
      src/sdk/sdk.ts
  5. 15 4
      src/views/positioning/index.vue

+ 1 - 0
src/api/path.ts

@@ -9,6 +9,7 @@ interface ServerPath {
 
 export interface Path {
   id: string;
+  isAnimate: boolean;
   name: string;
   showName: boolean;
   linePosition?: {

+ 3 - 1
src/components/path/sign.vue

@@ -35,7 +35,7 @@ const getLineProps = () => ({
   position: props.path.linePosition?.position,
   modelId: props.path.linePosition?.modelId,
 });
-
+// console.log('props.path',props.path)
 const path = sdk.createPath({
   name: props.path.name,
   showName: props.path.showName,
@@ -44,6 +44,8 @@ const path = sdk.createPath({
   reverseDirection: props.path.reverseDirection,
   line: getLineProps(),
   points: props.path.points,
+  id: props.path.id,
+  isAnimate: props.path.isAnimate
 });
 console.log(getLineProps());
 // path.changeCanEdit(false);

+ 9 - 9
src/hook/use-fly.ts

@@ -135,15 +135,15 @@ export const flyPlayPath = (path: Path) => {
   return stopFly
 }
 
-export const flyplayPosition = (macId: any) => {
-  stopFly && stopFly()
-  stopFly = () => {
-    stopFly = null
-    // pauseSceneGuide()
-  }
-  // playPosition()
-  return stopFly
-}
+// export const flyplayPosition = (macId: any) => {
+//   stopFly && stopFly()
+//   stopFly = () => {
+//     stopFly = null
+//     // pauseSceneGuide()
+//   }
+//   // playPosition()
+//   return stopFly
+// }
 
 export const flyLatLng = (latlng: number[]) => {
   stopFly && stopFly();

+ 2 - 0
src/sdk/sdk.ts

@@ -225,6 +225,8 @@ export interface SDK {
 }
 
 export type PathProps = {
+  id: string
+  isAnimate: boolean
   // 线段名称
   name: string;
   // 是否显示名称,

+ 15 - 4
src/views/positioning/index.vue

@@ -22,8 +22,9 @@ import { RightFillPano } from "@/layout";
 import { postAddPathInPosition } from '@/api'
 import mediaList from "./components/mediaList.vue";
 import { nextTick, reactive, ref, watchEffect, onUnmounted } from "vue";
-import { positionList, enterOld, enterEdit } from "@/store";
+import { positionList, paths, enterOld, enterEdit } from "@/store";
 import { loadPack } from '@/utils'
+import { sdk } from "@/sdk";
 
 const isRecord = ref(false);
 const startTime = ref<number>(0);
@@ -76,9 +77,19 @@ const startRecord = (type: string) => {
             duration: endTime.value - startTime.value
         });
         // 这里调path接口传路线数据过去,有几个设备就生成几个path
-        positionList.value.forEach((pos: any) => {
-          postAddPathInPosition({}, startTime.value, endTime.value)
-        });
+        console.log(paths, 8888)
+        let positionPaths = sdk.generateAniPathData() || []
+        positionPaths.forEach((positionPath: any) => {
+          postAddPathInPosition(positionPath, startTime.value, endTime.value)
+        })
+        // positionList.value.forEach((pos: any) => {
+        //   // 寻找当前设备对应的path
+        //   let positionPath = positionPaths.find((path: any) =>{return '00' + pos.macId == path.id})
+        //   console.log(positionPaths, pos, positionPath, 88)
+        //   if(positionPath){
+        //     postAddPathInPosition(positionPath, startTime.value, endTime.value)
+        //   }
+        // });
         // enterOld(async () => {})
     }
 };