feat: 收口多品牌与模板构建基础
This commit is contained in:
1 parent
0425a1c672
commit
77224ea51f
317 files changed
+11290
-1158
No files matched your search
+265
-19
@@ -1,7 +1,7 @@
|
||||
export const configPackageName = "personal-brand-config";
|
||||
|
||||
export type BrandTemplateKey = "personal" | "food" | "doors";
|
||||
export type VisualTemplateKey = "linjing-editorial" | "minimal-neutral";
|
||||
export type VisualTemplateKey = "linjing-editorial" | "acheng-campus-food";
|
||||
export type CapabilityKey = "offerings" | "inquiry" | "booking" | "quote-request";
|
||||
|
||||
export interface WorkflowDefinition {
|
||||
@@ -93,6 +93,7 @@ export interface VisualTemplateDefinition {
|
||||
version: string;
|
||||
name: string;
|
||||
description: string;
|
||||
supportedIndustryTemplates: BrandTemplateKey[];
|
||||
variants: Record<string, string>;
|
||||
theme: { colors: Record<string, string>; radius: Record<string, string> };
|
||||
layout?: { home: string[]; offerings: string[]; detail: string[]; profile: string[] };
|
||||
@@ -149,6 +150,7 @@ export interface VisualModuleDefinition {
|
||||
export interface VisualPageDefinition {
|
||||
key: VisualPageKey;
|
||||
title: string;
|
||||
renderer?: string;
|
||||
modules: VisualModuleDefinition[];
|
||||
}
|
||||
|
||||
@@ -158,6 +160,7 @@ export interface VisualTemplateManifest {
|
||||
version: string;
|
||||
name: string;
|
||||
description: string;
|
||||
supportedIndustryTemplates: BrandTemplateKey[];
|
||||
brandFirst: true;
|
||||
tokens: VisualTokenSet;
|
||||
pages: VisualPageDefinition[];
|
||||
@@ -178,12 +181,210 @@ export interface TemplatePackage {
|
||||
};
|
||||
}
|
||||
|
||||
export interface TemplatePackageManifest {
|
||||
packageKey: string;
|
||||
version: string;
|
||||
displayName: string;
|
||||
visualTemplateKey: VisualTemplateKey;
|
||||
runtimeContract: "1.0";
|
||||
supportedIndustryTemplates: BrandTemplateKey[];
|
||||
entrypoints: Record<VisualPageKey, string>;
|
||||
requiredCapabilities: CapabilityKey[];
|
||||
}
|
||||
|
||||
export const templatePackageRegistry: readonly TemplatePackageManifest[] = [
|
||||
{
|
||||
packageKey: "linjing-editorial",
|
||||
version: "1.0.0",
|
||||
displayName: "林境建筑画册",
|
||||
visualTemplateKey: "linjing-editorial",
|
||||
runtimeContract: "1.0",
|
||||
supportedIndustryTemplates: ["personal", "doors"],
|
||||
entrypoints: {
|
||||
home: "pages/index/index",
|
||||
offerings: "pages/services/index",
|
||||
detail: "pages/offering/detail",
|
||||
inquiry: "pages/inquiry/index",
|
||||
success: "pages/inquiry-success/index",
|
||||
records: "pages/records/index",
|
||||
profile: "pages/bookings/index",
|
||||
},
|
||||
requiredCapabilities: ["offerings", "inquiry"],
|
||||
},
|
||||
{
|
||||
packageKey: "acheng-campus-food",
|
||||
version: "1.0.0",
|
||||
displayName: "阿成校园餐",
|
||||
visualTemplateKey: "acheng-campus-food",
|
||||
runtimeContract: "1.0",
|
||||
supportedIndustryTemplates: ["food"],
|
||||
entrypoints: {
|
||||
home: "pages/index/index",
|
||||
offerings: "pages/services/index",
|
||||
detail: "pages/offering/detail",
|
||||
inquiry: "pages/inquiry/index",
|
||||
success: "pages/inquiry-success/index",
|
||||
records: "pages/records/index",
|
||||
profile: "pages/bookings/index",
|
||||
},
|
||||
requiredCapabilities: ["offerings", "inquiry", "booking"],
|
||||
},
|
||||
];
|
||||
|
||||
export function getTemplatePackageManifest(key: string): TemplatePackageManifest | undefined {
|
||||
return templatePackageRegistry.find((item) => item.packageKey === key);
|
||||
}
|
||||
|
||||
export function validateTemplatePackageManifest(manifest: TemplatePackageManifest): string[] {
|
||||
const errors: string[] = [];
|
||||
if (!manifest.packageKey.trim()) errors.push("packageKey is required");
|
||||
if (!manifest.version.trim()) errors.push("version is required");
|
||||
if (manifest.runtimeContract !== "1.0") errors.push("unsupported runtimeContract");
|
||||
if (!manifest.supportedIndustryTemplates.length)
|
||||
errors.push("supportedIndustryTemplates must not be empty");
|
||||
for (const page of [
|
||||
"home",
|
||||
"offerings",
|
||||
"detail",
|
||||
"inquiry",
|
||||
"success",
|
||||
"records",
|
||||
"profile",
|
||||
] as const) {
|
||||
if (!manifest.entrypoints[page]?.trim()) errors.push(`entrypoints.${page} is required`);
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
|
||||
export interface TemplateSampleContent {
|
||||
templateKey: BrandTemplateKey;
|
||||
offerings: Array<{
|
||||
kind: "service" | "product" | "package" | "subscription";
|
||||
name: string;
|
||||
summary: string;
|
||||
categoryKey: string;
|
||||
}>;
|
||||
trustContent: Array<{ type: string; title: string; content: string }>;
|
||||
fields: Array<{ key: string; label: string; type: string; required: boolean }>;
|
||||
capabilityKey: string;
|
||||
}
|
||||
|
||||
const doorsSampleContent: TemplateSampleContent = {
|
||||
templateKey: "doors",
|
||||
offerings: [
|
||||
{
|
||||
kind: "product",
|
||||
name: "序章·入户门",
|
||||
summary: "为别墅入口定制的整樘门系统",
|
||||
categoryKey: "entrance-door",
|
||||
},
|
||||
{
|
||||
kind: "product",
|
||||
name: "庭院·边界门",
|
||||
summary: "连接建筑与庭院的定制门",
|
||||
categoryKey: "garden-door",
|
||||
},
|
||||
{
|
||||
kind: "product",
|
||||
name: "室内·静谧门",
|
||||
summary: "统一室内空间秩序的户内门",
|
||||
categoryKey: "interior-door",
|
||||
},
|
||||
{
|
||||
kind: "service",
|
||||
name: "一对一门系统设计咨询",
|
||||
summary: "从现场到方案的完整设计沟通",
|
||||
categoryKey: "custom",
|
||||
},
|
||||
],
|
||||
trustContent: [
|
||||
{ type: "profile", title: "主理人的门作观", content: "示例内容,待品牌主理人完善。" },
|
||||
{ type: "portfolio", title: "别墅门系统案例", content: "示例内容,待品牌主理人完善。" },
|
||||
{ type: "process", title: "从测量到交付", content: "示例内容,待品牌主理人完善。" },
|
||||
{ type: "credential", title: "材料与工艺标准", content: "示例内容,待品牌主理人完善。" },
|
||||
],
|
||||
fields: [
|
||||
{ key: "projectType", label: "项目类型", type: "select", required: false },
|
||||
{ key: "projectStage", label: "项目阶段", type: "select", required: false },
|
||||
{ key: "siteDescription", label: "项目概况", type: "textarea", required: false },
|
||||
{ key: "phone", label: "联系方式", type: "phone", required: true },
|
||||
],
|
||||
capabilityKey: "doors",
|
||||
};
|
||||
|
||||
const foodSampleContent: TemplateSampleContent = {
|
||||
templateKey: "food",
|
||||
offerings: [
|
||||
{
|
||||
kind: "package",
|
||||
name: "示例·今日套餐",
|
||||
summary: "现做家常套餐示例内容。",
|
||||
categoryKey: "set-meal",
|
||||
},
|
||||
{
|
||||
kind: "service",
|
||||
name: "示例·聚餐定制",
|
||||
summary: "按人数和口味沟通定制餐品。",
|
||||
categoryKey: "private-chef",
|
||||
},
|
||||
],
|
||||
trustContent: [
|
||||
{ type: "profile", title: "关于主理人", content: "示例内容,待品牌主理人完善。" },
|
||||
{ type: "process", title: "从预订到取餐", content: "示例内容,待品牌主理人完善。" },
|
||||
],
|
||||
fields: [
|
||||
{ key: "date", label: "用餐日期", type: "date", required: true },
|
||||
{ key: "number", label: "用餐人数", type: "number", required: true },
|
||||
{ key: "phone", label: "联系方式", type: "phone", required: true },
|
||||
],
|
||||
capabilityKey: "booking",
|
||||
};
|
||||
|
||||
const personalSampleContent: TemplateSampleContent = {
|
||||
templateKey: "personal",
|
||||
offerings: [
|
||||
{
|
||||
kind: "service",
|
||||
name: "示例·品牌定位咨询",
|
||||
summary: "梳理品牌定位与下一步行动。",
|
||||
categoryKey: "consulting",
|
||||
},
|
||||
{
|
||||
kind: "service",
|
||||
name: "示例·长期顾问支持",
|
||||
summary: "围绕表达和转化提供持续支持。",
|
||||
categoryKey: "advisory",
|
||||
},
|
||||
],
|
||||
trustContent: [
|
||||
{ type: "profile", title: "关于主理人", content: "示例内容,待品牌主理人完善。" },
|
||||
{ type: "process", title: "合作方法", content: "示例内容,待品牌主理人完善。" },
|
||||
],
|
||||
fields: [
|
||||
{ key: "name", label: "您的称呼", type: "text", required: true },
|
||||
{ key: "phone", label: "联系方式", type: "phone", required: true },
|
||||
{ key: "remark", label: "合作需求", type: "textarea", required: true },
|
||||
],
|
||||
capabilityKey: "inquiry",
|
||||
};
|
||||
|
||||
export const templateSampleContent: Record<BrandTemplateKey, TemplateSampleContent> = {
|
||||
personal: personalSampleContent,
|
||||
food: foodSampleContent,
|
||||
doors: doorsSampleContent,
|
||||
};
|
||||
|
||||
export function getTemplateSampleContent(templateKey: string): TemplateSampleContent | undefined {
|
||||
return templateSampleContent[templateKey as keyof typeof templateSampleContent];
|
||||
}
|
||||
|
||||
const linjingEditorialManifest: VisualTemplateManifest = {
|
||||
schemaVersion: "1.0",
|
||||
key: "linjing-editorial",
|
||||
version: "1.0.0",
|
||||
name: "林境建筑画册",
|
||||
description: "以个人品牌信任为主线、以高端项目作品为表达重点的编辑式视觉模板。",
|
||||
supportedIndustryTemplates: ["personal", "doors"],
|
||||
brandFirst: true,
|
||||
tokens: {
|
||||
colors: {
|
||||
@@ -263,6 +464,7 @@ const linjingEditorialManifest: VisualTemplateManifest = {
|
||||
{
|
||||
key: "home",
|
||||
title: "首页",
|
||||
renderer: "linjing-home",
|
||||
modules: [
|
||||
{
|
||||
key: "identity",
|
||||
@@ -308,6 +510,7 @@ const linjingEditorialManifest: VisualTemplateManifest = {
|
||||
{
|
||||
key: "offerings",
|
||||
title: "业务提供项",
|
||||
renderer: "linjing-offerings",
|
||||
modules: [
|
||||
{
|
||||
key: "offerings",
|
||||
@@ -323,6 +526,7 @@ const linjingEditorialManifest: VisualTemplateManifest = {
|
||||
{
|
||||
key: "detail",
|
||||
title: "提供项详情",
|
||||
renderer: "linjing-offering-detail",
|
||||
modules: [
|
||||
{
|
||||
key: "detail",
|
||||
@@ -338,6 +542,7 @@ const linjingEditorialManifest: VisualTemplateManifest = {
|
||||
{
|
||||
key: "inquiry",
|
||||
title: "咨询与预约",
|
||||
renderer: "linjing-inquiry",
|
||||
modules: [
|
||||
{
|
||||
key: "inquiry",
|
||||
@@ -352,6 +557,7 @@ const linjingEditorialManifest: VisualTemplateManifest = {
|
||||
{
|
||||
key: "success",
|
||||
title: "提交成功",
|
||||
renderer: "linjing-success",
|
||||
modules: [
|
||||
{
|
||||
key: "success",
|
||||
@@ -365,6 +571,7 @@ const linjingEditorialManifest: VisualTemplateManifest = {
|
||||
{
|
||||
key: "records",
|
||||
title: "我的记录",
|
||||
renderer: "linjing-records",
|
||||
modules: [
|
||||
{
|
||||
key: "records",
|
||||
@@ -378,6 +585,7 @@ const linjingEditorialManifest: VisualTemplateManifest = {
|
||||
{
|
||||
key: "profile",
|
||||
title: "主理人与我",
|
||||
renderer: "linjing-profile",
|
||||
modules: [
|
||||
{
|
||||
key: "identity",
|
||||
@@ -402,24 +610,37 @@ const linjingEditorialManifest: VisualTemplateManifest = {
|
||||
|
||||
export const visualTemplateManifests: Record<VisualTemplateKey, VisualTemplateManifest> = {
|
||||
"linjing-editorial": linjingEditorialManifest,
|
||||
"minimal-neutral": {
|
||||
"acheng-campus-food": {
|
||||
...linjingEditorialManifest,
|
||||
key: "minimal-neutral",
|
||||
key: "acheng-campus-food",
|
||||
version: "1.0.0",
|
||||
name: "极简留白",
|
||||
description: "适合咨询、设计和专业服务型个人品牌的中性视觉模板。",
|
||||
name: "阿成校园餐",
|
||||
description: "面向校园餐饮摊贩的菜单、出摊动态和团体预订视觉模板。",
|
||||
supportedIndustryTemplates: ["food"],
|
||||
tokens: {
|
||||
...linjingEditorialManifest.tokens,
|
||||
colors: {
|
||||
background: "#FAFAF8",
|
||||
background: "#FFF8F0",
|
||||
surface: "#FFFFFF",
|
||||
foreground: "#202221",
|
||||
muted: "#6B7280",
|
||||
accent: "#4B5563",
|
||||
dark: "#202221",
|
||||
foreground: "#29231F",
|
||||
muted: "#7A6A60",
|
||||
accent: "#E87532",
|
||||
dark: "#3B2118",
|
||||
},
|
||||
radius: { card: "8rpx", button: "8rpx", media: "8rpx" },
|
||||
radius: { card: "24rpx", button: "999rpx", media: "20rpx" },
|
||||
},
|
||||
pages: linjingEditorialManifest.pages.map((pageDefinition) => {
|
||||
const renderer =
|
||||
pageDefinition.key === "home"
|
||||
? "acheng-home"
|
||||
: pageDefinition.key === "offerings"
|
||||
? "acheng-offerings"
|
||||
: pageDefinition.key === "profile"
|
||||
? "acheng-profile"
|
||||
: pageDefinition.renderer;
|
||||
return renderer ? { ...pageDefinition, renderer } : pageDefinition;
|
||||
}),
|
||||
capabilities: ["offerings", "inquiry", "booking"],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -427,12 +648,22 @@ export function getVisualTemplateManifest(key: string): VisualTemplateManifest |
|
||||
return visualTemplateManifests[key as VisualTemplateKey];
|
||||
}
|
||||
|
||||
export function isVisualTemplateCompatible(
|
||||
visualTemplate: VisualTemplateDefinition | VisualTemplateManifest,
|
||||
industryTemplateKey: string,
|
||||
): boolean {
|
||||
return visualTemplate.supportedIndustryTemplates.includes(
|
||||
industryTemplateKey as BrandTemplateKey,
|
||||
);
|
||||
}
|
||||
|
||||
export const visualTemplates: Record<VisualTemplateKey, VisualTemplateDefinition> = {
|
||||
"linjing-editorial": {
|
||||
key: "linjing-editorial",
|
||||
version: "1.0.0",
|
||||
name: "林境建筑画册",
|
||||
description: "适合高端定制、建筑作品和项目型个人品牌。",
|
||||
supportedIndustryTemplates: ["personal", "doors"],
|
||||
variants: { hero: "architectural", offeringList: "editorial", detail: "project-case" },
|
||||
theme: {
|
||||
colors: { background: "#F7F5F1", foreground: "#252525", accent: "#8A6846", dark: "#202221" },
|
||||
@@ -445,18 +676,19 @@ export const visualTemplates: Record<VisualTemplateKey, VisualTemplateDefinition
|
||||
profile: ["profile"],
|
||||
},
|
||||
},
|
||||
"minimal-neutral": {
|
||||
key: "minimal-neutral",
|
||||
"acheng-campus-food": {
|
||||
key: "acheng-campus-food",
|
||||
version: "1.0.0",
|
||||
name: "极简留白",
|
||||
description: "适合咨询、设计和专业服务型个人品牌。",
|
||||
variants: { hero: "minimal", offeringList: "square-card", detail: "service-process" },
|
||||
name: "阿成校园餐",
|
||||
description: "适合校园餐饮、套餐预订和团体定制的暖橙菜单视觉。",
|
||||
supportedIndustryTemplates: ["food"],
|
||||
variants: { hero: "stall-board", offeringList: "menu-card", detail: "dish-detail" },
|
||||
theme: {
|
||||
colors: { background: "#FAFAF8", foreground: "#202221", accent: "#4B5563", dark: "#202221" },
|
||||
radius: { card: "8rpx" },
|
||||
colors: { background: "#FFF8F0", foreground: "#29231F", accent: "#E87532", dark: "#3B2118" },
|
||||
radius: { card: "24rpx" },
|
||||
},
|
||||
layout: {
|
||||
home: ["brand-hero", "founder-card", "offering-list", "trust-proof"],
|
||||
home: ["founder-card", "brand-hero", "trust-proof", "offering-list"],
|
||||
offerings: ["offering-list"],
|
||||
detail: ["offering-detail"],
|
||||
profile: ["profile"],
|
||||
@@ -464,10 +696,24 @@ export const visualTemplates: Record<VisualTemplateKey, VisualTemplateDefinition
|
||||
},
|
||||
};
|
||||
|
||||
export function listVisualTemplateKeys(): VisualTemplateKey[] {
|
||||
return Object.keys(visualTemplates) as VisualTemplateKey[];
|
||||
}
|
||||
|
||||
export function getVisualTemplate(key: string): VisualTemplateDefinition | undefined {
|
||||
return visualTemplates[key as VisualTemplateKey];
|
||||
}
|
||||
|
||||
export function getDefaultVisualTemplateKey(industryTemplateKey: string): VisualTemplateKey {
|
||||
return (
|
||||
listVisualTemplateKeys().find((key) =>
|
||||
visualTemplates[key].supportedIndustryTemplates.includes(
|
||||
industryTemplateKey as BrandTemplateKey,
|
||||
),
|
||||
) ?? "linjing-editorial"
|
||||
);
|
||||
}
|
||||
|
||||
export function canTransitionWorkflow(workflowKey: string, from: string, to: string): boolean {
|
||||
const workflow = workflowRegistry[workflowKey as keyof typeof workflowRegistry] as
|
||||
WorkflowDefinition | undefined;
|
||||
|
||||
Reference in new issue
Block a user