diff --git a/src/components/CreatedCourse/chooseFileList.vue b/src/components/CreatedCourse/chooseFileList.vue
index b44ae0bf..d5c5e1b0 100644
--- a/src/components/CreatedCourse/chooseFileList.vue
+++ b/src/components/CreatedCourse/chooseFileList.vue
@@ -2,7 +2,11 @@
import { reactive, onMounted, ref, h } from "vue";
import { ElButton, ElInput, ElUpload, ElMessage } from "element-plus";
import BasicTable from "@/components/BasicElTable/BasicTable.vue";
-import { getPageListByType, getType, getMapsItem } from "@/hooks/useCreateCourseMaps";
+import {
+ getPageListByType,
+ getType,
+ getMapsItem,
+} from "@/hooks/useCreateCourseMaps";
import apiCourseFile from "@/api/modules/courseFile";
import { useRoute } from "vue-router";
import Cookies from "vue-cookies";
@@ -83,6 +87,20 @@ const columns = [
width: 150,
render: (params) => {
return h("div", [
+ h(
+ ElButton,
+ {
+ type: "primary",
+ size: "small",
+ style: {
+ display: [40, 50, 62].includes(props.resType) ? "" : "none",
+ },
+ onClick: () => {
+ handlePreviewItem(params.row);
+ },
+ },
+ "预览"
+ ),
h(
ElButton,
{
@@ -100,7 +118,7 @@ const columns = [
];
// 事件发射
-const emit = defineEmits(["chooseItem"]);
+const emit = defineEmits(["chooseItem", "choosePreviewItem"]);
// 处理选择项目
const handleChooseItem = (row) => {
@@ -110,9 +128,20 @@ const handleChooseItem = (row) => {
completeSetup: 0,
setupTage: "",
resType: props.resType,
+ dir: props.resType === 50 ? "scorm" : "course",
});
};
+const handlePreviewItem = (row) => {
+ emit("choosePreviewItem", {
+ ...row,
+ isDrag: false,
+ completeSetup: 0,
+ setupTage: "",
+ resType: props.resType,
+ dir: props.resType === 50 ? "scorm" : "course",
+ });
+};
// 分页改变处理
const changePagination = (PAGINATION) => {
Object.assign(pagination, PAGINATION);
@@ -128,7 +157,7 @@ const getVideoList = () => {
pageIndex: pagination.current,
self: true,
};
-
+
getPageListByType(paramsData).then((res) => {
loading.value = false;
tableData.value = res.result.list;
@@ -136,15 +165,6 @@ const getVideoList = () => {
});
};
-// 选择项目处理
-const chooseItem = () => {
- showDialog.value = false;
- emit("chooseItem", {
- ...dialogVideoForm,
- type: props.resType,
- });
-};
-
// 上传成功处理
const handleUploadSuccess = (res, file) => {
if (res.status === 200) {
@@ -160,7 +180,7 @@ const handleUploadSuccess = (res, file) => {
duration: routeQuery.duration,
remark: "课程中直接上传",
};
-
+
apiCourseFile.saveUpload(courseWare).then((rs) => {
if (rs.status === 200) {
emit("chooseItem", {
@@ -183,39 +203,46 @@ const handleBeforeUpload = (file) => {
ElMessage({ message: `文件格式不正确!`, type: "error", offset: 100 });
return false;
}
-
+
let fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
fileExtension = fileExtension.toLowerCase();
-
+
// 校检文件类型
- if (getMapsItem(props.resType).fileType.join(",").indexOf(fileExtension) === -1) {
+ if (
+ getMapsItem(props.resType).fileType.join(",").indexOf(fileExtension) === -1
+ ) {
ElMessage({
- message: `文件格式不正确, 请上传正确格式的${getMapsItem(props.resType).name}文件!`,
+ message: `文件格式不正确, 请上传正确格式的${
+ getMapsItem(props.resType).name
+ }文件!`,
type: "error",
offset: 100,
});
return false;
}
-
+
// 校检文件大小
if (getMapsItem(props.resType).uploadSize) {
- const isLt = file.size / 1024 / 1024 < getMapsItem(props.resType).uploadSize;
+ const isLt =
+ file.size / 1024 / 1024 < getMapsItem(props.resType).uploadSize;
if (!isLt) {
ElMessage({
- message: `上传文件大小不能超过 ${getMapsItem(props.resType).uploadSize} !`,
+ message: `上传文件大小不能超过 ${
+ getMapsItem(props.resType).uploadSize
+ } !`,
type: "error",
offset: 100,
});
return false;
}
}
-
+
if (props.resType === 50) {
dialogVideoForm.dir = "scorm";
} else {
dialogVideoForm.dir = "course";
}
-
+
return true;
};
@@ -237,7 +264,9 @@ onMounted(() => {
:file-list="fileList"
:before-upload="handleBeforeUpload"
>
- 上传新{{ getType(props.resType) }}
@@ -282,4 +311,4 @@ onMounted(() => {
}
}
}
-
\ No newline at end of file
+
diff --git a/src/components/CreatedCourse/preview/ScormComp.vue b/src/components/CreatedCourse/preview/ScormComp.vue
new file mode 100644
index 00000000..d699a184
--- /dev/null
+++ b/src/components/CreatedCourse/preview/ScormComp.vue
@@ -0,0 +1,70 @@
+
+
+
+
+
+ updateFormValue('name', val)"
+ >
+
+
+
+
+
+
diff --git a/src/hooks/useCreateCourseMaps.js b/src/hooks/useCreateCourseMaps.js
index 5aaed478..a8255c1a 100644
--- a/src/hooks/useCreateCourseMaps.js
+++ b/src/hooks/useCreateCourseMaps.js
@@ -67,7 +67,7 @@ const contentTypeMaps = [
},
{
type: 50,
- name: "scorm",
+ name: "SCORM",
icon: "icon-file",
// 1G B
uploadSize: 1024 * 1024 * 1024,
diff --git a/src/views/courselibrary/components/createCourse.vue b/src/views/courselibrary/components/createCourse.vue
index 7983c4ed..f0a23ba8 100644
--- a/src/views/courselibrary/components/createCourse.vue
+++ b/src/views/courselibrary/components/createCourse.vue
@@ -13,8 +13,16 @@ 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 LinkComp from "@/components/CreatedCourse/preview/LinkComp.vue";
+import ScormComp from "@/components/CreatedCourse/preview/ScormComp.vue";
import { getType } from "@/hooks/useCreateCourseMaps";
-const mapComponents = [VideoComp, AudioComp, EditorComp, DocComp, LinkComp];
+const mapComponents = [
+ VideoComp,
+ AudioComp,
+ EditorComp,
+ DocComp,
+ LinkComp,
+ ScormComp,
+];
// 使用课程数据hook
const { courseMetadata, courseList, courseActionButtons, addChapter } =
@@ -52,7 +60,9 @@ const courseOperations = {
showSettingDialog.value = true;
},
addScorm: () => {
- console.log("添加SCORM功能调用");
+ courseMetadata.resType = 50;
+ showDialog.value = true;
+ isNext.value = false;
},
addExam: () => {
console.log("添加考试功能调用");
@@ -69,6 +79,7 @@ const executeCourseOperation = (operationName, data) => {
courseMetadata.chooseIndex = data;
courseMetadata.selectionIndex = null;
isPreview.value = false;
+ isNext.value = true;
chooseItemData.value = {};
if (courseOperations[operationName]) {
courseOperations[operationName](data);
@@ -77,6 +88,7 @@ const executeCourseOperation = (operationName, data) => {
}
};
const chooseItem = (data) => {
+ console.log(data);
chooseItemData.value = data;
if (!isNext.value) {
saveContent();
@@ -84,6 +96,11 @@ const chooseItem = (data) => {
}
showSettingDialog.value = true;
};
+const choosePreviewItem = (data) => {
+ chooseItemData.value = data;
+ showSettingDialog.value = true;
+ isPreview.value = true;
+};
// 保存
const saveContent = () => {
if (courseMetadata.selectionIndex !== null) {
@@ -180,6 +197,7 @@ const previewRow = (data) => {
diff --git a/src/views/courselibrary/components/dragTable.vue b/src/views/courselibrary/components/dragTable.vue
index 7311e26a..83da1703 100644
--- a/src/views/courselibrary/components/dragTable.vue
+++ b/src/views/courselibrary/components/dragTable.vue
@@ -239,7 +239,7 @@ const renderActionColumn = () => {
href: "javascript:void(0)",
onClick: () => handleSetting(index, record),
style: {
- display: [40].includes(record.resType) ? "none" : "",
+ display: [40, 50].includes(record.resType) ? "none" : "",
},
},
[