course.js 1.32 KB
/*
 * @Date: 2025-04-15 09:32:07
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2025-04-15 12:58:17
 * @FilePath: /mlaj/src/api/course.js
 * @Description: 课程模块相关接口
 */
import { fn, fetch } from './fn'

const Api = {
  GET_COURSE_LIST: '/srv/?a=schedule&t=list',
  GET_COURSE_DETAIL: '/srv/?a=schedule&t=detail',
  GET_SCHEDULE_COURSE_LIST: '/srv/?a=schedule&t=course',
}

/**
 * @description: 获取课程列表
 * @param: page 页码
 * @param: limit 每页数量 默认10
 * @param: sn 类型 RMKC=热门课程 JXKC=精选课程
 * @return: data: [{ id, title, price, original_price, feature, highlights, count, cover}]
 */
export const  getCourseListAPI = (params) => fn(fetch.get(Api.GET_COURSE_LIST, params))

/**
 * @description: 获取课程详情
 * @param: i 课程 ID
 * @return: data: [{ id, title, price, original_price, feature, highlights, learning_goal, schedule}]
 * @return: schedule: [{ id, schedule_time, seq, title, duration}] 课程章节
 */
export const getCourseDetailAPI = (params) => fn(fetch.get(Api.GET_COURSE_DETAIL, params))

/**
 * @description: 获取特定学习课程的目录
 * @param: i 课程 ID
 * @return: data: [{ id, schedule_time, seq, title, duration, course_id, file}]
 */
export const getScheduleCourseListAPI = (params) => fn(fetch.get(Api.GET_SCHEDULE_COURSE_LIST, params))