Ver código fonte

feat: 素材编辑

dx 3 meses atrás
pai
commit
c949db8a5a

+ 50 - 48
package.json

@@ -1,48 +1,50 @@
-{
-  "name": "ruoyi",
-  "version": "3.8.7",
-  "description": "互动视频管理系统",
-  "author": "若依",
-  "license": "MIT",
-  "type": "module",
-  "scripts": {
-    "dev": "vite",
-    "build:prod": "vite build",
-    "build:stage": "vite build --mode staging",
-    "preview": "vite preview"
-  },
-  "repository": {
-    "type": "git",
-    "url": "https://gitee.com/y_project/RuoYi-Vue.git"
-  },
-  "dependencies": {
-    "@element-plus/icons-vue": "2.3.1",
-    "@vueup/vue-quill": "1.2.0",
-    "@vueuse/core": "10.6.1",
-    "axios": "0.27.2",
-    "echarts": "5.4.3",
-    "element-plus": "2.4.3",
-    "file-saver": "2.0.5",
-    "fuse.js": "6.6.2",
-    "js-cookie": "3.0.5",
-    "jsencrypt": "3.3.2",
-    "nprogress": "0.2.0",
-    "pinia": "2.1.7",
-    "vue": "3.3.9",
-    "vue-cropper": "1.1.1",
-    "vue-router": "4.2.5"
-  },
-  "devDependencies": {
-    "@vitejs/plugin-vue": "4.5.0",
-    "@vue/compiler-sfc": "3.3.9",
-    "autoprefixer": "^10.4.17",
-    "postcss": "^8.4.33",
-    "sass": "1.69.5",
-    "tailwindcss": "^3.4.1",
-    "unplugin-auto-import": "0.17.1",
-    "unplugin-vue-setup-extend-plus": "1.0.0",
-    "vite": "5.0.4",
-    "vite-plugin-compression": "0.5.1",
-    "vite-plugin-svg-icons": "2.0.1"
-  }
-}
+{
+  "name": "ruoyi",
+  "version": "3.8.7",
+  "description": "互动视频管理系统",
+  "author": "若依",
+  "license": "MIT",
+  "type": "module",
+  "scripts": {
+    "dev": "vite",
+    "build:prod": "vite build",
+    "build:stage": "vite build --mode staging",
+    "preview": "vite preview"
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://gitee.com/y_project/RuoYi-Vue.git"
+  },
+  "dependencies": {
+    "@element-plus/icons-vue": "2.3.1",
+    "@vueup/vue-quill": "1.2.0",
+    "@vueuse/core": "10.6.1",
+    "axios": "0.27.2",
+    "echarts": "5.4.3",
+    "element-plus": "2.4.3",
+    "file-saver": "2.0.5",
+    "fuse.js": "6.6.2",
+    "js-cookie": "3.0.5",
+    "jsencrypt": "3.3.2",
+    "nprogress": "0.2.0",
+    "pinia": "2.1.7",
+    "vue": "3.3.9",
+    "vue-cropper": "1.1.1",
+    "vue-router": "4.2.5",
+    "@antv/g6": "^4.8.24",
+    "xgplayer": "^3.0.16"
+  },
+  "devDependencies": {
+    "@vitejs/plugin-vue": "4.5.0",
+    "@vue/compiler-sfc": "3.3.9",
+    "autoprefixer": "^10.4.17",
+    "postcss": "^8.4.33",
+    "sass": "1.69.5",
+    "tailwindcss": "^3.4.1",
+    "unplugin-auto-import": "0.17.1",
+    "unplugin-vue-setup-extend-plus": "1.0.0",
+    "vite": "5.0.4",
+    "vite-plugin-compression": "0.5.1",
+    "vite-plugin-svg-icons": "2.0.1"
+  }
+}

+ 8 - 0
src/api/interactVideo/sourceMaterialManage.js

@@ -23,6 +23,14 @@ export function libraryAdd(data) {
     data,
   });
 }
+// 编辑素材
+export function libraryUpdate(data) {
+  return request({
+    url: "/business/library",
+    method: "put",
+    data,
+  });
+}
 // 删除素材
 export function libraryDelete(materialIds) {
   return request({

+ 34 - 16
src/views/interactVideo/sourceMaterialManage/index.vue

@@ -156,6 +156,7 @@ import {
   libraryAdd,
   getLibraryDetail,
   libraryDelete,
+  libraryUpdate,
 } from "@/api/interactVideo/sourceMaterialManage";
 const { proxy } = getCurrentInstance();
 
@@ -254,6 +255,7 @@ function handleUpdate(row) {
   getLibraryDetail(row.materialId)
     .then((res) => {
       form.value = {
+        materialId: res.data.materialId,
         materialName: res.data.materialName,
         materialType: res.data.materialType,
       };
@@ -270,27 +272,43 @@ function dialogSubmit() {
     if (valid) {
       confirmLoading.value = true;
       console.log(form.value);
-      const { materialName, materialType, fileList } = form.value;
+      const { materialName, materialType, fileList = [] } = form.value;
       formData.append("materialName", materialName);
       formData.append("materialType", materialType);
       fileList.forEach((file) => {
         formData.append("file", file.raw);
       });
-      libraryAdd(formData)
-        .then((res) => {
-          console.log(res);
-          if (res.code == 200) {
-            proxy.$modal.msgSuccess("新增成功");
-            materialOpen.value = false;
-            getList();
-          }
-        })
-        .finally(() => {
-          confirmLoading.value = false;
-        })
-        .catch((err) => {
-          console.log(err);
-        });
+      if (form.value.materialId) {
+        formData.append("materialId", form.value.materialId);
+        libraryUpdate(formData)
+          .then((res) => {
+            console.log(res);
+            if (res.code == 200) {
+              proxy.$modal.msgSuccess("编辑成功");
+              materialOpen.value = false;
+              getList();
+            }
+          })
+          .finally(() => {
+            confirmLoading.value = false;
+          });
+      } else {
+        libraryAdd(formData)
+          .then((res) => {
+            console.log(res);
+            if (res.code == 200) {
+              proxy.$modal.msgSuccess("新增成功");
+              materialOpen.value = false;
+              getList();
+            }
+          })
+          .finally(() => {
+            confirmLoading.value = false;
+          })
+          .catch((err) => {
+            console.log(err);
+          });
+      }
     }
   });
 }