Files
taimed-international-app/types/comment.d.ts

44 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 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 // 图书评论
}