课件新增api增加

This commit is contained in:
unknown 2023-07-29 10:27:28 +08:00
parent c4955adb03
commit 1556d8ec03
4 changed files with 28 additions and 2 deletions

View File

@ -0,0 +1,22 @@
import client from "./internal/httpClient";
export function updateCourseAttachment(
courseId: number,
id: number,
chapterId: number,
name: string,
type: string,
rid: number
) {
return client.put(`/backend/v1/course/${courseId}/attachment/create-batch`, {
chapter_id: chapterId,
name,
type,
sort: 0,
rid,
});
}
export function destroyAttachment(courseId: number, id: number) {
return client.destroy(`/backend/v1/course/${courseId}/attachment/${id}`);
}

View File

@ -35,7 +35,8 @@ export function storeCourse(
depIds: number[], depIds: number[],
categoryIds: number[], categoryIds: number[],
chapters: number[], chapters: number[],
hours: number[] hours: number[],
attachments: any[]
) { ) {
return client.post("/backend/v1/course/create", { return client.post("/backend/v1/course/create", {
title: title, title: title,
@ -47,6 +48,7 @@ export function storeCourse(
category_ids: categoryIds, category_ids: categoryIds,
chapters: chapters, chapters: chapters,
hours: hours, hours: hours,
attachments: attachments,
}); });
} }

View File

@ -6,6 +6,7 @@ export * as courseCategory from "./course-category";
export * as courseChapter from "./course-chapter"; export * as courseChapter from "./course-chapter";
export * as course from "./course"; export * as course from "./course";
export * as courseHour from "./course-hour"; export * as courseHour from "./course-hour";
export * as courseAttachment from "./course-attachment";
export * as department from "./department"; export * as department from "./department";
export * as resourceCategory from "./resource-category"; export * as resourceCategory from "./resource-category";
export * as resource from "./resource"; export * as resource from "./resource";

View File

@ -224,7 +224,8 @@ export const CourseCreate: React.FC<PropInterface> = ({
dep_ids, dep_ids,
values.category_ids, values.category_ids,
chapters, chapters,
treeData treeData,
[]
) )
.then((res: any) => { .then((res: any) => {
message.success("保存成功!"); message.success("保存成功!");