Browse Source

Merge branch 'xj' of http://192.168.0.115:3000/bill/public-fuse into xj

bill 1 year ago
parent
commit
2df11a9918

+ 7 - 0
.env

@@ -0,0 +1,7 @@
+VITE_SEVER_URL="https://192.168.0.25"
+VITE_DEVCODE_URL="https://192.168.0.25/code"
+VITE_SWKK_URL="https://test.4dkankan.com"
+VITE_SERVICE_URL="https://test.4dkankan.com"
+VITE_SWSS_URL="https://uat-laser.4dkankan.com/uat"
+VITE_LASER_URL="https://uat-laser.4dkankan.com"
+VITE_FDKK_URL="https://laser.4dkankan.com"

+ 8 - 0
.env.development

@@ -0,0 +1,8 @@
+# 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"
+VITE_SWSS_URL="https://uat-laser.4dkankan.com/uat"
+VITE_LASER_URL="https://uat-laser.4dkankan.com"
+VITE_FDKK_URL="https://uat-laser.4dkankan.com/uat"

+ 7 - 0
.env.production

@@ -0,0 +1,7 @@
+VITE_SEVER_URL="https://192.168.0.25"
+VITE_DEVCODE_URL="https://192.168.0.25/code"
+VITE_SWKK_URL="https://4dkankan.com"
+VITE_SERVICE_URL="https://4dkankan.com"
+VITE_SWSS_URL="https://laser.4dkankan.com/"
+VITE_LASER_URL="https://laser.4dkankan.com"
+VITE_FDKK_URL="https://uat-laser.4dkankan.com/uat"

+ 2 - 2
package.json

@@ -6,7 +6,7 @@
   "scripts": {
     "dev": "vite",
     "build": "npm run build-quisk",
-    "build-quisk": "vite build ./ fire ",
+    "build-quisk": "vite build ./ fire --mode production",
     "preview": "vite preview"
   },
   "dependencies": {
@@ -42,4 +42,4 @@
     "vite": "^4.4.5",
     "vue-tsc": "^1.8.5"
   }
-}
+}

+ 4 - 1
src/app/map/App.vue

@@ -111,10 +111,13 @@ const request = axios.create({
 const mapEl = ref<HTMLDivElement>();
 let AMap, map;
 
+const queryURL = `${import.meta.env.VITE_SEVER_URL}/fusion-xj/web/fireProject/queryProject`
+
+// debugger;
 const getDataQuest = () => {
   return new Promise(async (reslove, reject) => {
     const res = await request.post(
-      "https://xj-mix3d.4dkankan.com/fusion-xj/web/fireProject/queryProject",
+      queryURL,
       {
         pageNum: 1,
         pageSize: 10000,

+ 3 - 1
src/app/map/company-select/organization.ts

@@ -8,8 +8,10 @@ import {
 import { useUrlSearchParams } from "@vueuse/core";
 const params = useUrlSearchParams("history");
 console.log("params", params.deptId);
+
+
 const request = axios.create({
-  baseURL: 'https://xj-mix3d.4dkankan.com/',
+  baseURL: `${import.meta.env.VITE_SEVER_URL}/`,
   timeout: 1000,
   headers: {
     share: 1,

+ 41 - 13
src/app/mirror/App.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="mirror-setting">
+  <div class="mirror-setting" v-if="!isNotFound">
     <!-- 图片预览 -->
     <el-dialog v-model="dialogVisible">
       <img
@@ -101,8 +101,9 @@
               <template #file="{ file }">
                 <div style="width: 100%">
                   <img
+                    v-if="file.cover"
                     class="el-upload-list__item-thumbnail"
-                    :src="getCoverUrl(file.url)"
+                    :src="getCoverUrl(file.cover)"
                     alt=""
                   />
                   <span class="el-upload-list__item-actions">
@@ -170,6 +171,7 @@
       </el-button>
     </div>
   </div>
+  <noCase :show-btn="false" v-else></noCase>
 </template>
 
 <script lang="ts" setup>
@@ -181,19 +183,23 @@ import { uploadFile as uploadFileUrl } from "@/request";
 import {
   getCaseScriptInfo,
   CaseScriptSaveOrUpdate,
+  CaseScriptGetCover,
 } from "@/app/mirror/store/script";
 import linkIco from "@/assets/image/fire.ico";
 import musicHeadphones from "@/assets/image/music.png";
+import { getCaseInfo } from "@/store/case";
+import noCase from "@/view/case/no-case.vue";
 
 const link = document.querySelector<HTMLLinkElement>("#app-icon")!;
 link.setAttribute("href", linkIco);
 
 const caseId = ref(null);
 const project = reactive({
-  title: "我的脚本",
+  title: "",
 });
 
-document.title = project.title;
+const isNotFound = ref(false);
+
 const dialogImageUrl = ref("");
 const dialogVisible = ref(false);
 const disabled = ref(false);
@@ -259,10 +265,10 @@ const checkSourceIsImage = computed(() => (url: string) => {
 
 const getCoverUrl = computed(() => (url: string) => {
   switch (true) {
-    case url.includes(".mp4"):
-      return (
-        url + "?x-oss-process=video/snapshot,t_0,f_jpg,w_0,h_0,m_fast,ar_auto"
-      );
+    // case url.includes(".mp4"):
+    //   return (
+    //     url + "?x-oss-process=video/snapshot,t_0,f_jpg,w_0,h_0,m_fast,ar_auto"
+    //   );
     case url.includes(".mp3") || url.includes(".wmv"):
       return musicHeadphones;
     default:
@@ -275,8 +281,15 @@ const data = reactive({
   newSortList: [],
 });
 const sortList = ref([0]);
-onMounted(() => {
+
+onMounted(async () => {
   caseId.value = GetRequest("caseId");
+  const caseInfo = await getCaseInfo(caseId.value!);
+  if (caseInfo && caseId.value) {
+    document.title = caseInfo.caseTitle + " | 分配配置";
+  } else {
+    isNotFound.value = true;
+  }
   getCaseScriptList();
   console.log("caseId", caseId); //query传参
 });
@@ -285,11 +298,22 @@ function getCaseScriptList() {
   getCaseScriptInfo(caseId.value)
     .then((res) => {
       project.title = res.name;
-      data.list = res.content;
-      data.newSortList = res.content;
+      data.list = res.content || [];
+      data.newSortList = res.content || [];
       const idList = data.list.map((ele) => ele.id);
       active.value = Math.max.apply(null, idList) || 1;
       sortList.value = data.list.map((_, index) => index);
+
+      Array.from(data.list).forEach((item) => {
+        item.fileList.forEach(async (file: File, index) => {
+          if ((file as any).url.includes(".mp4")) {
+            const res = await CaseScriptGetCover((file as any).url);
+            (item.fileList[index] as any).cover = res;
+          } else {
+            (item.fileList[index] as any).cover = (file as any).url;
+          }
+        });
+      });
     })
     .catch((err) => {
       console.log(err);
@@ -343,9 +367,13 @@ const saveProject = () => {
     console.log("saveProject");
   });
 };
-function handleUploadSuccess(response: any, uploadFile: UploadFile) {
+async function handleUploadSuccess(response: any, uploadFile: UploadFile) {
   uploadFile.url = response.data;
-  console.log(response, uploadFile);
+  if (uploadFile.url!.includes(".mp4")) {
+    const res = await CaseScriptGetCover(uploadFile.url!);
+    (uploadFile as any).cover = res;
+  }
+  console.log("handleUploadSuccess", response, uploadFile);
 }
 
 function GetRequest(value) {

+ 6 - 6
src/app/mirror/store/script.ts

@@ -2,6 +2,7 @@ import { UN_REQ_NUM } from "@/constant/sys";
 import {
   getCaseScriptSaveOrUpdateUrl,
   getCaseScriptInfoUrl,
+  getVideoCover,
   axios,
 } from "@/request";
 
@@ -59,9 +60,7 @@ export enum FirePaggingRoute {
 }
 
 export const getCaseScriptInfo = async (caseId) => {
-  let res = await axios.get(getCaseScriptInfoUrl, {
-    params: { caseId, ingoreRes: true },
-  });
+  let res = await axios.get(getCaseScriptInfoUrl, { params: { caseId, ingoreRes: true } });
   console.log(res);
   if (res && res.code === 0) {
     return res.data;
@@ -72,6 +71,7 @@ export const getCaseScriptInfo = async (caseId) => {
 };
 
 export const CaseScriptSaveOrUpdate = async (fire: Omit<Fire, "id">) =>
-  axios.post(getCaseScriptSaveOrUpdateUrl, fire, {
-    params: { ingoreRes: true },
-  });
+  axios.post(getCaseScriptSaveOrUpdateUrl, fire, { params: { ingoreRes: true } });
+
+export const CaseScriptGetCover = async (url: string, width = 200, height = 200) =>
+  (await axios.get(getVideoCover, { params: { videoPath: url, width, height } })).data;

+ 29 - 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);
   }
@@ -205,7 +218,12 @@ export default class Scene extends Mitt {
   test() {
     this.orthCamera.zoom = this.defaultZoom;
     const object = this.boxManager.model;
-    const total = this.boxManager.imgList.length;
+    let total;
+    if (this.sceneType === 2) {
+      total = this.boxManager.imgList.length;
+    } else {
+      total = this.boxManager.imgList.length / 2;
+    }
 
     object.updateMatrixWorld();
     this.orthCamera.updateProjectionMatrix();
@@ -220,7 +238,7 @@ export default class Scene extends Mitt {
       for (var i = 0; i <= slides; i++) {
         (function (index, that) {
           setTimeout(function () {
-            const offset = -(one * 3 * index + 0.21);
+            const offset = -(one * 3 * index);
             console.log("Iteration:", offset);
             that.screenshot(offset, index);
 
@@ -231,6 +249,14 @@ export default class Scene extends Mitt {
     }
   }
 
+  test1() {
+    const object = this.boxManager.model;
+    for (var i = 0; i <= object.children.length; i++) {
+      console.log(object.children[i]);
+      this.scene.lookAt(this.boxManager.model);
+    }
+  }
+
   onBindEvent = () => {
     //window.addEventListener('resize', this.onResize)
   };

+ 1 - 1
src/core/box/object/PureTextLabel.js

@@ -19,7 +19,7 @@ export default class PureTextLabel extends THREE.Mesh {
     let fs = 12 * res * radio;
     var context = canvas.getContext("2d");
 
-    const lines = getWrapText(context, text, 158);
+    const lines = getWrapText(context, text, 140);
     console.log("lines", lines);
     containerHeight = containerHeight * lines.length;
     canvas.height = height * lines.length;

+ 1 - 0
src/request/urls.ts

@@ -252,6 +252,7 @@ export const updateSysSetting = `/fusion-xj/systemSetting/save`;
 // 脚本管理
 export const getCaseScriptInfoUrl = `/fusion-xj/caseScript/info`;
 export const getCaseScriptSaveOrUpdateUrl = `/fusion-xj/caseScript/saveOrUpdate`;
+export const getVideoCover = `/fusion-xj/caseScript/ffmpegVideoImage`
 
 
 // 固件管理

+ 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);
 

+ 2 - 2
src/view/cameraVersionApp/index.vue

@@ -107,7 +107,7 @@ import {
 } from "@/store/cameraVersionApp";
 import { dayjs, ElMessage, ElMessageBox } from "element-plus";
 
-const headOptions = [{ value: 1, name: "app管理" }];
+const headOptions = [{ value: 0, name: "app管理" }];
 
 const pageHook = useScenePaggingParams();
 
@@ -144,7 +144,7 @@ const codeHandler = async () => {
     pageNum: 1,
     pageSize: 10000,
     version: "",
-    type: 1,
+    type: 0,
   });
   const activeOne = Array.from(all.list).find((item) => item.status === "A");
 

+ 1 - 1
src/view/cameraVersionApp/paging.ts

@@ -9,7 +9,7 @@ export const useScenePaggingParams = () => {
   const pagging = usePagging({
     get: getcameraVersionAppList,
     paramsTemlate: {
-      type: 1,
+      type: 0,
       version: '',
     },
   });

+ 1 - 1
src/view/case/addCaseFile.vue

@@ -13,7 +13,7 @@
         :disabled="!!file"
         :before-upload="upload"
         :file-list="fileList"
-        :http-request="() => {}"
+        :http-request="async() => {}"
         :on-preview="previewFile"
         :accept="accept"
         :before-remove="removeFile"

+ 9 - 0
src/view/case/no-case.vue

@@ -3,6 +3,7 @@
     <img :src="emptyBG" />
     <span>案件不存在</span>
     <el-button
+      v-if="showBtn"
       class="btn"
       link
       text
@@ -16,6 +17,14 @@
 <script lang="ts" setup>
 import emptyBG from "@/assets/image/empty__empty.png";
 import { RouteName, router } from "@/router";
+const props = withDefaults(
+  defineProps<{
+    showBtn: boolean;
+  }>(),
+  {
+    showBtn: true,
+  }
+);
 const toHome = () => {
   router.replace({ name: RouteName.vrmodel });
 };

+ 95 - 86
vite.config.ts

@@ -1,4 +1,4 @@
-import { defineConfig } from "vite";
+import { defineConfig, loadEnv } from "vite";
 import vue from "@vitejs/plugin-vue";
 import { resolve } from "path";
 import ElementPlus from "unplugin-element-plus/vite";
@@ -8,94 +8,103 @@ if (process.argv.length > 3) {
   app = process.argv[process.argv.length - 1].trim();
 }
 
-const dev = true;
+// const dev = true;
 // const devUrl = "https://xj-mix3d.4dkankan.com"
-const devUrl = "https://192.168.0.25";
-export default defineConfig({
-  define: {
-    VITE_APP_APP: JSON.stringify(app),
-  },
-  base: "./",
-  build: {
-    rollupOptions: {
-      input: {
-        index: resolve(__dirname, "index.html"),
-        map: resolve(__dirname, "map.html"),
-        mirror: resolve(__dirname, "mirror.html"),
-        // 在这里继续添加更多页面
-      },
+// const devUrl = "https://192.168.0.25"
+
+export default ({ mode }: any) =>
+  defineConfig({
+    define: {
+      VITE_APP_APP: JSON.stringify(app),
     },
-    outDir: `dist/${app}`,
-  },
-  resolve: {
-    alias: [
-      {
-        find: "@",
-        replacement: resolve(__dirname, "./src"),
+    base: "./",
+    build: {
+      rollupOptions: {
+        input: {
+          index: resolve(__dirname, "index.html"),
+          map: resolve(__dirname, "map.html"),
+          mirror: resolve(__dirname, "mirror.html"),
+          // 在这里继续添加更多页面
+        },
       },
+      outDir: `dist/${app}`,
+    },
+    resolve: {
+      alias: [
+        {
+          find: "@",
+          replacement: resolve(__dirname, "./src"),
+        },
+      ],
+    },
+    plugins: [
+      vue(),
+      ElementPlus({
+        useSource: true,
+      }),
     ],
-  },
-  plugins: [
-    vue(),
-    ElementPlus({
-      useSource: true,
-    }),
-  ],
-  server: {
-    port: 5173,
-    host: "0.0.0.0",
-    proxy: {
-      "/api": {
-        secure: false,
-        target: dev ? devUrl : "mix3d.4dkankan.com",
-        changeOrigin: true,
-        rewrite: (path) => path.replace(new RegExp(`^/api`), ""),
-      },
-      "/fusion-xj": {
-        secure: false,
-        target: dev ? devUrl : "mix3d.4dkankan.com",
-        changeOrigin: true,
-        rewrite: (path) => path.replace(new RegExp(`^/api`), "/fusion-xj"),
-      },
-      "/dev-code": {
-        // target: "https://localhost:7173/",
-        target: dev
-          ? "https://xj-mix3d.4dkankan.com/code"
-          : "https://mix3d.4dkankan.com/code",
-        changeOrigin: true,
-        secure: false,
-        rewrite: (path) => path.replace(new RegExp(`^/dev-code`), ""),
-      },
-      "/swkk": {
-        target: dev ? "https://test.4dkankan.com" : "https://www.4dkankan.com",
-        changeOrigin: true,
-        rewrite: (path) => path.replace(new RegExp(`^/swkk`), ""),
-      },
-      "/service": {
-        target: dev ? "https://test.4dkankan.com" : "https://www.4dkankan.com",
-        changeOrigin: true,
-      },
-      "/swss": {
-        target: dev
-          ? "https://uat-laser.4dkankan.com/uat"
-          : "https://laser.4dkankan.com",
-        changeOrigin: true,
-        rewrite: (path) => path.replace(new RegExp(`^/swss`), ""),
-      },
-      "/laser": {
-        target: dev
-          ? "https://uat-laser.4dkankan.com"
-          : "https://laser.4dkankan.com",
-        changeOrigin: true,
-        rewrite: (path) => path.replace(new RegExp(`^/laser`), "/laser"),
-      },
-      "/fdkk": {
-        target: dev
-          ? "https://uat-laser.4dkankan.com/uat"
-          : "https://laser.4dkankan.com",
-        changeOrigin: true,
-        rewrite: (path) => path.replace(new RegExp(`^/fdkk`), "/fdkk"),
+    server: {
+      port: 5173,
+      host: "0.0.0.0",
+      proxy: {
+        "/api": {
+          secure: false,
+          // target: dev ? devUrl : "mix3d.4dkankan.com",
+          target: loadEnv(mode, process.cwd()).VITE_SEVER_URL,
+          changeOrigin: true,
+          rewrite: (path) => path.replace(new RegExp(`^/api`), ""),
+        },
+        "/fusion-xj": {
+          secure: false,
+          // target: dev ? devUrl : "mix3d.4dkankan.com",
+          target: loadEnv(mode, process.cwd()).VITE_SEVER_URL,
+          changeOrigin: true,
+          rewrite: (path) => path.replace(new RegExp(`^/api`), "/fusion-xj"),
+        },
+        "/dev-code": {
+          target: loadEnv(mode, process.cwd()).VITE_DEVCODE_URL,
+          // target: dev
+          //   ? "https://xj-mix3d.4dkankan.com/code"
+          //   : "https://mix3d.4dkankan.com/code",
+          changeOrigin: true,
+          secure: false,
+          rewrite: (path) => path.replace(new RegExp(`^/dev-code`), ""),
+        },
+        "/swkk": {
+          // target: dev ? "https://test.4dkankan.com" : "https://www.4dkankan.com",
+          target: loadEnv(mode, process.cwd()).VITE_SWKK_URL,
+          changeOrigin: true,
+          rewrite: (path) => path.replace(new RegExp(`^/swkk`), ""),
+        },
+        "/service": {
+          // target: dev ? "https://test.4dkankan.com" : "https://www.4dkankan.com",
+          target: loadEnv(mode, process.cwd()).VITE_SERVICE_URL,
+          changeOrigin: true,
+        },
+        "/swss": {
+          // target: dev
+          //   ? "https://uat-laser.4dkankan.com/uat"
+          //   : "https://laser.4dkankan.com",
+          target: loadEnv(mode, process.cwd()).VITE_SWSS_URL,
+          changeOrigin: true,
+          rewrite: (path) => path.replace(new RegExp(`^/swss`), ""),
+        },
+        "/laser": {
+          // target: dev
+          //   ? "https://uat-laser.4dkankan.com"
+          //   : "https://laser.4dkankan.com",
+          target: loadEnv(mode, process.cwd()).VITE_LASER_URL,
+          changeOrigin: true,
+          rewrite: (path) => path.replace(new RegExp(`^/laser`), "/laser"),
+        },
+        "/fdkk": {
+          // target: dev
+          //   ? "https://uat-laser.4dkankan.com/uat"
+          //   : "https://laser.4dkankan.com",
+          target: loadEnv(mode, process.cwd()).VITE_FDKK_URL,
+          changeOrigin: true,
+          rewrite: (path) => path.replace(new RegExp(`^/fdkk`), "/fdkk"),
+        },
       },
     },
-  },
-});
+  });