Explorar o código

删除章节、删除课件,修复侧边栏触发函数

dusenyao hai 21 horas
pai
achega
87425aa928

+ 9 - 0
src/api/book.js

@@ -54,6 +54,15 @@ export function ChapterAddChapterToBook(data) {
 export function ChapterAddCoursewareToBook(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=book_chapter_manager-AddCoursewareToBook`, data);
 }
+
+/**
+ * @description 删除课件
+ * @param {object} data
+ */
+export function ChapterDeleteCourseware(data) {
+  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=book_chapter_manager-DeleteCourseware`, data);
+}
+
 /**
  * @description 修改章节
  * @param {object} data

+ 24 - 23
src/components/CommonPreview.vue

@@ -51,13 +51,13 @@
       </div>
       <div ref="sidebarMenu" class="sidebar">
         <div
-          v-for="item in sidebarIconList"
-          :key="item.icon"
-          :title="item.title"
+          v-for="{ icon, title, handle, param } in sidebarIconList"
+          :key="icon"
+          :title="title"
           class="sidebar-icon"
-          @click="handleSidebarClick(item)"
+          @click="handleSidebarClick(handle, param)"
         >
-          <SvgIcon :icon-class="`sidebar-${item.icon}`" size="24" />
+          <SvgIcon :icon-class="`sidebar-${icon}`" size="24" />
         </div>
       </div>
       <el-drawer
@@ -231,15 +231,16 @@ export default {
         componentId: 'WHOLE',
       },
       sidebarIconList: [
-        { icon: 'search', title: '搜索', handle: '' },
-        { icon: 'mindmap', title: '思维导图', handle: 'openMindMap' },
-        { icon: 'connect', title: '连接', handle: '' },
-        { icon: 'audio', title: '音频', handle: 'openDrawer', type: '1' },
-        { icon: 'image', title: '图片', handle: 'openDrawer', type: '0' },
-        { icon: 'video', title: '视频', handle: 'openDrawer', type: '2' },
-        { icon: 'text', title: '文本', handle: '' },
-        { icon: 'collect', title: '收藏', handle: '' },
-        { icon: 'setting', title: '设置', handle: '' },
+        { icon: 'search', title: '搜索', handle: '', param: {} },
+        { icon: 'mindmap', title: '思维导图', handle: 'openMindMap', param: {} },
+        { icon: 'connect', title: '连接', handle: '', param: {} },
+        { icon: 'audio', title: '音频', handle: 'openDrawer', param: { type: '1' } },
+        { icon: 'image', title: '图片', handle: 'openDrawer', param: { type: '0' } },
+        { icon: 'video', title: '视频', handle: 'openDrawer', param: { type: '2' } },
+        { icon: 'text', title: '文本', handle: '', param: {} },
+        { icon: 'file', title: '文件', handle: '', param: {} },
+        { icon: 'collect', title: '收藏', handle: '', param: {} },
+        { icon: 'setting', title: '设置', handle: '', param: {} },
       ],
       visibleMindMap: false,
       isChildDataLoad: false,
@@ -426,14 +427,10 @@ export default {
      * @param {string} handle - 处理函数名
      * @param {any} param - 处理函数参数
      */
-    handleSidebarClick(item) {
-      let handle = item.handle;
-      if (typeof this[handle] === 'function') {
-        this[handle](item.type);
+    handleSidebarClick(handle, param) {
+      if (typeof handle === 'string' && handle && typeof this[handle] === 'function') {
+        this[handle](param);
       }
-      // if (typeof handle === 'string' && handle && typeof this[handle] === 'function') {
-      //   this[handle](param);
-      // }
     },
 
     openMindMap() {
@@ -475,8 +472,12 @@ export default {
         };
       }
     },
-    // 打开抽屉并初始化加载
-    openDrawer(type) {
+    /**
+     * 打开抽屉并初始化加载
+     * @param {Object} param - 抽屉参数
+     * @param {string} param.type - 抽屉类型(0: 图片, 1: 音频, 2: 视频)
+     */
+    openDrawer({ type }) {
       if (this.drawerType === type) {
         this.drawerType = '';
         return;

+ 1 - 1
src/icons/svg/file.svg

@@ -5,4 +5,4 @@
   <path
     d="M694.6 234.3H329.4c-18.9 0-34.2 15.3-34.2 34.2s15.3 34.3 34.2 34.3h365.2c18.9 0 34.2-15.3 34.2-34.3 0-18.9-15.3-34.2-34.2-34.2z m0 136.9H329.4c-18.9 0-34.2 15.3-34.2 34.2s15.3 34.2 34.2 34.2h365.2c18.9 0 34.2-15.3 34.2-34.2s-15.3-34.2-34.2-34.2zM799.5 64h-575c-47.1 0-85.2 38.1-85.2 85.2v725.6c0 47 38.1 85.2 85.2 85.2h575c47 0 85.2-38.2 85.2-85.2V149.2c0-47.1-38.1-85.2-85.2-85.2z m0 768.2c0 23.5-19.1 42.5-42.6 42.5H267.1c-23.5 0-42.6-19.1-42.6-42.5V191.8c0-23.6 19.1-42.6 42.6-42.6h489.8c23.5 0 42.6 19.1 42.6 42.6v640.4z m-104.9-324H329.4c-18.9 0-34.2 15.3-34.2 34.2s15.3 34.3 34.2 34.3h365.2c18.9 0 34.2-15.3 34.2-34.3 0-18.9-15.3-34.2-34.2-34.2z"
     fill="currentColor" p-id="11771"></path>
-</svg>
+</svg>

+ 8 - 0
src/icons/svg/sibebar/sidebar-file.svg

@@ -0,0 +1,8 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1747197509965"
+  class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11770"
+  xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200">
+  <path
+    d="M694.6 234.3H329.4c-18.9 0-34.2 15.3-34.2 34.2s15.3 34.3 34.2 34.3h365.2c18.9 0 34.2-15.3 34.2-34.3 0-18.9-15.3-34.2-34.2-34.2z m0 136.9H329.4c-18.9 0-34.2 15.3-34.2 34.2s15.3 34.2 34.2 34.2h365.2c18.9 0 34.2-15.3 34.2-34.2s-15.3-34.2-34.2-34.2zM799.5 64h-575c-47.1 0-85.2 38.1-85.2 85.2v725.6c0 47 38.1 85.2 85.2 85.2h575c47 0 85.2-38.2 85.2-85.2V149.2c0-47.1-38.1-85.2-85.2-85.2z m0 768.2c0 23.5-19.1 42.5-42.6 42.5H267.1c-23.5 0-42.6-19.1-42.6-42.5V191.8c0-23.6 19.1-42.6 42.6-42.6h489.8c23.5 0 42.6 19.1 42.6 42.6v640.4z m-104.9-324H329.4c-18.9 0-34.2 15.3-34.2 34.2s15.3 34.3 34.2 34.3h365.2c18.9 0 34.2-15.3 34.2-34.3 0-18.9-15.3-34.2-34.2-34.2z"
+    fill="currentColor" p-id="11771"></path>
+</svg>

+ 2 - 2
src/views/create_project/createSuccess.vue

@@ -1,10 +1,10 @@
 <template>
   <div class="create-success">
-    <p class="tips">教材编辑项目《{{ project_name }}》创建成功,请切换到“个人工作台” > “我的项目”进行管理。</p>
+    <p class="tips">教材编辑项目《{{ project_name }}》创建成功,请切换到“教材管理” > “我的项目”进行管理。</p>
     <div class="btns">
       <el-button type="primary" @click="$router.push('/create_project/create')">创建新的项目</el-button>
       <el-button type="primary" @click="$router.push('/personal_workbench/project')">
-        跳转到“个人工作台” > “我的项目”
+        跳转到“教材管理” > “我的项目”
       </el-button>
     </div>
   </div>

+ 34 - 9
src/views/personal_workbench/project/ProductionEditorialManage.vue

@@ -52,7 +52,9 @@
             <span class="link">修改</span>
             <span class="link" @click="openSetProducer(id)">设置制作人</span>
             <span class="link" @click="openSetAuditor(id)">设置审校人</span>
-            <span class="link danger" @click="deleteChapter(id)">删除</span>
+            <span class="link danger" @click="is_leaf_chapter === 'true' ? deleteCourseware(id) : deleteChapter(id)">
+              删除
+            </span>
           </div>
         </div>
       </div>
@@ -101,6 +103,7 @@ import {
   ChapterAddChapterToBook,
   ChapterAddCoursewareToBook,
   ChapterDeleteChapter,
+  ChapterDeleteCourseware,
   ChapterSetProducer,
 } from '@/api/book';
 
@@ -210,10 +213,6 @@ export default {
       this.addType = 'chapter';
     },
     addCoursewareDialog() {
-      if (this.curSelectId === '') {
-        this.$message.error('请先选择章节');
-        return;
-      }
       this.visible = true;
       this.addType = 'courseware';
     },
@@ -234,10 +233,36 @@ export default {
      * @param {string} id - 章节ID
      */
     deleteChapter(id) {
-      ChapterDeleteChapter({ id, is_force_delete: 'true' }).then(() => {
-        this.getBookChapterStructExpandList();
-        this.$message.success('删除成功');
-      });
+      this.$confirm('是否确认删除该章节?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      })
+        .then(() => {
+          ChapterDeleteChapter({ id }).then(() => {
+            this.getBookChapterStructExpandList();
+            this.$message.success('删除成功');
+          });
+        })
+        .catch(() => {});
+    },
+    /**
+     * 删除课件
+     * @param {string} id - 课件ID
+     */
+    deleteCourseware(id) {
+      this.$confirm('是否确认删除该课件?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      })
+        .then(() => {
+          ChapterDeleteCourseware({ id }).then(() => {
+            this.getBookChapterStructExpandList();
+            this.$message.success('删除成功');
+          });
+        })
+        .catch(() => {});
     },
     openSetProducer(id) {
       this.producer.visible = true;