qinyan 1 жил өмнө
parent
commit
6cb91c5d96

+ 17 - 13
src/modules/editor/components/Viewport/Slider/SliderLeft/Sources/EditVideoModal.tsx

@@ -6,11 +6,12 @@ import { Button } from "ant-design-vue";
 import { queenApi } from "queenjs";
 import Modal from "queenjs/adapter/vue/components/modal";
 import { defineComponent, reactive, ref } from "vue";
-import { object } from "vue-types";
+import { bool, object } from "vue-types";
 
 export default defineComponent({
   props: {
     record: object().isRequired,
+    isSystem: bool().isRequired,
   },
   setup(props) {
     const resource = useResource();
@@ -35,7 +36,7 @@ export default defineComponent({
         end: state.endTime,
         id: props.record._id,
       };
-      const res = await resource.https.cutVideo(data);
+      const res = await resource.https.cutVideo(data, props.isSystem);
       const { url, jobId } = res.result;
 
       const videoStatusCtrl = new TimeController({
@@ -70,6 +71,7 @@ export default defineComponent({
         await resource.controls.custVideoListCtrl.loadPage(1);
         Modal.clear();
         queenApi.hideLoading();
+        queenApi.messageSuccess("已保存,请到我的-视频中查看!");
       }, 800);
     };
 
@@ -118,7 +120,7 @@ export default defineComponent({
     }
 
     return () => {
-      const { record } = props;
+      const { record, isSystem } = props;
       const { duration, startTime, endTime, previewObj } = state;
       const submitDisabled = previewObj.file ? false : true;
 
@@ -189,16 +191,18 @@ export default defineComponent({
             </Button>
           </div>
           <div class="mt-60px text-center space-x-30px">
-            <Button
-              ghost
-              type="primary"
-              size="large"
-              class="w-300px"
-              disabled={submitDisabled}
-              onClick={replaceVideo}
-            >
-              替换原视频
-            </Button>
+            {!isSystem && (
+              <Button
+                ghost
+                type="primary"
+                size="large"
+                class="w-300px"
+                disabled={submitDisabled}
+                onClick={replaceVideo}
+              >
+                替换原视频
+              </Button>
+            )}
             <Button
               type="primary"
               size="large"

+ 6 - 6
src/modules/editor/components/Viewport/Slider/SliderLeft/Sources/List.tsx

@@ -1,4 +1,4 @@
-import { defineComponent, onMounted, watch } from "vue";
+import { defineComponent, onMounted, provide } from "vue";
 import { Container, Draggable } from "vue-dndrop";
 import { string } from "vue-types";
 
@@ -6,9 +6,9 @@ import Empty from "@/components/Empty";
 import { useEditor } from "@/modules/editor";
 import { useResource } from "@/modules/resource";
 import { Loadmore } from "@queenjs/ui";
+import { Button } from "ant-design-vue";
 import { queenApi } from "queenjs";
 import SourceItem from "./SourceItem";
-import { Button } from "ant-design-vue";
 
 import ListFilter from "../ListFilter";
 
@@ -20,6 +20,7 @@ export const Sources = defineComponent({
   setup(props) {
     const editor = useEditor();
     const resource = useResource();
+    provide("sourceFrom", props.sourceFrom);
 
     function getCurrCtrl() {
       // sysImageListCtrl sysVideoListCtrl custImageListCtrl custVideoListCtrl
@@ -35,12 +36,11 @@ export const Sources = defineComponent({
     }
 
     function clickToDesign(url: string) {
-      
       if (props.sourceType == "Image") {
-          editor.actions.addImageToDesign(url);
-          return;
+        editor.actions.addImageToDesign(url);
+        return;
       }
-      
+
       editor.actions.clickCompToDesign(props.sourceType, (comp) => {
         comp.value.url = url;
       });

+ 10 - 6
src/modules/editor/components/Viewport/Slider/SliderLeft/Sources/SourceItem.tsx

@@ -6,7 +6,7 @@ import { IconMore } from "@queenjs/icons";
 import { Dropdown, Menu, Tag } from "ant-design-vue";
 import dayjs from "dayjs";
 import { defineUI, queenApi } from "queenjs";
-import { defineComponent, reactive } from "vue";
+import { defineComponent, inject, reactive } from "vue";
 import { any, bool, object } from "vue-types";
 import EditVideoModal from "./EditVideoModal";
 
@@ -19,13 +19,17 @@ const VideoItem = defineComponent({
     const state = reactive({
       play: false,
     });
+    const sourceFrom = inject("sourceFrom");
 
     function showModal(record: any) {
-      queenApi.dialog(<EditVideoModal record={record} />, {
-        title: "编辑视频",
-        width: "1100px",
-        centered: true,
-      });
+      queenApi.dialog(
+        <EditVideoModal record={record} isSystem={sourceFrom == "system"} />,
+        {
+          title: "编辑视频",
+          width: "1100px",
+          centered: true,
+        }
+      );
     }
 
     return () => {

+ 9 - 3
src/modules/resource/http.ts

@@ -19,9 +19,15 @@ export const http = ResourceModule.http({
   updateResouce(data: any) {
     return this.request("/source/update", { method: "POST", data });
   },
-
-  cutVideo(data: { id: string; start: number; end: number }) {
-    return this.request("/video/cut", { method: "POST", data });
+  // sys/video/cut  /video/cut
+  cutVideo(
+    data: { id: string; start: number; end: number },
+    isSystem: boolean
+  ) {
+    return this.request(isSystem ? "sys/video/cut" : "/video/cut", {
+      method: "POST",
+      data,
+    });
   },
   queryVideoStatus(id: string) {
     return this.request(`/video/cut/${id}`, { method: "GET" });