mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-20 00:06:47 +08:00
feat(course): 添加文档类型资源支持
- 新增文档组件 DocComp.vue,支持 PDF 预览功能 - 在 createCourse.vue 中集成文档类型处理逻辑 - 更新 chooseFileList.vue 支持文档类型上传 - 重构音视频组件,提取公共逻辑至 useMediaComponent hook - 统一文件路径前缀为 fileBaseUrl,替换硬编码地址 - 调整拖拽表格操作按钮样式及显示逻辑 - 添加 pdf-vue3 依赖用于 PDF 渲染支持 - TODO - 上传文件目前缺少id 无法进行预览 这是一个问题!
This commit is contained in:
@@ -11,8 +11,9 @@ import chooseFileList from "@/components/CreatedCourse/chooseFileList.vue";
|
||||
import VideoComp from "@/components/CreatedCourse/preview/VideoComp.vue";
|
||||
import AudioComp from "@/components/CreatedCourse/preview/AudioComp.vue";
|
||||
import EditorComp from "@/components/CreatedCourse/preview/EditorComp.vue";
|
||||
import DocComp from "@/components/CreatedCourse/preview/DocComp.vue";
|
||||
import { getType } from "@/hooks/useCreateCourseMaps";
|
||||
const mapComponents = [VideoComp, AudioComp, EditorComp];
|
||||
const mapComponents = [VideoComp, AudioComp, EditorComp, DocComp];
|
||||
|
||||
// 使用课程数据hook
|
||||
const { courseMetadata, courseList, courseActionButtons, addChapter } =
|
||||
@@ -20,6 +21,8 @@ const { courseMetadata, courseList, courseActionButtons, addChapter } =
|
||||
const isPreview = ref(false);
|
||||
const chooseItemData = ref({});
|
||||
const showSettingDialog = ref(false);
|
||||
const isNext = ref(true);
|
||||
const showTablePreview = ref(false);
|
||||
// 定义表格列
|
||||
const showDialog = ref(false);
|
||||
// 课程操作映射
|
||||
@@ -32,7 +35,11 @@ const courseOperations = {
|
||||
courseMetadata.resType = 20;
|
||||
showDialog.value = true;
|
||||
},
|
||||
addDocument: () => {},
|
||||
addDocument: () => {
|
||||
courseMetadata.resType = 40;
|
||||
showDialog.value = true;
|
||||
isNext.value = false;
|
||||
},
|
||||
addImageText: () => {
|
||||
courseMetadata.resType = 41;
|
||||
chooseItemData.value.resType = 41;
|
||||
@@ -67,6 +74,10 @@ const executeCourseOperation = (operationName, data) => {
|
||||
};
|
||||
const chooseItem = (data) => {
|
||||
chooseItemData.value = data;
|
||||
if (!isNext.value) {
|
||||
saveContent();
|
||||
return;
|
||||
}
|
||||
showSettingDialog.value = true;
|
||||
};
|
||||
// 保存
|
||||
@@ -166,6 +177,7 @@ const previewRow = (data) => {
|
||||
v-if="showDialog"
|
||||
@chooseItem="chooseItem"
|
||||
:resType="courseMetadata.resType"
|
||||
:showTablePreview="showTablePreview"
|
||||
></chooseFileList>
|
||||
</el-dialog>
|
||||
|
||||
@@ -175,9 +187,10 @@ const previewRow = (data) => {
|
||||
:title="isPreview ? '预览' : getType(chooseItemData.resType)"
|
||||
>
|
||||
<div v-for="item in mapComponents">
|
||||
{{ chooseItemData.resType }}, {{ item }}
|
||||
<component
|
||||
v-if="Number(chooseItemData.resType) === item.resType"
|
||||
v-if="
|
||||
Number(chooseItemData.resType) === item.resType && showSettingDialog
|
||||
"
|
||||
:is="item"
|
||||
v-model:dialogVideoForm="chooseItemData"
|
||||
:isPreview="isPreview"
|
||||
|
||||
Reference in New Issue
Block a user