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

165 lines
3.1 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/book.d.ts
/**
* 书籍相关类型定义
*/
/** 作者信息 */
export interface IAuthor {
authorName: string
introduction: string
}
/** 价格信息 */
export interface IPriceData {
dictValue: string
}
/** 书籍基础信息 */
export interface IBook {
id: number
name: string
images: string
author?: IAuthor
isBuy: boolean
freeChapterCount: number
priceData?: IPriceData
}
/** 书籍详情信息 */
export interface IBookDetail extends IBook {
author: IAuthor
readCount?: number
listenCount?: number
buyCount?: number
}
/** 分页数据 */
export interface IPageData<T> {
records: T[]
total: number
current: number
size: number
}
/** 章节信息 */
export interface IChapter {
id: number
chapter: string
content?: string
voices?: string
}
/** 章节内容 */
export interface IChapterContent {
id: number
content: string
otherContent?: string // 图片尺寸信息 "width,height"
}
/** 用户实体 */
export interface IUserEntity {
id: number
name: string
nickname: string
avatar: string
}
/** 评论信息 */
export interface IComment {
id: number
content: string
createTime: string
isLike: number
likeCount: number
userEntity: IUserEntity
children?: IComment[]
}
/** 阅读进度 */
export interface IReadProgress {
bookId: number
chapterId: number
contentId: number
}
/** 阅读器设置 */
export interface IReaderSettings {
fontSize: number
lineHeight: number
theme: 'default' | 'blue' | 'green' | 'purple' | 'night'
readMode: 'scroll' | 'page'
}
/** 标签数据 */
export interface ILabel {
id: number
title: string
type: number // 0: 分类标签, 1: 活动标签
pid?: number // 父级ID用于二级分类
}
/** 带统计的图书数据 */
export interface IBookWithStats extends IBook {
bookId: number // 图书ID部分接口返回的字段名
readCount?: number // 阅读次数
listenCount?: number // 听书次数
buyCount?: number // 购买人数
isVip?: string // VIP专享标识 '2'表示VIP专享
sysDictData?: {
dictValue: string // 价格数值
}
}
/** VIP信息 */
export interface IVipInfo {
id: number
endTime: string
vipType: number
}
/** 分页数据 */
export interface IPageData<T> {
records: T[]
total: number
current: number
size: number
}
/** API响应基础结构 */
export interface IApiResponse<T = any> {
code: number
msg?: string
info?: string
[key: string]: any
}
/** 我的书单响应 */
export interface IMyBooksResponse extends IApiResponse {
page: IPageData<IBook>
}
/** 推荐图书响应 */
export interface IRecommendBooksResponse extends IApiResponse {
books: IBook[]
}
/** 标签列表响应 */
export interface ILabelListResponse extends IApiResponse {
lableList: ILabel[] // 注意:原接口拼写为 lableList
}
/** 图书列表响应 */
export interface IBookListResponse extends IApiResponse {
bookList: IBookWithStats[]
}
/** VIP信息响应 */
export interface IVipInfoResponse extends IApiResponse {
vipInfo: IVipInfo | null
}
/** 搜索结果响应 */
export interface ISearchResponse extends IApiResponse {
bookList: IBookWithStats[]
}