164 lines
4.2 KiB
TypeScript
164 lines
4.2 KiB
TypeScript
// types/course.d.ts
|
|
/**
|
|
* 课程相关类型定义
|
|
*/
|
|
|
|
import type { IApiResponse } from './book'
|
|
|
|
/** 医学标签(课程分类) */
|
|
export interface ICategory {
|
|
id: number // 标签ID
|
|
title: string // 标签标题
|
|
icon: string // 标签图标URL
|
|
isLast: number // 是否为终极分类 0-否 1-是
|
|
children?: ICategory[] // 子分类列表
|
|
pid?: number // 父级ID
|
|
content?: string // 分类描述
|
|
}
|
|
|
|
/** 课程信息 */
|
|
export interface ICourse {
|
|
id: number // 课程ID
|
|
title: string // 课程标题
|
|
image: string // 课程封面图
|
|
}
|
|
|
|
/** 新闻信息 */
|
|
export interface INews {
|
|
id: number // 新闻ID
|
|
title: string // 新闻标题
|
|
type: number // 新闻类型 1-外部链接 其他-内部页面
|
|
url: string // 新闻链接
|
|
}
|
|
|
|
/** 课程分类树响应 */
|
|
export interface ICourseCategoryResponse extends IApiResponse {
|
|
labels: ICategory[] // 分类标签列表
|
|
}
|
|
|
|
/** 用户最近观看课程列表响应 */
|
|
export interface IUserLateCourseListResponse extends IApiResponse {
|
|
page: ICourse[] // 课程列表
|
|
}
|
|
|
|
/** 市场课程列表响应 */
|
|
export interface IMarketCourseListResponse extends IApiResponse {
|
|
courseList: {
|
|
records: ICourse[] // 课程列表
|
|
}
|
|
}
|
|
|
|
/** 消息列表响应 */
|
|
export interface IMessageListResponse extends IApiResponse {
|
|
messages: INews[] // 消息列表
|
|
}
|
|
|
|
/** 课程详情 */
|
|
export interface ICourseDetail {
|
|
id: number
|
|
title: string
|
|
image: string
|
|
content: string
|
|
canzk: string // 是否支持自考 0-否 1-是
|
|
}
|
|
|
|
/** 课程目录 */
|
|
export interface ICatalogue {
|
|
id: number
|
|
title: string
|
|
type: number // 0-免费 1-付费 2-VIP专享
|
|
isBuy: number // 是否已购买 0-否 1-是
|
|
startTime: string | null // 开始学习时间
|
|
endTime: string | null // 到期时间
|
|
completion: number // 学习进度百分比
|
|
}
|
|
|
|
/** 章节信息 */
|
|
export interface IChapter {
|
|
id: number
|
|
title: string
|
|
isAudition: number // 是否试听 0-否 1-是
|
|
isLearned: number // 是否已学 0-否 1-是
|
|
conditions: string
|
|
imgUrl?: string
|
|
}
|
|
|
|
/** 章节详情 */
|
|
export interface IChapterDetail {
|
|
id: number
|
|
title: string
|
|
imgUrl: string
|
|
content: string
|
|
questions: string // 思考题内容
|
|
}
|
|
|
|
/** 视频信息 */
|
|
export interface IVideo {
|
|
id: number
|
|
title: string
|
|
url: string
|
|
duration?: number
|
|
}
|
|
|
|
/** VIP信息 */
|
|
export interface IVipInfo {
|
|
type: number // VIP类型 4-中医学 5-针灸学 6-肿瘤学 7-国学 8-心理学 9-中西汇通学
|
|
endTime: string // 到期时间
|
|
}
|
|
|
|
/** 商品信息 */
|
|
export interface IGoods {
|
|
productId: number
|
|
productName: string
|
|
productImages: string
|
|
price: number
|
|
vipPrice: number | null
|
|
activityPrice: number | null
|
|
isVipPrice: number // 是否有VIP优惠 0-否 1-是
|
|
productAmount: number // 购买数量
|
|
delFlag?: number // 删除标记 -1-已下架
|
|
}
|
|
|
|
/** 订单商品 */
|
|
export interface IOrderGoods extends IGoods {
|
|
// 继承商品信息
|
|
}
|
|
|
|
/** 订单初始化数据 */
|
|
export interface IOrderInitData {
|
|
user: {
|
|
id: number
|
|
name: string
|
|
jf: number // 积分
|
|
}
|
|
is_course: boolean // 是否为课程订单
|
|
}
|
|
|
|
/** 课程详情响应 */
|
|
export interface ICourseDetailResponse extends IApiResponse {
|
|
data: {
|
|
course: ICourseDetail
|
|
catalogues: ICatalogue[]
|
|
shopProductList?: IGoods[] // 相关书籍
|
|
}
|
|
}
|
|
|
|
/** 章节列表响应 */
|
|
export interface IChapterListResponse extends IApiResponse {
|
|
chapterList: IChapter[]
|
|
}
|
|
|
|
/** 章节详情响应 */
|
|
export interface IChapterDetailResponse extends IApiResponse {
|
|
data: {
|
|
detail: IChapterDetail
|
|
videos: IVideo[]
|
|
current?: number // 当前播放视频ID
|
|
}
|
|
}
|
|
|
|
/** 商品列表响应 */
|
|
export interface IProductListResponse extends IApiResponse {
|
|
productList: IGoods[]
|
|
}
|