线上课编辑优化

This commit is contained in:
禺狨 2023-03-17 17:30:50 +08:00
parent 40cb7ac0ab
commit 486deb36f0

View File

@ -88,6 +88,7 @@ export const CourseUpdate: React.FC<PropInterface> = ({
course.course(id).then((res: any) => { course.course(id).then((res: any) => {
let box = res.data.dep_ids; let box = res.data.dep_ids;
let depIds: any[] = []; let depIds: any[] = [];
let type = res.data.dep_ids.length > 0 ? "elective" : "open";
if (box.length > 1) { if (box.length > 1) {
for (let i = 0; i < box.length; i++) { for (let i = 0; i < box.length; i++) {
let item = checkChild(deps, box[i]); let item = checkChild(deps, box[i]);
@ -136,10 +137,11 @@ export const CourseUpdate: React.FC<PropInterface> = ({
thumb: res.data.course.thumb, thumb: res.data.course.thumb,
dep_ids: depIds, dep_ids: depIds,
category_ids: categoryIds, category_ids: categoryIds,
type: "open", type: type,
desc: "", desc: "",
hasChapter: chapterType, hasChapter: chapterType,
}); });
setType(type);
setThumb(res.data.course.thumb); setThumb(res.data.course.thumb);
setChapterType(chapterType); setChapterType(chapterType);
if (chapterType === 1) { if (chapterType === 1) {