更新:增加“课程首页”功能
This commit is contained in:
54
api/modules/course.ts
Normal file
54
api/modules/course.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
// api/modules/course.ts
|
||||
import { createRequestClient } from '../request'
|
||||
import { SERVICE_MAP } from '../config'
|
||||
import type {
|
||||
ICourseMedicalTreeResponse,
|
||||
IUserLateCourseListResponse,
|
||||
IMarketCourseListResponse
|
||||
} from '@/types/course'
|
||||
|
||||
const client = createRequestClient({ baseURL: SERVICE_MAP.MAIN })
|
||||
|
||||
/**
|
||||
* 课程相关API
|
||||
*/
|
||||
export const courseApi = {
|
||||
/**
|
||||
* 获取课程分类树
|
||||
* @returns 分类数据
|
||||
*/
|
||||
getCourseMedicalTree() {
|
||||
return client.request<ICourseMedicalTreeResponse>({
|
||||
url: 'medical/home/getCourseMedicalTree',
|
||||
method: 'POST',
|
||||
data: {}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取用户最近观看课程列表
|
||||
* @returns 观看记录列表
|
||||
*/
|
||||
getUserLateCourseList() {
|
||||
return client.request<IUserLateCourseListResponse>({
|
||||
url: 'medical/home/getUserLateCourseList',
|
||||
method: 'POST',
|
||||
data: {}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取市场课程列表(试听课程)
|
||||
* @param id 市场ID
|
||||
* @param limit 每页数量
|
||||
* @param page 页码
|
||||
* @returns 课程列表
|
||||
*/
|
||||
getMarketCourseList(id: number, limit: number, page: number) {
|
||||
return client.request<IMarketCourseListResponse>({
|
||||
url: 'medical/home/getMarketCourseList',
|
||||
method: 'POST',
|
||||
data: { id, limit, page }
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user