migrate Article type from blog
This commit is contained in:
@ -34,6 +34,7 @@ import "./assets/style/timi-web.less";
|
|||||||
export * from "./components";
|
export * from "./components";
|
||||||
|
|
||||||
export * from "./types/Model";
|
export * from "./types/Model";
|
||||||
|
export * from "./types/Article";
|
||||||
export * from "./types/User";
|
export * from "./types/User";
|
||||||
export * from "./types/Comment";
|
export * from "./types/Comment";
|
||||||
export * from "./types/Setting";
|
export * from "./types/Setting";
|
||||||
|
|||||||
87
src/types/Article.ts
Normal file
87
src/types/Article.ts
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
import { AttachmentView, Model } from "timi-web";
|
||||||
|
|
||||||
|
// 文章
|
||||||
|
export type Article<E extends ArticleMusicExtendData | ArticleSoftwareExtendData> = {
|
||||||
|
title?: string;
|
||||||
|
type: ArticleType;
|
||||||
|
digest?: string;
|
||||||
|
data?: string;
|
||||||
|
extendData?: E;
|
||||||
|
reads: number;
|
||||||
|
likes: number;
|
||||||
|
showComment: boolean;
|
||||||
|
canComment: boolean;
|
||||||
|
canRanking: boolean;
|
||||||
|
} & Model;
|
||||||
|
|
||||||
|
export type ArticleView<E extends ArticleMusicExtendData | ArticleSoftwareExtendData> = {
|
||||||
|
comments?: number;
|
||||||
|
attachmentList: AttachmentView[];
|
||||||
|
} & Article<E>;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user