website-01/lib/types.ts
2026-06-22 14:43:46 +08:00

153 lines
2.8 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.

/** 前后端共享类型定义(禁止 any */
export type AdminRole = 'super_admin' | 'normal';
export interface AdminInfo {
id: number;
username: string;
nickname: string;
avatar: string;
role: AdminRole;
}
export interface AdminUser {
id: number;
username: string;
nickname: string;
avatar: string;
role: AdminRole;
createdAt: string;
updatedAt: string;
}
export interface LoginResult {
token: string;
admin: AdminInfo;
}
export interface Banner {
id: number;
title: string;
image: string;
link: string;
sort: number;
isShow: number;
createdAt: string;
updatedAt: string;
}
export interface ProductCategory {
id: number;
name: string;
sort: number;
isShow: number;
createdAt: string;
updatedAt: string;
}
export interface Product {
id: number;
categoryId: number;
name: string;
cover: string;
desc: string | null;
content: string | null;
sort: number;
isShow: number;
category?: ProductCategory;
createdAt: string;
updatedAt: string;
}
export interface NewsCategory {
id: number;
name: string;
sort: number;
isShow: number;
createdAt: string;
updatedAt: string;
}
export interface News {
id: number;
categoryId: number;
title: string;
cover: string;
intro: string;
content: string;
isTop: number;
status: number;
category?: NewsCategory;
createdAt: string;
updatedAt: string;
}
export interface Team {
id: number;
name: string;
position: string;
avatar: string;
desc: string | null;
sort: number;
isShow: number;
createdAt: string;
updatedAt: string;
}
export interface Message {
id: number;
name: string;
phone: string;
email: string;
content: string;
isRead: number;
createdAt: string;
}
export interface SiteConfig {
id: number;
siteName: string;
logo: string;
tel: string;
address: string;
email: string;
copyright: string;
icp: string;
aboutTitle: string;
aboutContent: string | null;
createdAt: string;
updatedAt: string;
}
/** 使用手册节点类型0=目录节点 1=文档节点 */
export type ManualNodeType = 0 | 1;
/** 使用手册正文格式 */
export type ManualContentFormat = 'html' | 'markdown';
export interface Manual {
id: number;
parentId: number | null;
title: string;
/** 0=目录 1=文档 */
type: ManualNodeType;
content: string | null;
/** 正文格式html=富文本 markdown=Markdown旧数据可能缺失按 html 兜底) */
contentFormat: ManualContentFormat;
sort: number;
isShow: number;
createdAt: string;
updatedAt: string;
}
/** 树形节点(不含正文,用于菜单) */
export interface ManualTreeNode {
id: number;
parentId: number | null;
title: string;
type: ManualNodeType;
sort: number;
isShow: number;
children: ManualTreeNode[];
}