feat: 建立视觉模板包契约与林境映射

This commit is contained in:
que01 committed 2026-09-23 14:18:28 +08:00
1 parent 241c19812f
commit 031c81a7c1
9 files changed
+427

No files matched your search

+329
View File
@@ -98,6 +98,335 @@ export interface VisualTemplateDefinition {
layout?: { home: string[]; offerings: string[]; detail: string[]; profile: string[] };
}
export type VisualPageKey =
"home" | "offerings" | "detail" | "inquiry" | "success" | "records" | "profile";
export type VisualModuleType =
| "brand-identity"
| "hero"
| "trust"
| "offering-list"
| "offering-detail"
| "inquiry-form"
| "success-summary"
| "records-list"
| "contact";
export interface VisualTokenSet {
colors: Record<string, string>;
spacing: Record<string, string>;
typography: Record<string, string>;
radius: Record<string, string>;
shadows?: Record<string, string>;
}
export interface VisualAssetSlot {
key: string;
label: string;
required: boolean;
kind: "image" | "icon" | "logo" | "texture";
aspectRatio?: string;
fallback?: string;
}
export interface VisualDataSlot {
key: string;
source: "brand" | "trust" | "offering" | "inquiry" | "records" | "profile";
required: boolean;
description: string;
}
export interface VisualModuleDefinition {
key: string;
type: VisualModuleType;
variant: string;
required: boolean;
dataSlots?: string[];
assetSlots?: string[];
capability?: CapabilityKey;
}
export interface VisualPageDefinition {
key: VisualPageKey;
title: string;
modules: VisualModuleDefinition[];
}
export interface VisualTemplateManifest {
schemaVersion: "1.0";
key: VisualTemplateKey;
version: string;
name: string;
description: string;
brandFirst: true;
tokens: VisualTokenSet;
pages: VisualPageDefinition[];
assets: VisualAssetSlot[];
dataSlots: VisualDataSlot[];
capabilities: CapabilityKey[];
}
export interface TemplatePackage {
manifest: VisualTemplateManifest;
industryTemplateKey: BrandTemplateKey;
content: Record<string, unknown>;
forms: Record<string, unknown>[];
capabilityConfig: Record<string, unknown>;
fixtures: {
runtime: Record<string, unknown>;
visual: Record<string, unknown>;
};
}
const linjingEditorialManifest: VisualTemplateManifest = {
schemaVersion: "1.0",
key: "linjing-editorial",
version: "1.0.0",
name: "林境建筑画册",
description: "以个人品牌信任为主线、以高端项目作品为表达重点的编辑式视觉模板。",
brandFirst: true,
tokens: {
colors: {
background: "#F7F5F1",
surface: "#FFFFFF",
foreground: "#252525",
muted: "#77736C",
accent: "#8A6846",
dark: "#202221",
},
spacing: { page: "32rpx", section: "56rpx", module: "24rpx" },
typography: { display: "56rpx", heading: "36rpx", body: "28rpx", caption: "22rpx" },
radius: { card: "16rpx", button: "999rpx", media: "12rpx" },
shadows: { card: "0 8rpx 32rpx rgba(32,34,33,0.08)" },
},
assets: [
{ key: "brand.logo", label: "品牌标志", required: false, kind: "logo" },
{
key: "home.hero",
label: "首页首屏图",
required: true,
kind: "image",
aspectRatio: "16:9",
},
{
key: "offering.cover",
label: "业务提供项封面",
required: true,
kind: "image",
aspectRatio: "1:1",
},
{
key: "profile.portrait",
label: "主理人肖像",
required: false,
kind: "image",
aspectRatio: "1:1",
},
{ key: "brand.texture", label: "品牌底纹", required: false, kind: "texture" },
],
dataSlots: [
{
key: "brand.identity",
source: "brand",
required: true,
description: "品牌名、定位和主理人身份",
},
{ key: "brand.hero", source: "brand", required: true, description: "品牌首屏表达和行动入口" },
{ key: "trust.proof", source: "trust", required: true, description: "经历、资质、案例和方法" },
{
key: "offerings.list",
source: "offering",
required: true,
description: "可展示的业务提供项",
},
{
key: "offering.detail",
source: "offering",
required: true,
description: "单个提供项的详情内容",
},
{ key: "inquiry.form", source: "inquiry", required: true, description: "品牌咨询或预约表单" },
{
key: "records.items",
source: "records",
required: true,
description: "用户提交后的跟进记录",
},
{
key: "profile.contact",
source: "profile",
required: true,
description: "联系方式和合作预期",
},
],
pages: [
{
key: "home",
title: "首页",
modules: [
{
key: "identity",
type: "brand-identity",
variant: "editorial-card",
required: true,
dataSlots: ["brand.identity"],
assetSlots: ["brand.logo"],
},
{
key: "hero",
type: "hero",
variant: "architectural",
required: true,
dataSlots: ["brand.hero"],
assetSlots: ["home.hero"],
},
{
key: "proof",
type: "trust",
variant: "proof-strip",
required: true,
dataSlots: ["trust.proof"],
},
{
key: "offerings",
type: "offering-list",
variant: "editorial-list",
required: true,
dataSlots: ["offerings.list"],
assetSlots: ["offering.cover"],
capability: "offerings",
},
{
key: "contact",
type: "contact",
variant: "quiet-footer",
required: true,
dataSlots: ["profile.contact"],
},
],
},
{
key: "offerings",
title: "业务提供项",
modules: [
{
key: "offerings",
type: "offering-list",
variant: "editorial-grid",
required: true,
dataSlots: ["offerings.list"],
assetSlots: ["offering.cover"],
capability: "offerings",
},
],
},
{
key: "detail",
title: "提供项详情",
modules: [
{
key: "detail",
type: "offering-detail",
variant: "project-case",
required: true,
dataSlots: ["offering.detail"],
assetSlots: ["offering.cover"],
capability: "offerings",
},
],
},
{
key: "inquiry",
title: "咨询与预约",
modules: [
{
key: "inquiry",
type: "inquiry-form",
variant: "editorial-form",
required: true,
dataSlots: ["inquiry.form"],
capability: "inquiry",
},
],
},
{
key: "success",
title: "提交成功",
modules: [
{
key: "success",
type: "success-summary",
variant: "editorial-confirmation",
required: true,
dataSlots: ["brand.identity"],
},
],
},
{
key: "records",
title: "我的记录",
modules: [
{
key: "records",
type: "records-list",
variant: "timeline",
required: true,
dataSlots: ["records.items"],
},
],
},
{
key: "profile",
title: "主理人与我",
modules: [
{
key: "identity",
type: "brand-identity",
variant: "profile-editorial",
required: true,
dataSlots: ["brand.identity"],
assetSlots: ["profile.portrait"],
},
{
key: "contact",
type: "contact",
variant: "contact-sheet",
required: true,
dataSlots: ["profile.contact"],
},
],
},
],
capabilities: ["offerings", "inquiry"],
};
export const visualTemplateManifests: Record<VisualTemplateKey, VisualTemplateManifest> = {
"linjing-editorial": linjingEditorialManifest,
"minimal-neutral": {
...linjingEditorialManifest,
key: "minimal-neutral",
version: "1.0.0",
name: "极简留白",
description: "适合咨询、设计和专业服务型个人品牌的中性视觉模板。",
tokens: {
...linjingEditorialManifest.tokens,
colors: {
background: "#FAFAF8",
surface: "#FFFFFF",
foreground: "#202221",
muted: "#6B7280",
accent: "#4B5563",
dark: "#202221",
},
radius: { card: "8rpx", button: "8rpx", media: "8rpx" },
},
},
};
export function getVisualTemplateManifest(key: string): VisualTemplateManifest | undefined {
return visualTemplateManifests[key as VisualTemplateKey];
}
export const visualTemplates: Record<VisualTemplateKey, VisualTemplateDefinition> = {
"linjing-editorial": {
key: "linjing-editorial",