线上课新建、编辑优化

This commit is contained in:
禺狨
2023-03-22 16:39:16 +08:00
parent 2b40133ed8
commit 11896ac9a2
5 changed files with 43 additions and 35 deletions

View File

@@ -105,15 +105,18 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
const selectData = (arr: any, videos: any) => {
const hours: any = [];
console.log(videos);
for (let i = 0; i < videos.length; i++) {
hours.push({
chapter_id: 0,
sort: i,
title: videos[i].name,
type: videos[i].type,
duration: videos[i].duration,
rid: videos[i].rid,
});
if (videos[i].disabled === false) {
hours.push({
chapter_id: 0,
sort: i,
title: videos[i].name,
type: videos[i].type,
duration: videos[i].duration,
rid: videos[i].rid,
});
}
}
courseHour
.storeCourseHourMulti(id, hours)
@@ -135,14 +138,16 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
}
const hours: any = [];
for (let i = 0; i < videos.length; i++) {
hours.push({
chapter_id: data[addvideoCurrent].id,
sort: i,
title: videos[i].name,
type: videos[i].type,
duration: videos[i].duration,
rid: videos[i].rid,
});
if (videos[i].disabled === false) {
hours.push({
chapter_id: data[addvideoCurrent].id,
sort: i,
title: videos[i].name,
type: videos[i].type,
duration: videos[i].duration,
rid: videos[i].rid,
});
}
}
courseHour
.storeCourseHourMulti(id, hours)

View File

@@ -80,7 +80,7 @@ export const CourseUpdate: React.FC<PropInterface> = ({
let box = res.data.dep_ids;
let depIds: any[] = [];
let type = res.data.dep_ids.length > 0 ? "elective" : "open";
if (box.length > 1) {
if (box.length > 0) {
for (let i = 0; i < box.length; i++) {
let item = checkChild(deps, box[i]);
let arr: any[] = [];