fix: 收口模板契约与安全门禁

统一模板包 visual 契约并补齐完成证据;修复 release 版本一致性、管理员 token 撤销、CORS 与默认品牌配置;收敛依赖安全风险并完成全量回归验证。
This commit is contained in:
que01 committed 2026-10-18 22:05:31 +08:00
1 parent 456171aa85
commit 4f0b50c7f1
84 files changed
+7367 -5180

No files matched your search

@@ -4,7 +4,7 @@ import type { TemplatePackageManifest } from "./index.js";
export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[] = [
{
"packageKey": "acheng-campus-food",
"version": "1.0.2",
"version": "1.0.3",
"displayName": "阿成校园餐",
"defaultBrandSlug": "default-brand",
"runtimeContract": "1.0",
@@ -1659,6 +1659,42 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
"pages/records"
],
"visualTemplateKey": "acheng-campus-food",
"visualPresentation": {
"description": "适合校园餐饮、套餐预订和团体定制的暖橙菜单视觉。",
"variants": {
"hero": "stall-board",
"offeringList": "menu-card",
"detail": "dish-detail"
},
"theme": {
"colors": {
"background": "#FFF8F0",
"foreground": "#29231F",
"accent": "#E87532",
"dark": "#3B2118"
},
"radius": {
"card": "24rpx"
}
},
"layout": {
"home": [
"founder-card",
"brand-hero",
"trust-proof",
"offering-list"
],
"offerings": [
"offering-list"
],
"detail": [
"offering-detail"
],
"profile": [
"profile"
]
}
},
"previewFixture": {
"food": {
"schemaVersion": "1",
@@ -2050,7 +2086,7 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
},
{
"packageKey": "atelier-solopreneur",
"version": "1.3.1",
"version": "1.3.2",
"displayName": "独立工坊 · 品牌小程序",
"defaultBrandSlug": "atelier-studio",
"runtimeContract": "1.0",
@@ -4343,11 +4379,45 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
}
}
},
"visualTemplateKey": "atelier-solopreneur"
"visualTemplateKey": "atelier-solopreneur",
"visualPresentation": {
"description": "展示品牌小程序服务、试点案例与合作流程,承接需求咨询。",
"variants": {
"hero": "editorial",
"offeringList": "service-system",
"detail": "project-case"
},
"theme": {
"colors": {
"background": "#f6f6f4",
"foreground": "#17181a",
"accent": "#1f3a5f",
"dark": "#1f3a5f"
},
"radius": {
"card": "28rpx"
}
},
"layout": {
"home": [
"brand-hero",
"offering-list"
],
"offerings": [
"offering-list"
],
"detail": [
"offering-detail"
],
"profile": [
"profile"
]
}
}
},
{
"packageKey": "linjing-editorial",
"version": "1.0.5",
"version": "1.0.6",
"displayName": "林境建筑画册",
"defaultBrandSlug": "linjing-doors",
"runtimeContract": "1.0",
@@ -6264,6 +6334,43 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
"pages/bookings/index"
],
"visualTemplateKey": "linjing-editorial",
"visualPresentation": {
"description": "适合高端定制、建筑作品和项目型个人品牌。",
"variants": {
"hero": "architectural",
"offeringList": "editorial",
"detail": "project-case"
},
"theme": {
"colors": {
"background": "#F7F5F1",
"foreground": "#252525",
"accent": "#8A6846",
"dark": "#202221"
},
"radius": {
"card": "16rpx"
}
},
"layout": {
"home": [
"founder-card",
"brand-hero",
"trust-proof",
"trust-manifesto",
"offering-list"
],
"offerings": [
"offering-list"
],
"detail": [
"offering-detail"
],
"profile": [
"profile"
]
}
},
"previewFixture": {
"doors": {
"schemaVersion": "1",
@@ -6868,4 +6975,4 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
}
];
export const generatedTemplatePackageRegistryHash =
"dc82c85917f137a0f2a3a473147f32426ea0f46bf107adf709afd34cd5699db8";
"6c629f916b92e889a8984fde3ffc8ea3cb39ba25542b070da1f029ae57665d73";
@@ -1,3 +1,4 @@
import type { TemplateVisualPresentation } from "@personal-brand/template-contract";
import type { BrandTemplateKey } from "./template-keys.js";
import type { CapabilityKey } from "./template-keys.js";
import type { VisualTemplateKey } from "./template-keys.js";
@@ -28,6 +29,7 @@ export interface TemplatePackageManifest {
version: string;
displayName: string;
visualTemplateKey: VisualTemplateKey;
visualPresentation: TemplateVisualPresentation;
runtimeContract: "1.0";
supportedIndustryTemplates: readonly BrandTemplateKey[];
entrypoints: Readonly<Record<string, string>>;
+1 -269
View File
@@ -1,280 +1,12 @@
import type { VisualTemplateKey } from "./template-keys.js";
import type { VisualTemplateDefinition, VisualTemplateManifest } from "./brand-contracts.js";
import { getTemplatePackageManifestForVisualKey } from "./template-packages.js";
import { getVisualTemplate } from "./visual-templates.js";
const linjingEditorialManifest: VisualTemplateManifest = {
schemaVersion: "1.0",
key: "linjing-editorial",
version: "1.0.0",
name: "林境建筑画册",
description: "以个人品牌信任为主线、以高端项目作品为表达重点的编辑式视觉模板。",
supportedIndustryTemplates: ["personal", "doors"],
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: "首页",
renderer: "linjing-home",
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: "业务提供项",
renderer: "linjing-offerings",
modules: [
{
key: "offerings",
type: "offering-list",
variant: "editorial-grid",
required: true,
dataSlots: ["offerings.list"],
assetSlots: ["offering.cover"],
capability: "offerings",
},
],
},
{
key: "detail",
title: "提供项详情",
renderer: "linjing-offering-detail",
modules: [
{
key: "detail",
type: "offering-detail",
variant: "project-case",
required: true,
dataSlots: ["offering.detail"],
assetSlots: ["offering.cover"],
capability: "offerings",
},
],
},
{
key: "inquiry",
title: "咨询与预约",
renderer: "linjing-inquiry",
modules: [
{
key: "inquiry",
type: "inquiry-form",
variant: "editorial-form",
required: true,
dataSlots: ["inquiry.form"],
capability: "inquiry",
},
],
},
{
key: "success",
title: "提交成功",
renderer: "linjing-success",
modules: [
{
key: "success",
type: "success-summary",
variant: "editorial-confirmation",
required: true,
dataSlots: ["brand.identity"],
},
],
},
{
key: "records",
title: "我的记录",
renderer: "linjing-records",
modules: [
{
key: "records",
type: "records-list",
variant: "timeline",
required: true,
dataSlots: ["records.items"],
},
],
},
{
key: "profile",
title: "主理人与我",
renderer: "linjing-profile",
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,
"acheng-campus-food": {
...linjingEditorialManifest,
key: "acheng-campus-food",
version: "1.0.0",
name: "阿成校园餐",
description: "面向校园餐饮摊贩的菜单、出摊动态和团体预订视觉模板。",
supportedIndustryTemplates: ["food"],
tokens: {
...linjingEditorialManifest.tokens,
colors: {
background: "#FFF8F0",
surface: "#FFFFFF",
foreground: "#29231F",
muted: "#7A6A60",
accent: "#E87532",
dark: "#3B2118",
},
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"],
},
};
export function getVisualTemplateManifest(key: string): VisualTemplateManifest | undefined {
if (visualTemplateManifests[key]) return visualTemplateManifests[key];
const manifest = getTemplatePackageManifestForVisualKey(key);
const visual = getVisualTemplate(key);
if (!manifest || !visual) return undefined;
// 新模板从包声明投影安装快照,避免目录可选但遗漏旧版 manifest 注册。
// 所有模板都从包 manifest 投影安装快照,不保留旧视觉 manifest 注册表。
const roles: VisualTemplateManifest["pages"] = [
{
key: "home",
+30 -60
View File
@@ -1,69 +1,39 @@
import type { VisualTemplateKey } from "./template-keys.js";
import type { VisualTemplateDefinition } from "./brand-contracts.js";
import { templatePackageRegistry } from "./template-packages.js";
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" },
radius: { card: "16rpx" },
},
layout: {
home: ["founder-card", "brand-hero", "trust-proof", "trust-manifesto", "offering-list"],
offerings: ["offering-list"],
detail: ["offering-detail"],
profile: ["profile"],
},
},
"acheng-campus-food": {
key: "acheng-campus-food",
version: "1.0.0",
name: "阿成校园餐",
description: "适合校园餐饮、套餐预订和团体定制的暖橙菜单视觉。",
supportedIndustryTemplates: ["food"],
variants: { hero: "stall-board", offeringList: "menu-card", detail: "dish-detail" },
theme: {
colors: { background: "#FFF8F0", foreground: "#29231F", accent: "#E87532", dark: "#3B2118" },
radius: { card: "24rpx" },
},
layout: {
home: ["founder-card", "brand-hero", "trust-proof", "offering-list"],
offerings: ["offering-list"],
detail: ["offering-detail"],
profile: ["profile"],
},
},
"atelier-solopreneur": {
key: "atelier-solopreneur",
version: "1.2.0",
name: "独立工坊 · 品牌小程序",
description: "展示品牌小程序服务、试点案例与合作流程,承接需求咨询。",
supportedIndustryTemplates: ["personal"],
variants: { hero: "editorial", offeringList: "service-system", detail: "project-case" },
theme: {
colors: { background: "#f6f6f4", foreground: "#17181a", accent: "#1f3a5f", dark: "#1f3a5f" },
radius: { card: "28rpx" },
},
layout: {
home: ["brand-hero", "offering-list"],
offerings: ["offering-list"],
detail: ["offering-detail"],
profile: ["profile"],
},
},
};
export const visualTemplateKeys: VisualTemplateKey[] = templatePackageRegistry.map(
(manifest) => manifest.visualTemplateKey,
);
export function listVisualTemplateKeys(): VisualTemplateKey[] {
return Object.keys(visualTemplates);
return visualTemplateKeys;
}
export const visualTemplateKeys = listVisualTemplateKeys();
export function getVisualTemplate(key: string): VisualTemplateDefinition | undefined {
return visualTemplates[key];
const manifest = templatePackageRegistry.find((item) => item.visualTemplateKey === key);
if (!manifest) return undefined;
const presentation = manifest.visualPresentation;
return {
key: manifest.visualTemplateKey,
version: manifest.version,
name: manifest.displayName,
description: presentation.description,
supportedIndustryTemplates: [...manifest.supportedIndustryTemplates],
variants: { ...presentation.variants },
theme: {
colors: { ...presentation.theme.colors },
radius: { ...presentation.theme.radius },
},
...(presentation.layout
? {
layout: {
home: [...presentation.layout.home],
offerings: [...presentation.layout.offerings],
detail: [...presentation.layout.detail],
profile: [...presentation.layout.profile],
},
}
: {}),
};
}
@@ -1,6 +1,6 @@
{
"name": "@personal-brand/template-acheng-campus-food",
"version": "1.0.2",
"version": "1.0.3",
"private": true,
"type": "module",
"files": [
@@ -70,22 +70,29 @@ function Home({ workspace }: { workspace: RuntimeWorkspace }) {
</Text>
</View>
<View className="dish-grid">
{list.map((item) => (
<View
className="dish"
key={item.id}
data-editor-target="acheng-campus-food.home.offering"
data-editor-record-id={item.id}
onClick={() => navigate("detail", { id: item.id })}
>
<Image src={item.image} mode="aspectFill" />
<View className="dish-copy">
<Text className="dish-name">{item.name}</Text>
<Text className="dish-sub">{item.desc}</Text>
<Text className="price">{item.priceRange}</Text>
{list.length ? (
list.map((item) => (
<View
className="dish"
key={item.id}
data-editor-target="acheng-campus-food.home.offering"
data-editor-record-id={item.id}
onClick={() => navigate("detail", { id: item.id })}
>
<Image src={item.image} mode="aspectFill" />
<View className="dish-copy">
<Text className="dish-name">{item.name}</Text>
<Text className="dish-sub">{item.desc}</Text>
<Text className="price">{item.priceRange}</Text>
</View>
</View>
))
) : (
<View className="runtime-state">
餐品与服务正在整理中
<Button onClick={() => navigate("offerings")}>查看全部</Button>
</View>
))}
)}
</View>
<View data-editor-target="food.home.promise-heading">
<Text className="heading manifesto-heading">{p.manifestoTitle}</Text>
@@ -1,6 +1,6 @@
{
"packageKey": "acheng-campus-food",
"version": "1.0.2",
"version": "1.0.3",
"displayName": "阿成校园餐",
"defaultBrandSlug": "default-brand",
"runtimeContract": "1.0",
@@ -1616,6 +1616,31 @@
],
"overrides": ["pages/inquiry", "pages/inquiry-success", "pages/offering", "pages/records"],
"visualTemplateKey": "acheng-campus-food",
"visualPresentation": {
"description": "适合校园餐饮、套餐预订和团体定制的暖橙菜单视觉。",
"variants": {
"hero": "stall-board",
"offeringList": "menu-card",
"detail": "dish-detail"
},
"theme": {
"colors": {
"background": "#FFF8F0",
"foreground": "#29231F",
"accent": "#E87532",
"dark": "#3B2118"
},
"radius": {
"card": "24rpx"
}
},
"layout": {
"home": ["founder-card", "brand-hero", "trust-proof", "offering-list"],
"offerings": ["offering-list"],
"detail": ["offering-detail"],
"profile": ["profile"]
}
},
"previewFixture": {
"food": {
"schemaVersion": "1",
@@ -1,6 +1,6 @@
{
"name": "@personal-brand/template-atelier-solopreneur",
"version": "1.3.1",
"version": "1.3.2",
"private": true,
"type": "module",
"files": [
@@ -88,28 +88,35 @@ function Home({ workspace }: Props) {
<Text>{p.caseAction}</Text>
</View>
<View className="atelier-cases">
{workspace.offerings.map((item) => (
<View
className="atelier-case"
key={item.id}
data-editor-target="atelier.home.case"
data-editor-record-id={item.id}
onClick={() => navigate("detail", { id: item.id })}
>
{item.coverUrl ? (
<Image src={item.coverUrl} mode="aspectFill" />
) : (
<View className="atelier-case-placeholder">
<Text>↗</Text>
{workspace.offerings.length ? (
workspace.offerings.map((item) => (
<View
className="atelier-case"
key={item.id}
data-editor-target="atelier.home.case"
data-editor-record-id={item.id}
onClick={() => navigate("detail", { id: item.id })}
>
{item.coverUrl ? (
<Image src={item.coverUrl} mode="aspectFill" />
) : (
<View className="atelier-case-placeholder">
<Text>↗</Text>
</View>
)}
<View className="atelier-case-copy">
<Text className="atelier-card-title">{item.name}</Text>
<Text className="atelier-caption">{item.summary}</Text>
<Text className="atelier-case-arrow">→</Text>
</View>
)}
<View className="atelier-case-copy">
<Text className="atelier-card-title">{item.name}</Text>
<Text className="atelier-caption">{item.summary}</Text>
<Text className="atelier-case-arrow">→</Text>
</View>
))
) : (
<View className="runtime-state">
案例内容正在整理中
<InquiryAction workspace={workspace} label={p.primaryAction} />
</View>
))}
)}
</View>
<View className="atelier-heading" data-editor-target="atelier.home.audienceHeading">
<Text>{p.audienceTitle}</Text>
@@ -1,6 +1,6 @@
{
"packageKey": "atelier-solopreneur",
"version": "1.3.1",
"version": "1.3.2",
"displayName": "独立工坊 · 品牌小程序",
"defaultBrandSlug": "atelier-studio",
"runtimeContract": "1.0",
@@ -2266,5 +2266,30 @@
}
}
},
"visualTemplateKey": "atelier-solopreneur"
"visualTemplateKey": "atelier-solopreneur",
"visualPresentation": {
"description": "展示品牌小程序服务、试点案例与合作流程,承接需求咨询。",
"variants": {
"hero": "editorial",
"offeringList": "service-system",
"detail": "project-case"
},
"theme": {
"colors": {
"background": "#f6f6f4",
"foreground": "#17181a",
"accent": "#1f3a5f",
"dark": "#1f3a5f"
},
"radius": {
"card": "28rpx"
}
},
"layout": {
"home": ["brand-hero", "offering-list"],
"offerings": ["offering-list"],
"detail": ["offering-detail"],
"profile": ["profile"]
}
}
}
@@ -3,6 +3,25 @@
"version": "0.1.0",
"displayName": "咨询师演练模板",
"visualTemplateKey": "drill-consultant",
"visualPresentation": {
"description": "用于编译器测试的咨询师视觉演练。",
"variants": {
"hero": "consulting",
"offeringList": "service-list",
"detail": "case"
},
"theme": {
"colors": {
"background": "#f7f7f4",
"foreground": "#202020",
"accent": "#2f5d62",
"dark": "#17252a"
},
"radius": {
"card": "16rpx"
}
}
},
"defaultBrandSlug": "drill-consultant",
"runtimeContract": "1.0",
"supportedIndustryTemplates": ["consulting"],
@@ -16,9 +35,21 @@
"profile": "pages/profile/index"
},
"navigation": [
{ "key": "home", "label": "首页", "page": "home" },
{ "key": "offerings", "label": "服务", "page": "offerings" },
{ "key": "profile", "label": "关于我", "page": "profile" }
{
"key": "home",
"label": "首页",
"page": "home"
},
{
"key": "offerings",
"label": "服务",
"page": "offerings"
},
{
"key": "profile",
"label": "关于我",
"page": "profile"
}
],
"requiredCapabilities": ["offerings", "inquiry"],
"pages": ["pages/index/index", "pages/services/index", "pages/profile/index"],
+43
View File
@@ -133,11 +133,24 @@ export type TemplateSampleContent = {
capabilityKey: string;
};
export type TemplateVisualPresentation = {
description: string;
variants: Record<string, string>;
theme: { colors: Record<string, string>; radius: Record<string, string> };
layout?: {
home: string[];
offerings: string[];
detail: string[];
profile: string[];
};
};
export type TemplatePackageManifest = {
packageKey: string;
version: string;
displayName: string;
visualTemplateKey: string;
visualPresentation: TemplateVisualPresentation;
runtimeContract: typeof TEMPLATE_RUNTIME_CONTRACT;
supportedIndustryTemplates: string[];
entrypoints: Record<string, string>;
@@ -179,6 +192,36 @@ export function validateTemplatePackageManifest(value: unknown): string[] {
if (manifest.runtimeContract !== TEMPLATE_RUNTIME_CONTRACT)
errors.push(`runtimeContract must be ${TEMPLATE_RUNTIME_CONTRACT}`);
if (!manifest.displayName?.trim()) errors.push("displayName is required");
const presentation = manifest.visualPresentation;
if (
!presentation ||
typeof presentation !== "object" ||
!presentation.description?.trim() ||
!presentation.variants ||
typeof presentation.variants !== "object" ||
Array.isArray(presentation.variants) ||
!Object.values(presentation.variants).every(
(variant) => typeof variant === "string" && variant.trim(),
) ||
!presentation.theme ||
typeof presentation.theme !== "object" ||
!presentation.theme.colors ||
typeof presentation.theme.colors !== "object" ||
!presentation.theme.radius ||
typeof presentation.theme.radius !== "object"
) {
errors.push("visualPresentation requires description, variants, theme.colors and theme.radius");
} else if (presentation.layout) {
const layout = presentation.layout;
if (
!(["home", "offerings", "detail", "profile"] as const).every(
(page) =>
Array.isArray(layout[page]) && layout[page].every((item) => typeof item === "string"),
)
) {
errors.push("visualPresentation.layout must contain page module arrays");
}
}
if (
!Array.isArray(manifest.supportedIndustryTemplates) ||
!manifest.supportedIndustryTemplates.length
@@ -74,6 +74,23 @@ test("template contract rejects technical or incomplete admin declarations", ()
]);
});
test("template package manifests must declare package-owned visual presentation", () => {
const manifestPath = path.join(packageRoot, "template-acheng-campus-food/template.json");
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
delete manifest.visualPresentation;
assert.deepEqual(validateTemplatePackageManifest(manifest), [
"visualPresentation requires description, variants, theme.colors and theme.radius",
]);
manifest.visualPresentation = {
description: "无效视觉",
variants: { hero: "hero" },
theme: { colors: { background: "#fff" }, radius: { card: "16rpx" } },
layout: { home: ["hero"], offerings: [], detail: [], profile: [] },
};
assert.deepEqual(validateTemplatePackageManifest(manifest), []);
});
test("template admin sections must point to a declared Mini Program page", () => {
const manifestPath = path.join(packageRoot, "template-acheng-campus-food/template.json");
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
@@ -1,6 +1,6 @@
{
"name": "@personal-brand/template-linjing-editorial",
"version": "1.0.5",
"version": "1.0.6",
"private": true,
"type": "module",
"files": [
@@ -101,26 +101,33 @@ function Home({ workspace }: { workspace: RuntimeWorkspace }) {
{p.worksAction}
</Text>
</View>
{workspace.offerings.map(offering).map((item) => (
<View
className="work-card"
key={item.id}
data-editor-target="linjing-editorial.home.offering"
data-editor-record-id={item.id}
onClick={() => navigate("detail", { id: item.id })}
>
<Image src={item.image} mode="aspectFill" />
<View className="work-info">
<Text className="work-category">
{item.category} · {item.area}
</Text>
<Text className="work-name">{item.name}</Text>
<Text className="work-desc">
{[item.series, ...item.keywords.slice(0, 2)].filter(Boolean).join(" · ")}
</Text>
{workspace.offerings.length ? (
workspace.offerings.map(offering).map((item) => (
<View
className="work-card"
key={item.id}
data-editor-target="linjing-editorial.home.offering"
data-editor-record-id={item.id}
onClick={() => navigate("detail", { id: item.id })}
>
<Image src={item.image} mode="aspectFill" />
<View className="work-info">
<Text className="work-category">
{item.category} · {item.area}
</Text>
<Text className="work-name">{item.name}</Text>
<Text className="work-desc">
{[item.series, ...item.keywords.slice(0, 2)].filter(Boolean).join(" · ")}
</Text>
</View>
</View>
))
) : (
<View className="runtime-state">
作品与服务正在整理中
<Button onClick={() => navigate("inquiry")}>联系我们</Button>
</View>
))}
)}
</View>
<View className="flow" data-editor-target="editorial.home.flow">
<Text className="flow-eyebrow">{p.flowEyebrow}</Text>
@@ -256,28 +263,35 @@ function List({ workspace }: { workspace: RuntimeWorkspace }) {
<Text className="eyebrow">{p.worksEyebrow}</Text>
<Text className="section-title">{p.worksTitle || "作品与服务"}</Text>
<Text className="subtitle">{p.subtitle}</Text>
{workspace.offerings.map(offering).map((item) => (
<View
className="work-card"
key={item.id}
data-editor-target="linjing-editorial.offerings.item"
data-editor-record-id={item.id}
onClick={() => navigate("detail", { id: item.id })}
>
<Image src={item.image} mode="aspectFill" />
<View className="work-info">
<Text className="work-category">
{item.category} · {item.area}
</Text>
<Text className="work-name">{item.name}</Text>
<Text className="work-desc">{item.desc}</Text>
<Text className="work-price">{item.priceRange}</Text>
<Text className="more" data-editor-target="linjing-editorial.offerings.action">
{p.detailAction || "了解详情 →"}
</Text>
{workspace.offerings.length ? (
workspace.offerings.map(offering).map((item) => (
<View
className="work-card"
key={item.id}
data-editor-target="linjing-editorial.offerings.item"
data-editor-record-id={item.id}
onClick={() => navigate("detail", { id: item.id })}
>
<Image src={item.image} mode="aspectFill" />
<View className="work-info">
<Text className="work-category">
{item.category} · {item.area}
</Text>
<Text className="work-name">{item.name}</Text>
<Text className="work-desc">{item.desc}</Text>
<Text className="work-price">{item.priceRange}</Text>
<Text className="more" data-editor-target="linjing-editorial.offerings.action">
{p.detailAction || "了解详情 →"}
</Text>
</View>
</View>
))
) : (
<View className="runtime-state">
作品与服务正在整理中
<Button onClick={() => navigate("inquiry")}>联系我们</Button>
</View>
))}
)}
<Text className="subtitle">{p.closingText}</Text>
{p.closingAction &&
(inquiryPluginState(workspace).enabled ? (
@@ -1,6 +1,6 @@
{
"packageKey": "linjing-editorial",
"version": "1.0.5",
"version": "1.0.6",
"displayName": "林境建筑画册",
"defaultBrandSlug": "linjing-doors",
"runtimeContract": "1.0",
@@ -1894,6 +1894,31 @@
},
"pages": ["pages/index/index", "pages/services/index", "pages/bookings/index"],
"visualTemplateKey": "linjing-editorial",
"visualPresentation": {
"description": "适合高端定制、建筑作品和项目型个人品牌。",
"variants": {
"hero": "architectural",
"offeringList": "editorial",
"detail": "project-case"
},
"theme": {
"colors": {
"background": "#F7F5F1",
"foreground": "#252525",
"accent": "#8A6846",
"dark": "#202221"
},
"radius": {
"card": "16rpx"
}
},
"layout": {
"home": ["founder-card", "brand-hero", "trust-proof", "trust-manifesto", "offering-list"],
"offerings": ["offering-list"],
"detail": ["offering-detail"],
"profile": ["profile"]
}
},
"previewFixture": {
"doors": {
"schemaVersion": "1",