Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61f216ae0e | ||
|
|
96c3d3292d | ||
|
|
cbbf122280 |
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"scope": "模板完成证据登记,保留命令、日志与产物哈希",
|
"scope": "模板完成证据登记,保留命令、日志与产物哈希",
|
||||||
"generatedAt": "2026-10-24T02:02:12.474Z",
|
"generatedAt": "2026-10-24T02:35:52.145Z",
|
||||||
"templates": {
|
"templates": {
|
||||||
"acheng-campus-food": {
|
"acheng-campus-food": {
|
||||||
"real-manifest-interaction": {
|
"real-manifest-interaction": {
|
||||||
@@ -256,5 +256,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sourceTreeHash": "9d33ce8dbbddd34b91f045f49dc2316e36738ffec1429a93733d45d1b7b2a356"
|
"sourceTreeHash": "a5506179992f144e6b4afb0f0dfc295c5d722a5aadf7027fd785479a8276320f"
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,14 @@ import type { PreviewSelection, PreviewTarget } from "../brand/preview-selection
|
|||||||
import type { FormInstance } from "antd";
|
import type { FormInstance } from "antd";
|
||||||
import "./ServicesPage.css";
|
import "./ServicesPage.css";
|
||||||
|
|
||||||
|
const OFFERING_BASE_FIELD_BINDINGS: Record<string, string> = {
|
||||||
|
name: "offering.name",
|
||||||
|
summary: "offering.summary",
|
||||||
|
description: "offering.description",
|
||||||
|
priceText: "offering.priceText",
|
||||||
|
coverUrl: "offering.coverUrl",
|
||||||
|
};
|
||||||
|
|
||||||
type OfferingEditorModalProps = {
|
type OfferingEditorModalProps = {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
editingOffering: Offering | null;
|
editingOffering: Offering | null;
|
||||||
@@ -66,6 +74,23 @@ export function OfferingEditorModal({
|
|||||||
? { targetKey: previewSelectionTarget.key, recordId: editingOffering.id }
|
? { targetKey: previewSelectionTarget.key, recordId: editingOffering.id }
|
||||||
: { targetKey: previewSelectionTarget.key }
|
: { targetKey: previewSelectionTarget.key }
|
||||||
: undefined;
|
: undefined;
|
||||||
|
// 点选某个区块后,右侧只保留该区块真正会展示的字段;未点选时仍展示完整表单。
|
||||||
|
const visibleBaseFields = (() => {
|
||||||
|
if (!selectedTarget) return undefined;
|
||||||
|
if (selectedTarget.source !== "offering") return new Set<string>();
|
||||||
|
const bindings = new Set(activePreviewBindings);
|
||||||
|
return new Set(
|
||||||
|
Object.entries(OFFERING_BASE_FIELD_BINDINGS)
|
||||||
|
.filter(([, binding]) => bindings.has(binding))
|
||||||
|
.map(([name]) => name),
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
const isBaseFieldVisible = (name: string) => !visibleBaseFields || visibleBaseFields.has(name);
|
||||||
|
const showDescriptionField = !hasTemplateDetailCopy && isBaseFieldVisible("description");
|
||||||
|
const hasVisibleBaseFields =
|
||||||
|
["kind", "name", "summary", "priceText", "coverUrl", "sortOrder", "isEnabled"].some((name) =>
|
||||||
|
isBaseFieldVisible(name),
|
||||||
|
) || showDescriptionField;
|
||||||
|
|
||||||
// 点选区块后,在右侧滚动到并高亮对应的输入项;品牌通用区块没有对应输入项时只保留提示。
|
// 点选区块后,在右侧滚动到并高亮对应的输入项;品牌通用区块没有对应输入项时只保留提示。
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -106,9 +131,11 @@ export function OfferingEditorModal({
|
|||||||
showIcon
|
showIcon
|
||||||
title={previewPage === "offerings" ? "正在核对列表展示" : "正在核对详情展示"}
|
title={previewPage === "offerings" ? "正在核对列表展示" : "正在核对详情展示"}
|
||||||
description={
|
description={
|
||||||
previewPage === "offerings"
|
selectedTarget
|
||||||
? "右侧「列表展示」字段修改后,会实时反映在当前卡片。"
|
? `右侧只显示「${selectedTarget.label}」对应的字段,修改会实时反映在左侧预览;点击预览空白处或「查看全部字段」可恢复。`
|
||||||
: "右侧「详情展示」字段修改后,会实时反映在当前详情内容。"
|
: previewPage === "offerings"
|
||||||
|
? "点击左侧区块后,右侧只显示该区块对应的字段;未点选时显示全部列表展示字段。"
|
||||||
|
: "点击左侧区块后,右侧只显示该区块对应的字段;未点选时显示全部详情展示字段。"
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<ComponentTemplatePreview
|
<ComponentTemplatePreview
|
||||||
@@ -129,33 +156,56 @@ export function OfferingEditorModal({
|
|||||||
onFinish={onFinish}
|
onFinish={onFinish}
|
||||||
>
|
>
|
||||||
<div ref={formScroll} className="service-offering-editor__form-scroll">
|
<div ref={formScroll} className="service-offering-editor__form-scroll">
|
||||||
<h4 className="admin-subhead">基础信息</h4>
|
{selectedTarget ? (
|
||||||
<Form.Item name="kind" label="类型" rules={[{ required: true }]}>
|
<div className="service-offering-editor__selection">
|
||||||
<Select
|
<div>
|
||||||
options={[
|
<strong>正在编辑「{selectedTarget.label}」</strong>
|
||||||
{ value: "service", label: "服务" },
|
<p className="admin-section-description">
|
||||||
{ value: "product", label: "定制产品" },
|
只显示这个区块对应的字段,其他字段已临时隐藏。
|
||||||
{ value: "package", label: "套餐" },
|
</p>
|
||||||
{ value: "subscription", label: "订阅" },
|
</div>
|
||||||
]}
|
<Button
|
||||||
/>
|
size="small"
|
||||||
</Form.Item>
|
htmlType="button"
|
||||||
<Form.Item
|
onClick={() => onPreviewTargetSelected(undefined)}
|
||||||
name="name"
|
>
|
||||||
label="名称"
|
查看全部字段
|
||||||
data-presentation-binding="offering.name"
|
</Button>
|
||||||
rules={[{ required: true }]}
|
</div>
|
||||||
>
|
) : null}
|
||||||
<Input />
|
{hasVisibleBaseFields ? <h4 className="admin-subhead">基础信息</h4> : null}
|
||||||
</Form.Item>
|
{isBaseFieldVisible("kind") ? (
|
||||||
<Form.Item
|
<Form.Item name="kind" label="类型" rules={[{ required: true }]}>
|
||||||
name="summary"
|
<Select
|
||||||
label="一句话说明"
|
options={[
|
||||||
data-presentation-binding="offering.summary"
|
{ value: "service", label: "服务" },
|
||||||
>
|
{ value: "product", label: "定制产品" },
|
||||||
<Input />
|
{ value: "package", label: "套餐" },
|
||||||
</Form.Item>
|
{ value: "subscription", label: "订阅" },
|
||||||
{!hasTemplateDetailCopy ? (
|
]}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
) : null}
|
||||||
|
{isBaseFieldVisible("name") ? (
|
||||||
|
<Form.Item
|
||||||
|
name="name"
|
||||||
|
label="名称"
|
||||||
|
data-presentation-binding="offering.name"
|
||||||
|
rules={[{ required: true }]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
) : null}
|
||||||
|
{isBaseFieldVisible("summary") ? (
|
||||||
|
<Form.Item
|
||||||
|
name="summary"
|
||||||
|
label="一句话说明"
|
||||||
|
data-presentation-binding="offering.summary"
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
) : null}
|
||||||
|
{showDescriptionField ? (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="description"
|
name="description"
|
||||||
label="详细介绍"
|
label="详细介绍"
|
||||||
@@ -164,37 +214,45 @@ export function OfferingEditorModal({
|
|||||||
<Input.TextArea rows={5} />
|
<Input.TextArea rows={5} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
) : null}
|
) : null}
|
||||||
<Form.Item
|
{isBaseFieldVisible("priceText") ? (
|
||||||
name="priceText"
|
<Form.Item
|
||||||
label="价格展示"
|
name="priceText"
|
||||||
data-presentation-binding="offering.priceText"
|
label="价格展示"
|
||||||
>
|
data-presentation-binding="offering.priceText"
|
||||||
<Input placeholder="例如:按现场评估报价 / ¥ 2,800 起" />
|
>
|
||||||
</Form.Item>
|
<Input placeholder="例如:按现场评估报价 / ¥ 2,800 起" />
|
||||||
<Form.Item
|
</Form.Item>
|
||||||
name="coverUrl"
|
) : null}
|
||||||
label="封面图片地址"
|
{isBaseFieldVisible("coverUrl") ? (
|
||||||
help="点击上传,或粘贴服务/产品封面图片地址。"
|
<Form.Item
|
||||||
data-presentation-binding="offering.coverUrl"
|
name="coverUrl"
|
||||||
>
|
label="封面图片地址"
|
||||||
<ImageUrlField placeholder="粘贴服务或产品封面图片地址" scope="offering" />
|
help="点击上传,或粘贴服务/产品封面图片地址。"
|
||||||
</Form.Item>
|
data-presentation-binding="offering.coverUrl"
|
||||||
<Form.Item
|
>
|
||||||
name="sortOrder"
|
<ImageUrlField placeholder="粘贴服务或产品封面图片地址" scope="offering" />
|
||||||
label="展示顺序"
|
</Form.Item>
|
||||||
help="数字越小越靠前,不确定时填写 0。"
|
) : null}
|
||||||
rules={[{ type: "number", min: 0, max: 9999 }]}
|
{isBaseFieldVisible("sortOrder") ? (
|
||||||
>
|
<Form.Item
|
||||||
<Input type="number" min={0} max={9999} />
|
name="sortOrder"
|
||||||
</Form.Item>
|
label="展示顺序"
|
||||||
<Form.Item name="isEnabled" label="公开状态">
|
help="数字越小越靠前,不确定时填写 0。"
|
||||||
<Select
|
rules={[{ type: "number", min: 0, max: 9999 }]}
|
||||||
options={[
|
>
|
||||||
{ value: true, label: "已启用" },
|
<Input type="number" min={0} max={9999} />
|
||||||
{ value: false, label: "已停用" },
|
</Form.Item>
|
||||||
]}
|
) : null}
|
||||||
/>
|
{isBaseFieldVisible("isEnabled") ? (
|
||||||
</Form.Item>
|
<Form.Item name="isEnabled" label="公开状态">
|
||||||
|
<Select
|
||||||
|
options={[
|
||||||
|
{ value: true, label: "已启用" },
|
||||||
|
{ value: false, label: "已停用" },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
) : null}
|
||||||
{selectedTarget && selectedTarget.source !== "offering" ? (
|
{selectedTarget && selectedTarget.source !== "offering" ? (
|
||||||
<Alert
|
<Alert
|
||||||
type="warning"
|
type="warning"
|
||||||
|
|||||||
@@ -55,6 +55,22 @@
|
|||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.service-offering-editor__selection {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
padding: 12px 14px;
|
||||||
|
border: 1px solid rgba(22, 119, 255, 0.28);
|
||||||
|
border-radius: 10px;
|
||||||
|
background-color: rgba(22, 119, 255, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.service-offering-editor__selection p {
|
||||||
|
margin: 4px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
.service-offering-editor__form-scroll .ant-form-item {
|
.service-offering-editor__form-scroll .ant-form-item {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,6 +195,9 @@ test("业务编辑弹窗预览列表与详情详情同一份内容", async ({ pa
|
|||||||
"acheng-campus-food.detail.dishDetail",
|
"acheng-campus-food.detail.dishDetail",
|
||||||
);
|
);
|
||||||
await expect(page.getByText("餐品与服务详情对应字段", { exact: true })).toBeVisible();
|
await expect(page.getByText("餐品与服务详情对应字段", { exact: true })).toBeVisible();
|
||||||
|
await expect(page.getByText("正在编辑「餐品与服务详情」", { exact: true })).toBeVisible();
|
||||||
|
await expect(page.getByLabel("名称", { exact: true })).toHaveCount(0);
|
||||||
|
await expect(page.getByLabel("类型", { exact: true })).toHaveCount(0);
|
||||||
await expect(
|
await expect(
|
||||||
editor.locator('[data-presentation-binding="offering.config.details.background"]'),
|
editor.locator('[data-presentation-binding="offering.config.details.background"]'),
|
||||||
).toHaveClass(/is-preview-active/);
|
).toHaveClass(/is-preview-active/);
|
||||||
@@ -209,6 +212,9 @@ test("业务编辑弹窗预览列表与详情详情同一份内容", async ({ pa
|
|||||||
|
|
||||||
await preview.locator(".offering-card .dish-name").click();
|
await preview.locator(".offering-card .dish-name").click();
|
||||||
await expect(page.getByText("业务卡片对应字段", { exact: true })).toBeVisible();
|
await expect(page.getByText("业务卡片对应字段", { exact: true })).toBeVisible();
|
||||||
|
await expect(page.getByText("正在编辑「业务卡片」", { exact: true })).toBeVisible();
|
||||||
|
await expect(page.getByLabel("类型", { exact: true })).toHaveCount(0);
|
||||||
|
await expect(page.getByLabel("展示顺序", { exact: true })).toHaveCount(0);
|
||||||
await expect(editor.locator('[data-presentation-binding="offering.name"]')).toHaveClass(
|
await expect(editor.locator('[data-presentation-binding="offering.name"]')).toHaveClass(
|
||||||
/is-preview-active/,
|
/is-preview-active/,
|
||||||
);
|
);
|
||||||
@@ -219,10 +225,14 @@ test("业务编辑弹窗预览列表与详情详情同一份内容", async ({ pa
|
|||||||
await preview.locator(".menu-head").click();
|
await preview.locator(".menu-head").click();
|
||||||
await expect(preview).toHaveAttribute("data-active-target", "acheng-campus-food.offerings.menu");
|
await expect(preview).toHaveAttribute("data-active-target", "acheng-campus-food.offerings.menu");
|
||||||
await expect(page.getByText("「菜单页说明」属于页面通用内容", { exact: true })).toBeVisible();
|
await expect(page.getByText("「菜单页说明」属于页面通用内容", { exact: true })).toBeVisible();
|
||||||
await expect(editor.locator('[data-presentation-binding="offering.name"]')).not.toHaveClass(
|
await expect(editor.locator('[data-presentation-binding="offering.name"]')).toHaveCount(0);
|
||||||
/is-preview-active/,
|
|
||||||
);
|
|
||||||
await expect(editor.getByText("详情主图", { exact: true })).toHaveCount(0);
|
await expect(editor.getByText("详情主图", { exact: true })).toHaveCount(0);
|
||||||
|
await expect(page.getByLabel("名称", { exact: true })).toHaveCount(0);
|
||||||
|
await expect(page.getByLabel("类型", { exact: true })).toHaveCount(0);
|
||||||
|
|
||||||
|
await page.getByRole("button", { name: "查看全部字段" }).click();
|
||||||
|
await expect(page.getByLabel("名称", { exact: true })).toBeVisible();
|
||||||
|
await expect(page.getByLabel("类型", { exact: true })).toBeVisible();
|
||||||
|
|
||||||
await preview.locator(".offering-card .dish-name").click();
|
await preview.locator(".offering-card .dish-name").click();
|
||||||
await expect(page.getByText("业务卡片对应字段", { exact: true })).toBeVisible();
|
await expect(page.getByText("业务卡片对应字段", { exact: true })).toBeVisible();
|
||||||
|
|||||||
Reference in new issue
Block a user