gemercheung 1 rok pred
rodič
commit
b4dcb2780b

+ 2 - 2
src/core/Scene.js

@@ -72,8 +72,8 @@ export default class Scene extends Mitt {
     //axesHeloer
     this.clearScene();
     this.sceneType = type;
-    const axesHelper = new THREE.AxesHelper(1);
-    this.scene.add(axesHelper);
+    // const axesHelper = new THREE.AxesHelper(1);
+    // this.scene.add(axesHelper);
     this.boxManager = new BoxManager(this);
     this.boxManager.load(list, type);
     //light

+ 1 - 1
src/core/box/BoxManager.js

@@ -37,7 +37,7 @@ export default class BoxManager {
     // this.model.position.y += 0.3;
     // this.model.visible =false;
     this.scene.scene.add(this.model);
-    console.log("this.scene.scene", this.scene.scene);
+    // console.log("this.scene.scene", this.scene.scene);
   };
 
   onBindEvent = () => {

+ 28 - 22
src/view/case/photos/index.vue

@@ -72,7 +72,7 @@
 </template>
 
 <script setup>
-import { onMounted, ref, computed } from "vue";
+import { onMounted, ref, computed, onUnmounted } from "vue";
 import { Menu, FullScreen } from "@element-plus/icons-vue";
 import { Swiper, SwiperSlide } from "swiper/vue";
 import "swiper/css";
@@ -114,6 +114,22 @@ function refresh() {
   }
 }
 const changeList = async (list) => {
+  //同步数据
+  if (!loadedDrawData.value) {
+    const res = await getCaseImgTagData(caseId.value);
+    if (res.data) {
+      if (res.data.data) {
+        loadedDrawData.value = res.data.data;
+      }
+      if ("isHorizontal" in res.data) {
+        console.error("sortType.value", sortType.value, !res.data.isHorizontal);
+        sortType.value = !res.data.isHorizontal;
+      }
+    } else {
+      loadedDrawData.value = [];
+    }
+  }
+
   let newList = [];
   list.map((item, index) => {
     if (sortType.value) {
@@ -129,20 +145,8 @@ const changeList = async (list) => {
   const arr = [];
   newList.map((i) => arr.push(JSON.parse(JSON.stringify(i))));
 
-  if (!loadedDrawData.value) {
-    const res = await getCaseImgTagData(caseId.value);
-    if (res.data) {
-      if (res.data.data) {
-        loadedDrawData.value = res.data.data;
-      }
-      if ("isHorizontal" in res.data) {
-        sortType.value = !res.data.isHorizontal;
-      }
-    } else {
-      loadedDrawData.value = [];
-    }
-  }
-  let type = sortType.value ? 2 : 1;
+  const type = sortType.value ? 2 : 1;
+
   if (scene) {
     scene.load(arr, type, loadedDrawData.value || []);
     console.log("changeList", arr, type, loadedDrawData.value);
@@ -229,15 +233,17 @@ const handleClear = () => {
     window.scene.player.clear();
   }
 };
+onUnmounted(() => {});
 
-onMounted(async () => {
+onMounted(() => {
   renderCanvas();
-  try {
-    const res = await getCaseImgTagData(caseId.value);
-    const { isHorizontal, data } = res.data;
-    sortType.value = !isHorizontal;
-    data && (loadedDrawData.value = data);
-  } catch (error) {}
+  console.warn("renderCanvas");
+  // try {
+  //   const res = await getCaseImgTagData(caseId.value);
+  //   const { isHorizontal, data } = res.data;
+  //   sortType.value = !isHorizontal;
+  //   data && (loadedDrawData.value = data);
+  // } catch (error) {}
 });
 </script>
 <style lang="scss" scoped>