55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
// 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 }
|
|
})
|
|
}
|
|
}
|