gemercheung 1 anno fa
parent
commit
09929f654a
4 ha cambiato i file con 53 aggiunte e 12 eliminazioni
  1. 2 1
      .env.development
  2. 17 3
      src/core/Scene.js
  3. 19 2
      src/view/cameraVersion/edit.vue
  4. 15 6
      src/view/cameraVersionApp/edit.vue

+ 2 - 1
.env.development

@@ -1,4 +1,5 @@
-VITE_SEVER_URL="https://192.168.0.25"
+# VITE_SEVER_URL="https://192.168.0.25"
+VITE_SEVER_URL="https://xj-mix3d.4dkankan.com"
 VITE_DEVCODE_URL="https://192.168.0.25/code"
 VITE_SWKK_URL="https://test.4dkankan.com"
 VITE_SERVICE_URL="https://test.4dkankan.com"

+ 17 - 3
src/core/Scene.js

@@ -34,6 +34,9 @@ export default class Scene extends Mitt {
     this.width = 0;
     this.height = 0;
     this.defaultZoom = 250;
+    this.initCamPView = new THREE.Vector3();
+    this.initCamRView = new THREE.Vector3();
+
     this.inited = false;
 
     this.init = () => {
@@ -88,7 +91,7 @@ export default class Scene extends Mitt {
 
   load = (list, type, data) => {
     if (!list) return;
-    console.log("scene: ", list, type, data);
+    // console.log("scene: ", list, type, data);
     //axesHeloer
     this.clearScene();
     this.sceneType = type;
@@ -99,6 +102,8 @@ export default class Scene extends Mitt {
     //light
     this.loadLight();
     this.player.load(type, data || []);
+    this.initCamPView.copy(this.orthCamera.position);
+    this.initCamRView.copy(this.orthCamera.rotation);
   };
 
   clearScene() {
@@ -178,6 +183,14 @@ export default class Scene extends Mitt {
     stats.end();
     requestAnimationFrame(this.animate);
   };
+
+  resetCameraView() {
+    this.orthCamera.zoom = this.defaultZoom;
+    this.orthCamera.position.copy(this.initCamPView);
+    this.orthCamera.rotation.copy(this.initCamRView);
+    // this.orthCamera.updateMatrixWorld();
+  }
+
   editing(item) {
     this.player.editing(item);
   }
@@ -238,8 +251,9 @@ export default class Scene extends Mitt {
 
   test1() {
     const object = this.boxManager.model;
-    for (var i = 0; i <= object; i++) {
-      console.log(object[i]);
+    for (var i = 0; i <= object.children.length; i++) {
+      console.log(object.children[i]);
+      this.scene.lookAt(this.boxManager.model);
     }
   }
 

+ 19 - 2
src/view/cameraVersion/edit.vue

@@ -59,9 +59,14 @@
           <div class="file" @click.stop="previewFile()">
             <div>
               <el-icon><Document /></el-icon>
-              <span class="name">{{ file.name }}</span>
+              <span class="name">{{ getFileName(file.name) }}</span>
             </div>
-            <el-icon @click.stop="removeFile()"><Close /></el-icon>
+            <el-icon
+              @click.stop="removeFile() && (data.file = undefined)"
+              style="padding: 10px; cursor: pointer"
+            >
+              <Close />
+            </el-icon>
           </div>
         </template>
       </el-upload>
@@ -99,6 +104,14 @@ const data = ref<CameraVersionEntity>({
 
 const form = ref();
 
+const getFileName = computed(() => (name: string) => {
+  if (name.length > 15) {
+    return name.substring(0, 15) + "....zip";
+  } else {
+    return name;
+  }
+});
+
 const isAdd = computed(() => !props.entity?.id);
 
 const httpsApi = async ({ file }) => {
@@ -113,6 +126,10 @@ watchEffect(() => {
   if (props.entity) {
     data.value = { ...props.entity };
   }
+  if (isAdd.value) {
+    console.log("isAdd", isAdd.value);
+    data.value.file = undefined;
+  }
 });
 const { size, fileList, upload, removeFile, previewFile, file, accept } =
   useUpload({

+ 15 - 6
src/view/cameraVersionApp/edit.vue

@@ -53,11 +53,15 @@
           <div class="file" @click.stop="previewFile()">
             <div>
               <el-icon><Document /></el-icon>
-              <span class="name">{{ file.name }}</span>
+              <span class="name">{{ getFileName(file.name) }}</span>
             </div>
-            <el-icon @click.stop="removeFile() && (data.file = undefined)"
-              ><Close
-            /></el-icon>
+
+            <el-icon
+              @click.stop="removeFile() && (data.file = undefined)"
+              style="padding: 10px; cursor: pointer"
+            >
+              <Close />
+            </el-icon>
           </div>
         </template>
       </el-upload>
@@ -79,7 +83,6 @@ import {
 } from "@/store/cameraVersionApp";
 import { ElMessage } from "element-plus";
 
-
 const props = defineProps<{
   // type: string | number;
   entity?: CameraVersionAppEntity;
@@ -96,7 +99,13 @@ const data = ref<CameraVersionAppEntity>({
 
 const form = ref();
 
-
+const getFileName = computed(() => (name: string) => {
+  if (name.length > 15) {
+    return name.substring(0, 15) + "....apk";
+  } else {
+    return name;
+  }
+});
 
 const isAdd = computed(() => !props.entity?.id);