diff --git a/src/api/course-hour.ts b/src/api/course-hour.ts new file mode 100644 index 0000000..207e8f1 --- /dev/null +++ b/src/api/course-hour.ts @@ -0,0 +1,52 @@ +import client from "./internal/httpClient"; + +export function courseHourList(courseId: number) { + return client.get(`/backend/v1/course/${courseId}/course-hour/index`, {}); +} + +export function createCourseHour(courseId: number) { + return client.get(`/backend/v1/course/${courseId}/course-hour/create`, {}); +} + +export function storeCourseHour( + courseId: number, + chapterId: number, + title: string, + type: string, + druation: number, + publishedAt: string +) { + return client.post(`/backend/v1/course/${courseId}/course-hour/create`, { + chapter_id: chapterId, + title, + type, + druation, + published_at: publishedAt, + }); +} + +export function courseHour(courseId: number, id: number) { + return client.get(`/backend/v1/course/${courseId}/course-hour/${id}`, {}); +} + +export function updateCourseHour( + courseId: number, + id: number, + chapterId: number, + title: string, + type: string, + druation: number, + publishedAt: string +) { + return client.post(`/backend/v1/course/${courseId}/course-hour/${id}`, { + chapter_id: chapterId, + title, + type, + druation, + published_at: publishedAt, + }); +} + +export function destroyCourseHour(courseId: number, id: number) { + return client.destroy(`/backend/v1/course/${courseId}/course-hour/${id}`); +} diff --git a/src/api/course.ts b/src/api/course.ts index b674ce6..503f89a 100644 --- a/src/api/course.ts +++ b/src/api/course.ts @@ -24,6 +24,8 @@ export function createCourse() { return client.get("/backend/v1/course/create", {}); } +// depIds => 部门id数组,请用英文逗号连接 +// categoryIds => 所属分类数组,请用英文逗号连接 export function storeCourse( title: string, thumb: string,