From f77d3549536487c43043c07f9cdddabf465f9740 Mon Sep 17 00:00:00 2001 From: none Date: Fri, 3 Mar 2023 09:45:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E6=97=B6api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/course-hour.ts | 52 ++++++++++++++++++++++++++++++++++++++++++ src/api/course.ts | 2 ++ 2 files changed, 54 insertions(+) create mode 100644 src/api/course-hour.ts 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,