feat: 建立组件化模板预览基线并规划可视化编辑
This commit is contained in:
1 parent
c5af790554
commit
0b14b5a814
46 files changed
+1880
-427
No files matched your search
@@ -6,7 +6,8 @@ import { navigate } from "../../../apps/taro/src/runtime/navigation";
|
||||
import { presentation, offering, slot, text, rows } from "../../../apps/taro/src/runtime/content";
|
||||
import type { RuntimeWorkspace } from "@personal-brand/types";
|
||||
import "./style.css";
|
||||
const asset = (name: string) => `/assets/${name}`;
|
||||
const asset = (name: string) =>
|
||||
`/assets/${PREVIEW_ALL_TEMPLATES ? "acheng-campus-food/" : ""}${name}`;
|
||||
function Home({ workspace }: { workspace: RuntimeWorkspace }) {
|
||||
const brand = workspace.brand;
|
||||
const p = presentation(workspace, "home");
|
||||
@@ -115,7 +116,7 @@ function Service({ workspace }: { workspace: RuntimeWorkspace }) {
|
||||
].filter((row) => row.title && row.detail);
|
||||
const steps = rows(process?.config.steps).filter((step) => step.title && step.detail);
|
||||
return (
|
||||
<View className="food-service">
|
||||
<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">
|
||||
@@ -220,7 +221,7 @@ function Profile({ workspace }: { workspace: RuntimeWorkspace }) {
|
||||
const p = presentation(workspace, "profile");
|
||||
const credentials = workspace.trustItems.filter((item) => item.type === "credential");
|
||||
return (
|
||||
<View className="food-profile">
|
||||
<View className="food-profile" data-editor-target="acheng-campus-food.profile.identity">
|
||||
<View className="page">
|
||||
<View className="profile-card">
|
||||
<View className="portrait">
|
||||
@@ -340,13 +341,22 @@ function Profile({ workspace }: { workspace: RuntimeWorkspace }) {
|
||||
</View>
|
||||
);
|
||||
}
|
||||
const formTargets: Record<string, string> = {
|
||||
inquiry: "acheng-campus-food.inquiry.booking",
|
||||
success: "acheng-campus-food.success.successCopy",
|
||||
records: "acheng-campus-food.records.recordsCopy",
|
||||
};
|
||||
export function TemplatePage({ workspace, page, children, offeringId }: TemplateProps) {
|
||||
if (page === "home") return <Home workspace={workspace} />;
|
||||
if (page === "service") return <Service workspace={workspace} />;
|
||||
if (page === "profile") return <Profile workspace={workspace} />;
|
||||
if (page === "offerings") return <OfferingList workspace={workspace} />;
|
||||
if (page === "detail") return <Detail workspace={workspace} id={offeringId} />;
|
||||
return <View className="food-forms">{children}</View>;
|
||||
return (
|
||||
<View className="food-forms" data-editor-target={formTargets[page]}>
|
||||
{children}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
function OfferingList({ workspace }: { workspace: RuntimeWorkspace }) {
|
||||
const p = presentation(workspace, "offerings");
|
||||
@@ -363,7 +373,7 @@ function OfferingList({ workspace }: { workspace: RuntimeWorkspace }) {
|
||||
.includes(query.trim().toLowerCase()),
|
||||
);
|
||||
return (
|
||||
<View className="food-list">
|
||||
<View className="food-list" data-editor-target="acheng-campus-food.offerings.menu">
|
||||
<View className="page">
|
||||
<View className="filters">
|
||||
<Button
|
||||
@@ -437,7 +447,7 @@ function Detail({ workspace, id }: { workspace: RuntimeWorkspace; id?: string })
|
||||
const item = offering(found);
|
||||
const p = presentation(workspace, "detail");
|
||||
return (
|
||||
<View className="food-detail">
|
||||
<View className="food-detail" data-editor-target="acheng-campus-food.detail.dishDetail">
|
||||
<View className="detail">
|
||||
<View className="hero-wrap">
|
||||
<Image
|
||||
@@ -454,7 +464,7 @@ function Detail({ workspace, id }: { workspace: RuntimeWorkspace; id?: string })
|
||||
<Text>{item.series}</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className="content">
|
||||
<View className="content" data-editor-target="acheng-campus-food.detail.detailCopy">
|
||||
<View className="price-card">
|
||||
<View>
|
||||
<Text>{p.priceLabel || "参考价格"}</Text>
|
||||
|
||||
@@ -144,7 +144,8 @@
|
||||
"label": "主理人姓名",
|
||||
"input": "text",
|
||||
"required": true,
|
||||
"placeholder": "例如:阿成"
|
||||
"placeholder": "例如:阿成",
|
||||
"previewTarget": "acheng-campus-food.profile.identity"
|
||||
},
|
||||
{
|
||||
"key": "title",
|
||||
@@ -152,33 +153,44 @@
|
||||
"label": "你的身份",
|
||||
"help": "例如:校园餐饮主理人。",
|
||||
"input": "text",
|
||||
"required": true
|
||||
"required": true,
|
||||
"previewTarget": "acheng-campus-food.profile.identity"
|
||||
},
|
||||
{
|
||||
"key": "badge",
|
||||
"binding": "brand.config.visualPresentation.profile.badge",
|
||||
"label": "写真角标",
|
||||
"input": "text",
|
||||
"help": "显示在主理人写真上,可填写经验或服务定位。"
|
||||
"help": "显示在主理人写真上,可填写经验或服务定位。",
|
||||
"previewTarget": "acheng-campus-food.profile.identity"
|
||||
},
|
||||
{
|
||||
"key": "storyLead",
|
||||
"binding": "brand.config.visualPresentation.profile.storyLead",
|
||||
"label": "故事引言",
|
||||
"input": "textarea",
|
||||
"help": "故事开头的强调段落,下面的正文使用品牌简介。"
|
||||
"help": "故事开头的强调段落,下面的正文使用品牌简介。",
|
||||
"previewTarget": "acheng-campus-food.profile.identity"
|
||||
},
|
||||
{
|
||||
"key": "recordsTitle",
|
||||
"binding": "brand.config.visualPresentation.profile.recordsTitle",
|
||||
"label": "记录入口文案",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.profile.identity"
|
||||
},
|
||||
{
|
||||
"key": "recordsCountUnit",
|
||||
"binding": "brand.config.visualPresentation.profile.recordsCountUnit",
|
||||
"label": "记录数量单位",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.profile.identity"
|
||||
}
|
||||
],
|
||||
"previewTargets": [
|
||||
{
|
||||
"key": "acheng-campus-food.profile.identity",
|
||||
"label": "摊位与主理人"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -189,10 +201,22 @@
|
||||
"page": "home",
|
||||
"target": "brand",
|
||||
"previewTargets": [
|
||||
{ "key": "food.home.location", "label": "服务地点" },
|
||||
{ "key": "food.home.hero", "label": "出摊现场图片" },
|
||||
{ "key": "food.home.offerings-heading", "label": "餐品区域标题" },
|
||||
{ "key": "food.home.promise-heading", "label": "出餐承诺标题" }
|
||||
{
|
||||
"key": "food.home.location",
|
||||
"label": "服务地点"
|
||||
},
|
||||
{
|
||||
"key": "food.home.hero",
|
||||
"label": "出摊现场图片"
|
||||
},
|
||||
{
|
||||
"key": "food.home.offerings-heading",
|
||||
"label": "餐品区域标题"
|
||||
},
|
||||
{
|
||||
"key": "food.home.promise-heading",
|
||||
"label": "出餐承诺标题"
|
||||
}
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@@ -255,7 +279,14 @@
|
||||
"binding": "brand.config.visualPresentation.service.processAction",
|
||||
"label": "流程咨询按钮",
|
||||
"input": "text",
|
||||
"placeholder": "例如:立即预订"
|
||||
"placeholder": "例如:立即预订",
|
||||
"previewTarget": "acheng-campus-food.service.service"
|
||||
}
|
||||
],
|
||||
"previewTargets": [
|
||||
{
|
||||
"key": "acheng-campus-food.service.service",
|
||||
"label": "出摊服务页说明"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -270,21 +301,30 @@
|
||||
"key": "title",
|
||||
"binding": "brand.config.visualPresentation.offerings.title",
|
||||
"label": "菜单页标题",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.offerings.menu"
|
||||
},
|
||||
{
|
||||
"key": "subtitle",
|
||||
"binding": "brand.config.visualPresentation.offerings.subtitle",
|
||||
"label": "菜单页说明",
|
||||
"input": "textarea",
|
||||
"maxLength": 120
|
||||
"maxLength": 120,
|
||||
"previewTarget": "acheng-campus-food.offerings.menu"
|
||||
},
|
||||
{
|
||||
"key": "menuTip",
|
||||
"binding": "brand.config.visualPresentation.offerings.menuTip",
|
||||
"label": "菜单提示",
|
||||
"help": "只填写当前实际提供的取餐、加菜或定制服务。",
|
||||
"input": "textarea"
|
||||
"input": "textarea",
|
||||
"previewTarget": "acheng-campus-food.offerings.menu"
|
||||
}
|
||||
],
|
||||
"previewTargets": [
|
||||
{
|
||||
"key": "acheng-campus-food.offerings.menu",
|
||||
"label": "菜单页说明"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -299,28 +339,38 @@
|
||||
"key": "title",
|
||||
"binding": "brand.config.visualPresentation.inquiry.title",
|
||||
"label": "预订页面标题",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.inquiry.booking"
|
||||
},
|
||||
{
|
||||
"key": "subtitle",
|
||||
"binding": "brand.config.visualPresentation.inquiry.subtitle",
|
||||
"label": "预订说明",
|
||||
"input": "textarea",
|
||||
"maxLength": 120
|
||||
"maxLength": 120,
|
||||
"previewTarget": "acheng-campus-food.inquiry.booking"
|
||||
},
|
||||
{
|
||||
"key": "submitLabel",
|
||||
"binding": "brand.config.visualPresentation.inquiry.submitLabel",
|
||||
"label": "提交按钮文字",
|
||||
"input": "text",
|
||||
"placeholder": "例如:提交预订需求"
|
||||
"placeholder": "例如:提交预订需求",
|
||||
"previewTarget": "acheng-campus-food.inquiry.booking"
|
||||
},
|
||||
{
|
||||
"key": "promise",
|
||||
"binding": "brand.config.visualPresentation.inquiry.promise",
|
||||
"label": "真实服务承诺",
|
||||
"help": "仅填写能兑现的回复时间、订金和联系规则;留空则不显示。",
|
||||
"input": "textarea"
|
||||
"input": "textarea",
|
||||
"previewTarget": "acheng-campus-food.inquiry.booking"
|
||||
}
|
||||
],
|
||||
"previewTargets": [
|
||||
{
|
||||
"key": "acheng-campus-food.inquiry.booking",
|
||||
"label": "预订与定制"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -335,43 +385,50 @@
|
||||
"key": "categoryLabel",
|
||||
"binding": "offering.config.categoryLabel",
|
||||
"label": "餐品类别",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.detail.dishDetail"
|
||||
},
|
||||
{
|
||||
"key": "detailHero",
|
||||
"binding": "offering.config.detailHero",
|
||||
"label": "详情主图",
|
||||
"input": "image"
|
||||
"input": "image",
|
||||
"previewTarget": "acheng-campus-food.detail.dishDetail"
|
||||
},
|
||||
{
|
||||
"key": "area",
|
||||
"binding": "offering.config.area",
|
||||
"label": "供应地点",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.detail.dishDetail"
|
||||
},
|
||||
{
|
||||
"key": "series",
|
||||
"binding": "offering.config.series",
|
||||
"label": "套餐或系列说明",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.detail.dishDetail"
|
||||
},
|
||||
{
|
||||
"key": "spaceType",
|
||||
"binding": "offering.config.spaceType",
|
||||
"label": "适合场景",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.detail.dishDetail"
|
||||
},
|
||||
{
|
||||
"key": "background",
|
||||
"binding": "offering.config.details.background",
|
||||
"label": "餐品介绍",
|
||||
"input": "textarea"
|
||||
"input": "textarea",
|
||||
"previewTarget": "acheng-campus-food.detail.dishDetail"
|
||||
},
|
||||
{
|
||||
"key": "designConcept",
|
||||
"binding": "offering.config.details.designConcept",
|
||||
"label": "口味与分量",
|
||||
"input": "textarea"
|
||||
"input": "textarea",
|
||||
"previewTarget": "acheng-campus-food.detail.dishDetail"
|
||||
},
|
||||
{
|
||||
"key": "keywords",
|
||||
@@ -384,7 +441,8 @@
|
||||
"key": "value",
|
||||
"label": "特色"
|
||||
}
|
||||
]
|
||||
],
|
||||
"previewTarget": "acheng-campus-food.detail.dishDetail"
|
||||
},
|
||||
{
|
||||
"key": "crafts",
|
||||
@@ -397,7 +455,8 @@
|
||||
"key": "value",
|
||||
"label": "制作说明"
|
||||
}
|
||||
]
|
||||
],
|
||||
"previewTarget": "acheng-campus-food.detail.dishDetail"
|
||||
},
|
||||
{
|
||||
"key": "materialsList",
|
||||
@@ -413,7 +472,14 @@
|
||||
"key": "spec",
|
||||
"label": "说明"
|
||||
}
|
||||
]
|
||||
],
|
||||
"previewTarget": "acheng-campus-food.detail.dishDetail"
|
||||
}
|
||||
],
|
||||
"previewTargets": [
|
||||
{
|
||||
"key": "acheng-campus-food.detail.dishDetail",
|
||||
"label": "餐品与服务详情"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -428,50 +494,64 @@
|
||||
"key": "priceLabel",
|
||||
"binding": "brand.config.visualPresentation.detail.priceLabel",
|
||||
"label": "价格说明标题",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.detail.detailCopy"
|
||||
},
|
||||
{
|
||||
"key": "spaceLabel",
|
||||
"binding": "brand.config.visualPresentation.detail.spaceLabel",
|
||||
"label": "适合场景标题",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.detail.detailCopy"
|
||||
},
|
||||
{
|
||||
"key": "backgroundTitle",
|
||||
"binding": "brand.config.visualPresentation.detail.backgroundTitle",
|
||||
"label": "餐品介绍标题",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.detail.detailCopy"
|
||||
},
|
||||
{
|
||||
"key": "conceptTitle",
|
||||
"binding": "brand.config.visualPresentation.detail.conceptTitle",
|
||||
"label": "口味与分量标题",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.detail.detailCopy"
|
||||
},
|
||||
{
|
||||
"key": "craftsTitle",
|
||||
"binding": "brand.config.visualPresentation.detail.craftsTitle",
|
||||
"label": "制作方式标题",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.detail.detailCopy"
|
||||
},
|
||||
{
|
||||
"key": "materialsTitle",
|
||||
"binding": "brand.config.visualPresentation.detail.materialsTitle",
|
||||
"label": "食材与搭配标题",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.detail.detailCopy"
|
||||
},
|
||||
{
|
||||
"key": "inquiryAction",
|
||||
"binding": "brand.config.visualPresentation.detail.inquiryAction",
|
||||
"label": "咨询按钮文字",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.detail.detailCopy"
|
||||
},
|
||||
{
|
||||
"key": "inquiryHint",
|
||||
"binding": "brand.config.visualPresentation.detail.inquiryHint",
|
||||
"label": "咨询后的处理说明",
|
||||
"help": "只写能够兑现的联系和确认方式。",
|
||||
"input": "textarea"
|
||||
"input": "textarea",
|
||||
"previewTarget": "acheng-campus-food.detail.detailCopy"
|
||||
}
|
||||
],
|
||||
"previewTargets": [
|
||||
{
|
||||
"key": "acheng-campus-food.detail.detailCopy",
|
||||
"label": "详情页说明"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -486,32 +566,43 @@
|
||||
"key": "eyebrow",
|
||||
"binding": "brand.config.visualPresentation.success.eyebrow",
|
||||
"label": "页面小标题",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.success.successCopy"
|
||||
},
|
||||
{
|
||||
"key": "title",
|
||||
"binding": "brand.config.visualPresentation.success.title",
|
||||
"label": "确认标题",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.success.successCopy"
|
||||
},
|
||||
{
|
||||
"key": "intro",
|
||||
"binding": "brand.config.visualPresentation.success.intro",
|
||||
"label": "后续联系说明",
|
||||
"help": "若写回复时间,请确认日常能兑现。",
|
||||
"input": "textarea"
|
||||
"input": "textarea",
|
||||
"previewTarget": "acheng-campus-food.success.successCopy"
|
||||
},
|
||||
{
|
||||
"key": "recordsAction",
|
||||
"binding": "brand.config.visualPresentation.success.recordsAction",
|
||||
"label": "查看记录按钮",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.success.successCopy"
|
||||
},
|
||||
{
|
||||
"key": "homeAction",
|
||||
"binding": "brand.config.visualPresentation.success.homeAction",
|
||||
"label": "返回首页按钮",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.success.successCopy"
|
||||
}
|
||||
],
|
||||
"previewTargets": [
|
||||
{
|
||||
"key": "acheng-campus-food.success.successCopy",
|
||||
"label": "提交成功页"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -526,31 +617,42 @@
|
||||
"key": "title",
|
||||
"binding": "brand.config.visualPresentation.records.title",
|
||||
"label": "记录页标题",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.records.recordsCopy"
|
||||
},
|
||||
{
|
||||
"key": "createAction",
|
||||
"binding": "brand.config.visualPresentation.records.createAction",
|
||||
"label": "新增咨询按钮",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.records.recordsCopy"
|
||||
},
|
||||
{
|
||||
"key": "emptyTitle",
|
||||
"binding": "brand.config.visualPresentation.records.emptyTitle",
|
||||
"label": "暂无记录标题",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.records.recordsCopy"
|
||||
},
|
||||
{
|
||||
"key": "emptyDescription",
|
||||
"binding": "brand.config.visualPresentation.records.emptyDescription",
|
||||
"label": "暂无记录说明",
|
||||
"input": "textarea"
|
||||
"input": "textarea",
|
||||
"previewTarget": "acheng-campus-food.records.recordsCopy"
|
||||
},
|
||||
{
|
||||
"key": "emptyAction",
|
||||
"binding": "brand.config.visualPresentation.records.emptyAction",
|
||||
"label": "空状态按钮",
|
||||
"input": "text"
|
||||
"input": "text",
|
||||
"previewTarget": "acheng-campus-food.records.recordsCopy"
|
||||
}
|
||||
],
|
||||
"previewTargets": [
|
||||
{
|
||||
"key": "acheng-campus-food.records.recordsCopy",
|
||||
"label": "咨询记录页"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user