mirror of
https://github.com/PlayEdu/backend
synced 2025-12-27 23:40:15 +08:00
选择视频、课件组件重构
This commit is contained in:
@@ -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) => {
|
||||
|
||||
@@ -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("请选择视频");
|
||||
|
||||
Reference in New Issue
Block a user