44 lines
1.0 KiB
TypeScript
44 lines
1.0 KiB
TypeScript
// types/comment.d.ts
|
||
/**
|
||
* 通用评论类型定义
|
||
* 用于课程和图书的评论功能
|
||
*/
|
||
|
||
import type { IApiResponse } from './book'
|
||
|
||
/** 用户信息(评论中使用) */
|
||
export interface ICommentUser {
|
||
id: number
|
||
name: string
|
||
avatar?: string
|
||
}
|
||
|
||
/** 通用评论数据结构 */
|
||
export interface IComment {
|
||
id: number
|
||
user: ICommentUser
|
||
content: string
|
||
images: string // 图片URL,逗号分隔
|
||
imgList: string[] // 图片URL数组
|
||
createTime: string
|
||
support: boolean // 当前用户是否已点赞
|
||
supportCount: number // 点赞数
|
||
children: IComment[] // 所有子评论
|
||
Bchildren: IComment[] // 显示的子评论(最多5条)
|
||
}
|
||
|
||
/** 评论列表响应 */
|
||
export interface ICommentListResponse extends IApiResponse {
|
||
page: {
|
||
records: IComment[]
|
||
total: number
|
||
pages: number
|
||
}
|
||
}
|
||
|
||
/** 添加评论响应 */
|
||
export interface IAddCommentResponse extends IApiResponse {
|
||
courseGuestbook?: IComment // 课程评论
|
||
bookComment?: IComment // 图书评论
|
||
}
|