feat(course): 添加自定义考试功能并优化试卷组件

- 新增自定义考试试卷类型支持
- 实现试卷预览和编辑功能
- 添加试题管理组件,支持单选、多选、判断题
- 集成雪花ID生成器用于试题唯一标识
- 优化课程创建流程,支持考试内容配置
- 扩展SCSS样式库,增加flex布局和间距工具类
- 新增课程API模块,完善考试相关接口
- 实现试卷内容动态加载和保存逻辑
This commit is contained in:
陈昱达
2025-11-25 14:45:44 +08:00
parent f07582d5c1
commit 6c87968ab4
8 changed files with 1240 additions and 14 deletions

View File

@@ -118,18 +118,41 @@ const columns = [
];
// 事件发射
const emit = defineEmits(["chooseItem", "choosePreviewItem"]);
const emit = defineEmits(["chooseItem", "choosePreviewItem", "chooseCusExam"]);
// 处理选择项目
const handleChooseItem = (row) => {
emit("chooseItem", {
switch (props.resType) {
case 61:
console.log(row);
if (row.counts === 0) {
ElMessage.error("此试卷无试题内容,请重新选择");
return;
}
break;
default:
// emit("chooseItem", {
// ...row,
// isDrag: false,
// completeSetup: 0,
// setupTage: "",
// resType: props.resType,
// dir: props.resType === 50 ? "scorm" : "course",
// });
break;
}
let obj = {
...row,
isDrag: false,
completeSetup: 0,
setupTage: "",
resType: props.resType,
dir: props.resType === 50 ? "scorm" : "course",
});
};
if (props.resType === 61) {
obj.paperType = 2;
}
emit("chooseItem", obj);
};
const handlePreviewItem = (row) => {
@@ -267,6 +290,14 @@ const handleBeforeUpload = (file) => {
return true;
};
const openCusExam = () => {
emit("chooseCusExam", {
resType: props.resType,
dir: props.resType === 50 ? "scorm" : "course",
paperType: 1,
name: "自定义考试",
});
};
// 生命周期
onMounted(() => {
@@ -292,7 +323,10 @@ onMounted(() => {
>上传新{{ getType(props.resType) }}</el-button
>
</el-upload>
<el-button v-if="[61].includes(props.resType)" type="primary"
<el-button
v-if="[61].includes(props.resType)"
type="primary"
@click="openCusExam"
>自定义考试</el-button
>
<span class="desc ml10" v-if="![61].includes(props.resType)"