feat: 新增独立工坊宣传模板及配置导入验证

This commit is contained in:
que01 committed 2026-10-15 17:44:52 +08:00
1 parent bf4bbf81c7
commit 04e42b3a80
43 files changed
+5726 -13

No files matched your search

File diff suppressed because it is too large. Load diff
+19 -3
View File
@@ -1,12 +1,15 @@
import type { BrandTemplateKey } from "./template-keys.js";
import { getDefaultVisualTemplateKey } from "./visual-templates.js";
import { templatePackageRegistry } from "./template-packages.js";
export interface TemplateSampleContent {
templateKey: BrandTemplateKey;
brandConfig?: Record<string, unknown>;
inquiryFormName: string;
offerings: Array<{
kind: "service" | "product" | "package" | "subscription";
name: string;
coverUrl?: string;
summary: string;
categoryKey: string;
}>;
@@ -136,9 +139,22 @@ export const templateSampleContent = {
doors: doorsSampleContent,
} as const;
export function getTemplateSampleContent(templateKey: string): TemplateSampleContent | undefined {
const packageSample = templatePackageRegistry.find((item) =>
item.supportedIndustryTemplates.includes(templateKey),
export function getTemplateSampleContent(
templateKey: string,
visualTemplateKey?: string,
): TemplateSampleContent | undefined {
const selected = visualTemplateKey
? templatePackageRegistry.find(
(item) =>
item.packageKey === visualTemplateKey &&
item.supportedIndustryTemplates.includes(templateKey),
)
: undefined;
if (selected) return selected.sampleContent?.[templateKey];
const packageSample = templatePackageRegistry.find(
(item) =>
item.packageKey === getDefaultVisualTemplateKey(templateKey) &&
item.supportedIndustryTemplates.includes(templateKey),
)?.sampleContent?.[templateKey];
return packageSample ?? templateSampleContent[templateKey as keyof typeof templateSampleContent];
}
+18
View File
@@ -38,6 +38,24 @@ export const visualTemplates: Record<VisualTemplateKey, VisualTemplateDefinition
profile: ["profile"],
},
},
"atelier-solopreneur": {
key: "atelier-solopreneur",
version: "1.0.0",
name: "独立工坊 · 品牌小程序",
description: "展示品牌小程序服务、试点案例与合作流程,承接需求咨询。",
supportedIndustryTemplates: ["personal"],
variants: { hero: "editorial", offeringList: "service-system", detail: "project-case" },
theme: {
colors: { background: "#fbf9f5", foreground: "#1b1c1a", accent: "#183329", dark: "#183329" },
radius: { card: "28rpx" },
},
layout: {
home: ["brand-hero", "offering-list"],
offerings: ["offering-list"],
detail: ["offering-detail"],
profile: ["profile"],
},
},
};
export function listVisualTemplateKeys(): VisualTemplateKey[] {