官网开发中 0731

This commit is contained in:
eafonyang
2026-07-31 19:02:00 +08:00
parent fda4fa8627
commit eeccdb079c
36 changed files with 1944 additions and 105 deletions
+219
View File
@@ -0,0 +1,219 @@
/**
* 官网前台数据类型定义
*
* 字段名与 dashboard 后端 /api/site/* 响应的 snake_case 保持一致。
*/
// ===== 全局配置 =====
export interface SiteSettings {
id: number;
site_title: string;
favicon_url: string;
logo_dark_url: string;
logo_light_url: string;
}
export interface FooterSettings {
id: number;
company_name: string;
company_address: string;
contact_phone: string;
contact_email: string;
copyright_text: string;
icp_number: string;
police_number: string;
}
export interface SocialLink {
id: number;
platform: string;
url: string;
qrcode_url: string;
sort_order: number;
}
export interface SeoDefaults {
id: number;
meta_description: string;
meta_keywords: string;
og_image_url: string;
}
export interface GlobalConfig {
site: SiteSettings | null;
footer: FooterSettings | null;
social: SocialLink[];
seo: SeoDefaults | null;
}
// ===== 导航 =====
export type NavDisplayMode = 'text' | 'icon_text' | 'image' | 'image_text';
export interface NavItem {
id: number;
name_zh: string;
name_en: string;
link: string;
is_visible: number;
sort_order: number;
display_mode: NavDisplayMode;
icon_name: string;
image_url: string;
open_new_tab: number;
}
export interface NavAppearance {
id: number;
homepage_style: 'transparent' | 'glass';
non_homepage_style: 'transparent' | 'glass';
}
export interface NavConfig {
items: NavItem[];
appearance: NavAppearance | null;
}
// ===== Section 区块 =====
export type SectionLayout =
| 'hero_split'
| 'full_banner'
| 'feature_grid'
| 'split_content'
| 'gallery'
| 'stats'
| 'video_showcase'
| 'scroll_narrative'
| 'quote'
| 'spec_table';
export interface SpecItem {
id: number;
spec_group_id: number;
name_zh: string;
name_en: string;
value_zh: string;
value_en: string;
sort_order: number;
}
export interface SpecGroup {
id: number;
section_block_id: number;
title_zh: string;
title_en: string;
sort_order: number;
default_visible: number;
items: SpecItem[];
}
// ===== Section config JSON 子结构(特性网格/数据统计/滚动叙事/图片画廊) =====
export interface FeatureItem {
icon: string;
title_zh: string;
title_en: string;
desc_zh: string;
desc_en: string;
}
export interface StatItem {
value: string;
unit: string;
label_zh: string;
label_en: string;
}
export interface NarrativeStep {
title_zh: string;
title_en: string;
desc_zh: string;
desc_en: string;
image_url: string;
}
export interface GalleryImage {
url: string;
caption_zh: string;
caption_en: string;
}
export interface SectionConfig {
features?: FeatureItem[];
stats?: StatItem[];
steps?: NarrativeStep[];
images?: GalleryImage[];
[key: string]: unknown;
}
export interface SectionBlock {
id: number;
page_type: string;
product_id: number | null;
layout: SectionLayout;
theme: 'light' | 'dark';
bg_type: 'color' | 'image' | 'video';
bg_value: string;
overlay_enabled: number;
overlay_opacity: string;
overline_zh: string;
overline_en: string;
title_zh: string;
title_en: string;
subtitle_zh: string;
subtitle_en: string;
content_zh: string | null;
content_en: string | null;
cta_primary_zh: string;
cta_primary_en: string;
cta_primary_url: string;
cta_secondary_zh: string;
cta_secondary_en: string;
cta_secondary_url: string;
media_url_zh: string;
media_url_en: string;
video_url: string;
config: SectionConfig | null;
is_visible: number;
sort_order: number;
spec_groups?: SpecGroup[];
}
// ===== i18n 词条 =====
export interface I18nEntry {
id: number;
dict_key: string;
value_zh: string;
value_en: string;
description: string;
}
// ===== 产品 =====
export interface Product {
id: number;
series_id: number;
name_zh: string;
name_en: string;
slug: string;
intro_zh: string;
intro_en: string;
cover_url: string;
sort_order: number;
is_visible: number;
}
export interface ProductSeries {
id: number;
name_zh: string;
name_en: string;
overline: string;
subtitle_zh: string;
subtitle_en: string;
cover_url: string;
sort_order: number;
is_visible: number;
products: Product[];
}
export interface ProductsData {
series: ProductSeries[];
total: number;
}