feat: 完善后台可视化模板编辑与区域绑定

This commit is contained in:
que01 committed 2026-10-09 14:26:05 +08:00
1 parent 0b14b5a814
commit 5b85fe769f
18 files changed
+1620 -239

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@ import type {
RuntimeTrustItem,
ThemeManifest,
} from "@personal-brand/types";
export { projectBrandAliases } from "@personal-brand/types";
export { projectBrandAliases, projectTrustPresentation } from "@personal-brand/types";
export type { PublicOffering } from "@personal-brand/types";
export type { BookingStatus } from "@personal-brand/types";
export type { BrandTemplateKey } from "@personal-brand/types";
@@ -201,6 +201,49 @@ export const generatedTemplatePackageRegistry = [
}
]
},
{
"key": "homeOffering",
"title": "首页业务卡片",
"description": "点选预览中的单条内容,修改对应业务记录。",
"page": "home",
"target": "offering",
"fields": [
{
"key": "name",
"binding": "offering.name",
"label": "名称",
"input": "text",
"previewTarget": "acheng-campus-food.home.offering"
},
{
"key": "summary",
"binding": "offering.summary",
"label": "简介",
"input": "textarea",
"previewTarget": "acheng-campus-food.home.offering"
},
{
"key": "priceText",
"binding": "offering.priceText",
"label": "价格说明",
"input": "text",
"previewTarget": "acheng-campus-food.home.offering"
},
{
"key": "coverUrl",
"binding": "offering.coverUrl",
"label": "封面图片",
"input": "image",
"previewTarget": "acheng-campus-food.home.offering"
}
],
"previewTargets": [
{
"key": "acheng-campus-food.home.offering",
"label": "首页业务卡片"
}
]
},
{
"key": "home",
"title": "首页出摊信息",
@@ -297,6 +340,49 @@ export const generatedTemplatePackageRegistry = [
}
]
},
{
"key": "offeringsOffering",
"title": "业务卡片",
"description": "点选预览中的单条内容,修改对应业务记录。",
"page": "offerings",
"target": "offering",
"fields": [
{
"key": "name",
"binding": "offering.name",
"label": "名称",
"input": "text",
"previewTarget": "acheng-campus-food.offerings.item"
},
{
"key": "summary",
"binding": "offering.summary",
"label": "简介",
"input": "textarea",
"previewTarget": "acheng-campus-food.offerings.item"
},
{
"key": "priceText",
"binding": "offering.priceText",
"label": "价格说明",
"input": "text",
"previewTarget": "acheng-campus-food.offerings.item"
},
{
"key": "coverUrl",
"binding": "offering.coverUrl",
"label": "封面图片",
"input": "image",
"previewTarget": "acheng-campus-food.offerings.item"
}
],
"previewTargets": [
{
"key": "acheng-campus-food.offerings.item",
"label": "业务卡片"
}
]
},
{
"key": "menu",
"title": "菜单页说明",
@@ -1428,6 +1514,49 @@ export const generatedTemplatePackageRegistry = [
}
]
},
{
"key": "homeOffering",
"title": "首页业务卡片",
"description": "点选预览中的单条内容,修改对应业务记录。",
"page": "home",
"target": "offering",
"fields": [
{
"key": "name",
"binding": "offering.name",
"label": "名称",
"input": "text",
"previewTarget": "linjing-editorial.home.offering"
},
{
"key": "summary",
"binding": "offering.summary",
"label": "简介",
"input": "textarea",
"previewTarget": "linjing-editorial.home.offering"
},
{
"key": "priceText",
"binding": "offering.priceText",
"label": "价格说明",
"input": "text",
"previewTarget": "linjing-editorial.home.offering"
},
{
"key": "coverUrl",
"binding": "offering.coverUrl",
"label": "封面图片",
"input": "image",
"previewTarget": "linjing-editorial.home.offering"
}
],
"previewTargets": [
{
"key": "linjing-editorial.home.offering",
"label": "首页业务卡片"
}
]
},
{
"key": "home",
"title": "首页品牌表达",
@@ -1689,6 +1818,49 @@ export const generatedTemplatePackageRegistry = [
}
]
},
{
"key": "offeringsOffering",
"title": "业务卡片",
"description": "点选预览中的单条内容,修改对应业务记录。",
"page": "offerings",
"target": "offering",
"fields": [
{
"key": "name",
"binding": "offering.name",
"label": "名称",
"input": "text",
"previewTarget": "linjing-editorial.offerings.item"
},
{
"key": "summary",
"binding": "offering.summary",
"label": "简介",
"input": "textarea",
"previewTarget": "linjing-editorial.offerings.item"
},
{
"key": "priceText",
"binding": "offering.priceText",
"label": "价格说明",
"input": "text",
"previewTarget": "linjing-editorial.offerings.item"
},
{
"key": "coverUrl",
"binding": "offering.coverUrl",
"label": "封面图片",
"input": "image",
"previewTarget": "linjing-editorial.offerings.item"
}
],
"previewTargets": [
{
"key": "linjing-editorial.offerings.item",
"label": "业务卡片"
}
]
},
{
"key": "cases",
"title": "案例与体系",
@@ -2451,4 +2623,4 @@ export const generatedTemplatePackageRegistry = [
}
];
export const generatedTemplatePackageRegistryHash =
"affa45e548331400f6f552562653f2f21b8ac3643ccb7521df9609776ebae4ae";
"495374aaba6d94ef9597a525a8ca3af221d9fb44e7eaf34d75b71b8b6070bd2f";
@@ -65,6 +65,8 @@ function Home({ workspace }: { workspace: RuntimeWorkspace }) {
<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" />
@@ -82,7 +84,12 @@ function Home({ workspace }: { workspace: RuntimeWorkspace }) {
{workspace.trustItems
.filter((item) => ["promise", "case"].includes(item.type))
.map((item) => (
<View className="promise" key={item.id}>
<View
className="promise"
key={item.id}
data-editor-target={`trust:${item.type}`}
data-editor-record-id={item.id}
>
<Text className="eyebrow light">{item.title}</Text>
{item.summary && <Text className="promise-title">{item.summary}</Text>}
<Text className="quote">{item.content}</Text>
@@ -119,7 +126,11 @@ function Service({ workspace }: { workspace: RuntimeWorkspace }) {
<View className="food-service" data-editor-target="acheng-campus-food.service.service">
<View className="page service-page">
{schedule && scheduleRows.length > 0 && (
<View className="service-card schedule-card">
<View
className="service-card schedule-card"
data-editor-target="trust:schedule"
data-editor-record-id={schedule.id}
>
<View className="card-head">
<View className="head-title">
<Image className="icon" src={asset("service/clock.png")} />
@@ -152,7 +163,11 @@ function Service({ workspace }: { workspace: RuntimeWorkspace }) {
</View>
)}
{c && text(c.config.pickupDetail) && text(c.config.deliveryDetail) && (
<View className="service-card coverage-card">
<View
className="service-card coverage-card"
data-editor-target="trust:coverage"
data-editor-record-id={c.id}
>
<View className="simple-title">
<Image className="icon" src={asset("service/bike.png")} />
<Text>{c.title}</Text>
@@ -176,7 +191,11 @@ function Service({ workspace }: { workspace: RuntimeWorkspace }) {
</View>
)}
{process && steps.length > 0 && (
<View className="service-card process-card">
<View
className="service-card process-card"
data-editor-target="trust:process"
data-editor-record-id={process.id}
>
<View className="simple-title">
<Image className="icon" src={asset("service/list.png")} />
<Text>{process.title}</Text>
@@ -237,7 +256,12 @@ function Profile({ workspace }: { workspace: RuntimeWorkspace }) {
{text(brand.description) && <Text className="bio">{text(brand.description)}</Text>}
{credentials.map((item) =>
rows(item.config.standards).length ? (
<View className="standards" key={item.id}>
<View
className="standards"
key={item.id}
data-editor-target="trust:credential"
data-editor-record-id={item.id}
>
{rows(item.config.standards).map((standard, index) => (
<View className="standard" key={index}>
<Image
@@ -252,7 +276,12 @@ function Profile({ workspace }: { workspace: RuntimeWorkspace }) {
))}
</View>
) : (
<View className="credential-copy" key={item.id}>
<View
className="credential-copy"
key={item.id}
data-editor-target="trust:credential"
data-editor-record-id={item.id}
>
<Text className="credential-title">{item.title}</Text>
{item.summary && <Text className="bio">{item.summary}</Text>}
<Text className="bio">{item.content}</Text>
@@ -264,7 +293,12 @@ function Profile({ workspace }: { workspace: RuntimeWorkspace }) {
{workspace.trustItems
.filter((item) => item.type === "case")
.map((item) => (
<View className="case-card" key={item.id}>
<View
className="case-card"
key={item.id}
data-editor-target="trust:case"
data-editor-record-id={item.id}
>
<View className="section-heading">
<Image className="heading-icon" src={asset("owner/handshake.png")} />
<Text>{item.title}</Text>
@@ -291,7 +325,12 @@ function Profile({ workspace }: { workspace: RuntimeWorkspace }) {
{workspace.trustItems
.filter((item) => item.type === "promise")
.map((item) => (
<View className="promise-card" key={item.id}>
<View
className="promise-card"
key={item.id}
data-editor-target="trust:promise"
data-editor-record-id={item.id}
>
<View className="section-heading">
<Image className="promise-icon" src={asset("owner/clock.png")} />
<Text>{item.title}</Text>
@@ -409,6 +448,8 @@ function OfferingList({ workspace }: { workspace: RuntimeWorkspace }) {
<View
className="offering-card"
key={item.id}
data-editor-target="acheng-campus-food.offerings.item"
data-editor-record-id={item.id}
onClick={() => navigate("detail", { id: item.id })}
>
<View className="dish-media">
@@ -447,7 +488,11 @@ function Detail({ workspace, id }: { workspace: RuntimeWorkspace; id?: string })
const item = offering(found);
const p = presentation(workspace, "detail");
return (
<View className="food-detail" data-editor-target="acheng-campus-food.detail.dishDetail">
<View
className="food-detail"
data-editor-target="acheng-campus-food.detail.dishDetail"
data-editor-record-id={item.id}
>
<View className="detail">
<View className="hero-wrap">
<Image
@@ -194,6 +194,49 @@
}
]
},
{
"key": "homeOffering",
"title": "首页业务卡片",
"description": "点选预览中的单条内容,修改对应业务记录。",
"page": "home",
"target": "offering",
"fields": [
{
"key": "name",
"binding": "offering.name",
"label": "名称",
"input": "text",
"previewTarget": "acheng-campus-food.home.offering"
},
{
"key": "summary",
"binding": "offering.summary",
"label": "简介",
"input": "textarea",
"previewTarget": "acheng-campus-food.home.offering"
},
{
"key": "priceText",
"binding": "offering.priceText",
"label": "价格说明",
"input": "text",
"previewTarget": "acheng-campus-food.home.offering"
},
{
"key": "coverUrl",
"binding": "offering.coverUrl",
"label": "封面图片",
"input": "image",
"previewTarget": "acheng-campus-food.home.offering"
}
],
"previewTargets": [
{
"key": "acheng-campus-food.home.offering",
"label": "首页业务卡片"
}
]
},
{
"key": "home",
"title": "首页出摊信息",
@@ -290,6 +333,49 @@
}
]
},
{
"key": "offeringsOffering",
"title": "业务卡片",
"description": "点选预览中的单条内容,修改对应业务记录。",
"page": "offerings",
"target": "offering",
"fields": [
{
"key": "name",
"binding": "offering.name",
"label": "名称",
"input": "text",
"previewTarget": "acheng-campus-food.offerings.item"
},
{
"key": "summary",
"binding": "offering.summary",
"label": "简介",
"input": "textarea",
"previewTarget": "acheng-campus-food.offerings.item"
},
{
"key": "priceText",
"binding": "offering.priceText",
"label": "价格说明",
"input": "text",
"previewTarget": "acheng-campus-food.offerings.item"
},
{
"key": "coverUrl",
"binding": "offering.coverUrl",
"label": "封面图片",
"input": "image",
"previewTarget": "acheng-campus-food.offerings.item"
}
],
"previewTargets": [
{
"key": "acheng-campus-food.offerings.item",
"label": "业务卡片"
}
]
},
{
"key": "menu",
"title": "菜单页说明",
@@ -53,7 +53,13 @@ function Home({ workspace }: { workspace: RuntimeWorkspace }) {
<View className="intro" data-editor-target="editorial.home.proof">
<Text className="eyebrow dark">{p.proofEyebrow}</Text>
<Text className="section-title">{p.proofTitle}</Text>
<Text className="body">{credential?.content}</Text>
<Text
className="body"
data-editor-target="trust:credential"
data-editor-record-id={credential?.id}
>
{credential?.content}
</Text>
<View className="stats">
{t.stats?.map((item, index) => (
<View key={index}>
@@ -88,6 +94,8 @@ function Home({ workspace }: { workspace: RuntimeWorkspace }) {
<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" />
@@ -205,7 +213,12 @@ function Profile({ workspace }: { workspace: RuntimeWorkspace }) {
</View>
)}
{workspace.trustItems.map((item) => (
<View className="info-card trust-card" key={item.id}>
<View
className="info-card trust-card"
key={item.id}
data-editor-target={`trust:${item.type}`}
data-editor-record-id={item.id}
>
<View className="card-title">{item.title}</View>
{item.summary && <Text className="trust-summary">{item.summary}</Text>}
<Text>{item.content}</Text>
@@ -227,6 +240,8 @@ function List({ workspace }: { workspace: RuntimeWorkspace }) {
<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" />
@@ -258,7 +273,11 @@ function Detail({ workspace, id }: { workspace: RuntimeWorkspace; id?: string })
const item = offering(found);
const p = presentation(workspace, "detail");
return (
<View className="editorial-detail" data-editor-target="linjing-editorial.detail.projectDetail">
<View
className="editorial-detail"
data-editor-target="linjing-editorial.detail.projectDetail"
data-editor-record-id={item.id}
>
<View className="detail">
<View className="hero-wrap">
<Image
@@ -161,6 +161,49 @@
}
]
},
{
"key": "homeOffering",
"title": "首页业务卡片",
"description": "点选预览中的单条内容,修改对应业务记录。",
"page": "home",
"target": "offering",
"fields": [
{
"key": "name",
"binding": "offering.name",
"label": "名称",
"input": "text",
"previewTarget": "linjing-editorial.home.offering"
},
{
"key": "summary",
"binding": "offering.summary",
"label": "简介",
"input": "textarea",
"previewTarget": "linjing-editorial.home.offering"
},
{
"key": "priceText",
"binding": "offering.priceText",
"label": "价格说明",
"input": "text",
"previewTarget": "linjing-editorial.home.offering"
},
{
"key": "coverUrl",
"binding": "offering.coverUrl",
"label": "封面图片",
"input": "image",
"previewTarget": "linjing-editorial.home.offering"
}
],
"previewTargets": [
{
"key": "linjing-editorial.home.offering",
"label": "首页业务卡片"
}
]
},
{
"key": "home",
"title": "首页品牌表达",
@@ -422,6 +465,49 @@
}
]
},
{
"key": "offeringsOffering",
"title": "业务卡片",
"description": "点选预览中的单条内容,修改对应业务记录。",
"page": "offerings",
"target": "offering",
"fields": [
{
"key": "name",
"binding": "offering.name",
"label": "名称",
"input": "text",
"previewTarget": "linjing-editorial.offerings.item"
},
{
"key": "summary",
"binding": "offering.summary",
"label": "简介",
"input": "textarea",
"previewTarget": "linjing-editorial.offerings.item"
},
{
"key": "priceText",
"binding": "offering.priceText",
"label": "价格说明",
"input": "text",
"previewTarget": "linjing-editorial.offerings.item"
},
{
"key": "coverUrl",
"binding": "offering.coverUrl",
"label": "封面图片",
"input": "image",
"previewTarget": "linjing-editorial.offerings.item"
}
],
"previewTargets": [
{
"key": "linjing-editorial.offerings.item",
"label": "业务卡片"
}
]
},
{
"key": "cases",
"title": "案例与体系",
@@ -62,6 +62,16 @@ export function runtimeContractForBinding(binding: string): RuntimeBindingContra
kind: "offering",
};
}
if (
binding.startsWith("offering.") &&
["name", "summary", "priceText", "coverUrl"].includes(binding.slice("offering.".length))
) {
return {
binding,
runtimePath: `workspace.offerings[].${binding.slice("offering.".length)}`,
kind: "offering",
};
}
if (binding === "trust.title" || binding === "trust.summary" || binding === "trust.content") {
return {
binding,
@@ -11,6 +11,10 @@ import {
} from "../src/runtime-content-contract.ts";
test("runtime contract resolves canonical paths", () => {
assert.equal(
runtimeContractForBinding("offering.name").runtimePath,
"workspace.offerings[].name",
);
assert.equal(
runtimeContractForBinding("offering.config.details.background").runtimePath,
"workspace.offerings[].presentation.details.background",