gemercheung il y a 1 an
Parent
commit
b8a25c3688

+ 1 - 0
.env

@@ -0,0 +1 @@
+SEVER_URL="https://192.168.0.25"

+ 1 - 0
.env.development

@@ -0,0 +1 @@
+SEVER_URL="https://192.168.0.25"

+ 1 - 0
.env.production

@@ -0,0 +1 @@
+SEVER_URL="https://192.168.0.25"

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

+ 8 - 4
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,15 +60,18 @@ 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) {
+  if (res && res.code === 0) {
     return res.data;
-  }else{ 
+  } else {
     // window.location.href = '/'
     throw "用户未登录";
   }
 }
 
 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;

+ 7 - 2
src/core/Scene.js

@@ -205,7 +205,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 +225,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);
 

+ 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`
 
 
 // 固件管理

+ 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: '',
     },
   });

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

+ 2 - 0
vite.config.ts

@@ -12,6 +12,8 @@ if (process.argv.length > 3) {
 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),