145 lines
4.7 KiB
TypeScript
145 lines
4.7 KiB
TypeScript
import type { BrandTemplateKey } from "./template-keys.js";
|
|
import { templatePackageRegistry } from "./template-packages.js";
|
|
|
|
export interface TemplateSampleContent {
|
|
templateKey: BrandTemplateKey;
|
|
inquiryFormName: string;
|
|
offerings: Array<{
|
|
kind: "service" | "product" | "package" | "subscription";
|
|
name: string;
|
|
summary: string;
|
|
categoryKey: string;
|
|
}>;
|
|
trustContent: Array<{
|
|
type: string;
|
|
title: string;
|
|
content: string;
|
|
summary?: string;
|
|
config?: Record<string, unknown>;
|
|
}>;
|
|
fields: Array<{
|
|
key: string;
|
|
label: string;
|
|
type: string;
|
|
required: boolean;
|
|
options?: Array<{ label: string; value: string }>;
|
|
placeholder?: string;
|
|
}>;
|
|
capabilityKey: string;
|
|
}
|
|
|
|
const doorsSampleContent: TemplateSampleContent = {
|
|
templateKey: "doors",
|
|
inquiryFormName: "门系统咨询表单",
|
|
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: "credential", title: "主理人的门作观", content: "示例内容,待品牌主理人完善。" },
|
|
{ type: "case", 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",
|
|
inquiryFormName: "餐品预订与定制表单",
|
|
offerings: [
|
|
{
|
|
kind: "package",
|
|
name: "示例·今日套餐",
|
|
summary: "现做家常套餐示例内容。",
|
|
categoryKey: "set-meal",
|
|
},
|
|
{
|
|
kind: "service",
|
|
name: "示例·聚餐定制",
|
|
summary: "按人数和口味沟通定制餐品。",
|
|
categoryKey: "private-chef",
|
|
},
|
|
],
|
|
trustContent: [
|
|
{ type: "credential", 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",
|
|
inquiryFormName: "合作咨询表单",
|
|
offerings: [
|
|
{
|
|
kind: "service",
|
|
name: "示例·品牌定位咨询",
|
|
summary: "梳理品牌定位与下一步行动。",
|
|
categoryKey: "consulting",
|
|
},
|
|
{
|
|
kind: "service",
|
|
name: "示例·长期顾问支持",
|
|
summary: "围绕表达和转化提供持续支持。",
|
|
categoryKey: "advisory",
|
|
},
|
|
],
|
|
trustContent: [
|
|
{ type: "credential", 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 = {
|
|
personal: personalSampleContent,
|
|
food: foodSampleContent,
|
|
doors: doorsSampleContent,
|
|
} as const;
|
|
|
|
export function getTemplateSampleContent(templateKey: string): TemplateSampleContent | undefined {
|
|
const packageSample = templatePackageRegistry.find((item) =>
|
|
item.supportedIndustryTemplates.includes(templateKey),
|
|
)?.sampleContent?.[templateKey];
|
|
return packageSample ?? templateSampleContent[templateKey as keyof typeof templateSampleContent];
|
|
}
|