选择视频、课件组件重构

This commit is contained in:
unknown
2023-07-31 10:44:32 +08:00
parent 8e5c072634
commit 2ce6292f44
8 changed files with 247 additions and 306 deletions

View File

@@ -69,19 +69,19 @@ export const CourseAttachmentUpdate: React.FC<PropInterface> = ({
const selectAttachmentData = (arr: any, videos: any) => {
const hours: any = [];
for (let i = 0; i < videos.length; i++) {
if (videos[i].disabled === false) {
hours.push({
sort: attachmentData.length + i,
title: videos[i].name,
type: videos[i].type,
rid: videos[i].rid,
});
}
hours.push({
sort: attachmentData.length + i,
title: videos[i].name,
type: videos[i].type,
rid: videos[i].rid,
});
}
if (hours.length === 0) {
message.error("请选择视频");
message.error("请选择课件");
return;
}
console.log(hours);
courseAttachment
.storeCourseAttachmentMulti(id, hours)
.then((res: any) => {

View File

@@ -100,16 +100,14 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
const selectData = (arr: any, videos: any) => {
const hours: any = [];
for (let i = 0; i < videos.length; i++) {
if (videos[i].disabled === false) {
hours.push({
chapter_id: 0,
sort: treeData.length + i,
title: videos[i].name,
type: videos[i].type,
duration: videos[i].duration,
rid: videos[i].rid,
});
}
hours.push({
chapter_id: 0,
sort: treeData.length + i,
title: videos[i].name,
type: videos[i].type,
duration: videos[i].duration,
rid: videos[i].rid,
});
}
if (hours.length === 0) {
message.error("请选择视频");
@@ -135,16 +133,14 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
}
const hours: any = [];
for (let i = 0; i < videos.length; i++) {
if (videos[i].disabled === false) {
hours.push({
chapter_id: data[addvideoCurrent].id,
sort: data[addvideoCurrent].hours.length + i,
title: videos[i].name,
type: videos[i].type,
duration: videos[i].duration,
rid: videos[i].rid,
});
}
hours.push({
chapter_id: data[addvideoCurrent].id,
sort: data[addvideoCurrent].hours.length + i,
title: videos[i].name,
type: videos[i].type,
duration: videos[i].duration,
rid: videos[i].rid,
});
}
if (hours.length === 0) {
message.error("请选择视频");