From 3546e88f2ca9a594db0af32968ed6b2779bd8b61 Mon Sep 17 00:00:00 2001 From: Timi Date: Tue, 22 Jul 2025 12:58:22 +0800 Subject: [PATCH] migrate Article type from blog --- src/index.ts | 1 + src/types/Article.ts | 87 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 src/types/Article.ts diff --git a/src/index.ts b/src/index.ts index 264cd2b..f150223 100644 --- a/src/index.ts +++ b/src/index.ts @@ -34,6 +34,7 @@ import "./assets/style/timi-web.less"; export * from "./components"; export * from "./types/Model"; +export * from "./types/Article"; export * from "./types/User"; export * from "./types/Comment"; export * from "./types/Setting"; diff --git a/src/types/Article.ts b/src/types/Article.ts new file mode 100644 index 0000000..ae05708 --- /dev/null +++ b/src/types/Article.ts @@ -0,0 +1,87 @@ +import { AttachmentView, Model } from "timi-web"; + +// 文章 +export type Article = { + title?: string; + type: ArticleType; + digest?: string; + data?: string; + extendData?: E; + reads: number; + likes: number; + showComment: boolean; + canComment: boolean; + canRanking: boolean; +} & Model; + +export type ArticleView = { + comments?: number; + attachmentList: AttachmentView[]; +} & Article; + +export enum ArticleType { + + /** 公版 */ + PUBLIC, + + /** 音乐 */ + MUSIC, + + /** 软件 */ + SOFTWARE +} + +export enum ArticleAttachType { + + COVER, +} + +export type ArticleMusicExtendData = { + title: string; + list: ArticleMusicItem[]; + info: { + key: string; + value: string; + }[]; +} + +export type ArticleSoftwareExtendData = { + url?: string; + downloads: ArticleSoftwareDownload[]; + format: string; + runtime: ArticleSoftwareRuntime[]; + size: number; + version: string; + password?: string; +} + +export enum ArticleSoftwareDownloadType { + + TIMI_MONGO, + + TIMI_COS, + + URL +} + +export enum ArticleSoftwareRuntime { + + JVM, + + WINDOWS, + + LINUX, + + MAC_OS +} + +export type ArticleSoftwareDownload = { + type: ArticleSoftwareDownloadType; + value: string; +} + +export type ArticleMusicItem = { + title: string; + audio?: string; + video?: string; +}