mirror of
https://github.com/PlayEdu/backend
synced 2025-06-27 22:32:44 +08:00
课程api定义
This commit is contained in:
parent
5a68b1487b
commit
1a3ca7ad33
66
src/api/course.ts
Normal file
66
src/api/course.ts
Normal file
@ -0,0 +1,66 @@
|
||||
import client from "./internal/httpClient";
|
||||
|
||||
export function courseList(
|
||||
page: number,
|
||||
size: number,
|
||||
sortField: string,
|
||||
sortAlgo: string,
|
||||
title: string,
|
||||
depIds: string,
|
||||
categoryIds: string
|
||||
) {
|
||||
return client.get("/backend/v1/course/index", {
|
||||
page: page,
|
||||
size: size,
|
||||
sort_field: sortField,
|
||||
sort_algo: sortAlgo,
|
||||
title: title,
|
||||
dep_ids: depIds,
|
||||
category_ids: categoryIds,
|
||||
});
|
||||
}
|
||||
|
||||
export function createCourse() {
|
||||
return client.get("/backend/v1/course/create", {});
|
||||
}
|
||||
|
||||
export function storeCourse(
|
||||
title: string,
|
||||
thumb: string,
|
||||
isShow: number,
|
||||
depIds: number[],
|
||||
categoryIds: number[]
|
||||
) {
|
||||
return client.post("/backend/v1/course/create", {
|
||||
title: title,
|
||||
thumb: thumb,
|
||||
isShow: isShow,
|
||||
dep_ids: depIds,
|
||||
category_ids: categoryIds,
|
||||
});
|
||||
}
|
||||
|
||||
export function course(id: number) {
|
||||
return client.get(`/backend/v1/course/${id}`, {});
|
||||
}
|
||||
|
||||
export function updateCourse(
|
||||
id: number,
|
||||
title: string,
|
||||
thumb: string,
|
||||
isShow: number,
|
||||
depIds: number[],
|
||||
categoryIds: number[]
|
||||
) {
|
||||
return client.post(`/backend/v1/course/${id}`, {
|
||||
title: title,
|
||||
thumb: thumb,
|
||||
isShow: isShow,
|
||||
dep_ids: depIds,
|
||||
category_ids: categoryIds,
|
||||
});
|
||||
}
|
||||
|
||||
export function destroyCourse(id: number) {
|
||||
return client.destroy(`/backend/v1/course/${id}`);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user