feat(course): 新增音视频与图文组件支持

- 新增 AudioComp.vue 组件,支持音频播放与设置
- 新增 EditorComp.vue 组件,集成富文本编辑器用于图文内容
- 修改 chooseFileList.vue,增加文件上传功能与类型适配
- 更新 createCourse.vue,完善课程章节内容管理逻辑
- 升级 useCourseData.js 和 useCreateCourseMaps.js,增强类型映射与数据结构
- 优化 BasicTable.vue,移除调试日志并调整样式
- 引入 quill 及相关插件依赖以支持富文本编辑功能
This commit is contained in:
陈昱达
2025-11-24 14:07:33 +08:00
parent 6528491334
commit cc1af6a11e
10 changed files with 526 additions and 100 deletions

View File

@@ -1,24 +1,21 @@
<script setup>
import { reactive, onMounted, ref, h, watch } from "vue";
import {
ElButton,
ElInput,
ElDialog,
ElForm,
ElFormItem,
ElRadioGroup,
ElRadio,
ElInputNumber,
} from "element-plus";
import { ElButton, ElInput, ElUpload } from "element-plus";
import BasicTable from "@/components/BasicElTable/BasicTable.vue";
import { getPageListByType } from "@/hooks/useCreateCourseMaps";
const props = defineProps({});
import { getType, getMapsItem } from "@/hooks/useCreateCourseMaps";
import Cookies from "vue-cookies";
const props = defineProps({
resType: {
type: Number,
default: "",
},
});
const tableData = ref([]);
const form = reactive({
name: "",
resType: 10,
resType: props.resType,
});
let pagination = reactive({
pageSize: 10,
@@ -74,7 +71,7 @@ const columns = [
isDrag: false,
completeSetup: 0,
setupTage: "",
resType: 10,
resType: props.resType,
});
},
},
@@ -108,25 +105,31 @@ const chooseItem = (type) => {
showDialog.value = false;
emit("chooseItem", {
...dialogVideoForm,
type: 10,
type: props.resType,
});
// postData.content=this.cware.content;
// this.cwareChange.content = deepClone(this.cware.content)
// if(this.cware.content.contentType==52){
// if(this.cware.linkInfo.url==''){
// this.$message.error("请填写外连URL地址");
// return;
// }
// postData.content.content=JSON.stringify(this.cware.linkInfo);
// this.cwareChange.linkInfo = deepClone(this.cware.linkInfo)
// }else if(this.cware.content.contentType==10 || this.cware.content.contentType==20){
// if(this.cware.curriculumData.url==''){
// this.$message.error("请选择课件");
// return;
// }
// postData.content.content=JSON.stringify(this.cware.curriculumData);
// this.cwareChange.curriculumData = deepClone(this.cware.curriculumData)
// }
};
const uploadData = reactive({
headers: {
"XBOE-Access-Token": Cookies.get("token"),
},
data: {
dir: "course",
},
actionUrl: process.env.VUE_APP_SYS_API + "/xboe/sys/xuploader/file/upload",
});
const fileList = ref([]);
const uploadSuccess = (result) => {
if (result.status === 200) {
emit("chooseItem", {
...dialogVideoForm,
name: result.result.displayName,
resType: props.resType,
...result.result,
});
fileList.value = [];
}
};
onMounted(() => {
@@ -135,20 +138,36 @@ onMounted(() => {
</script>
<template>
<div class="add-video" v-if="!isPreview && !isSetting">
<div class="add-video">
<div class="add-vide-header">
<div>
<el-button>上传新视频</el-button>
<span class="desc ml10">文件大小限制1G,支持的文件类型:mp4 </span>
<div style="display: flex; align-items: center">
<el-upload
:action="uploadData.actionUrl"
:headers="uploadData.headers"
:data="uploadData.data"
:on-success="uploadSuccess"
:file-list="fileList"
>
<el-button v-if="[10, 20].includes(props.resType)" type="primary"
>上传新{{ getType(props.resType) }}</el-button
>
</el-upload>
<span class="desc ml10"
>文件大小限制{{
getMapsItem(props.resType).uploadSizeName
}},支持的文件类型:{{ getMapsItem(props.resType).fileType.join(",") }}
</span>
</div>
<div>
<el-input
style="width: 150px"
placeholder="请输入视频名称"
:placeholder="`请输入${getType(props.resType)}名称`"
v-model="form.name"
clearable
></el-input>
<el-button class="ml10" @click="getVideoList">查询</el-button>
<el-button class="ml10" @click="getVideoList" type="primary"
>查询</el-button
>
</div>
</div>
<div class="mt10">