فهرست منبع

fix: 对接测试数据

bill 3 سال پیش
والد
کامیت
90589b7d12
3فایلهای تغییر یافته به همراه21 افزوده شده و 7 حذف شده
  1. 1 1
      src/api/model.ts
  2. 4 4
      src/sdk/association.ts
  3. 16 2
      src/store/model.ts

+ 1 - 1
src/api/model.ts

@@ -6,7 +6,7 @@ import {
 export enum ModelType {
   SWKK,
   SWKJ,
-  SWMX,
+  SWMX = 'glb',
   SWSS = 'laser',
 }
 

+ 4 - 4
src/sdk/association.ts

@@ -23,11 +23,11 @@ const associationModels = (sdk: SDK) => {
       }
 
       const itemRaw = toRaw(item)
-      // const sceneModel = sdk.addModel(itemRaw)
-      // sceneModelMap.set(itemRaw, sceneModel)
+      const sceneModel = sdk.addModel(itemRaw)
+      sceneModelMap.set(itemRaw, sceneModel)
 
-      // sceneModel.on('position', pos => item.position = pos)
-      // sceneModel.on('rotation', rot => item.rotation = rot)
+      sceneModel.on('position', pos => item.position = pos)
+      sceneModel.on('rotation', rot => item.rotation = rot)
     }
     for (const item of deleted) {
       getSceneModel(item)?.destroy()

+ 16 - 2
src/store/model.ts

@@ -12,8 +12,22 @@ export const initialModels = async () => {
   models.value = [
     {
       id: '123',
-      url: '',
-      type: ModelType.SWKJ,
+      url: 'SS-t-7DUfWAUZ3V',
+      type: ModelType.SWSS,
+      title: 'SS-t-7DUfWAUZ3V',
+      size: 1000,
+      time: '2012-02-05',
+      scale: 1,
+      rotation: { x: 1, y: 1, z: 1},
+      position: { x: 1, y: 1, z: 1},
+      opacity: 0.1,
+      bottom: 1,
+      show: true
+    },
+    {
+      id: '124',
+      url: '/lib/resources/models/glb/coffeemat.glb',
+      type: ModelType.SWMX,
       title: '某安外',
       size: 1000,
       time: '2012-02-05',