Compare commits

...
Author SHA1 Message Date
que01 577c4d4d8e Merge pull request 'refactor: 抽取业务预览投影规则并补充单测' (#17) from refactor/offering-preview-projection into main
CI / Browser smoke (push) Has been skipped
CI / Static checks (push) Successful in 50s
CI / API integration (push) Successful in 1m9s
CI / Production build (push) Successful in 1m20s
Reviewed-on: #17
2026-10-29 07:18:44 +00:00
que01 45a5e4d666 refactor: 抽取业务预览投影规则并补充单测
CI / Browser smoke (pull_request) Successful in 47s
CI / Static checks (pull_request) Successful in 1m0s
CI / API integration (pull_request) Successful in 1m7s
CI / Production build (pull_request) Successful in 1m24s
2026-10-29 15:09:53 +08:00
que01 b0265f3be3 Merge pull request 'refactor: 抽取共享 getFullFormValues 表单读取工具' (#16) from refactor/form-values-helper into main
CI / Browser smoke (push) Has been skipped
CI / Static checks (push) Successful in 48s
CI / API integration (push) Successful in 1m9s
CI / Production build (push) Successful in 1m26s
Reviewed-on: #16
2026-10-29 06:32:31 +00:00
que01 aa2b6f35b0 refactor: 抽取共享 getFullFormValues 表单读取工具
CI / Browser smoke (pull_request) Successful in 47s
CI / Static checks (pull_request) Successful in 58s
CI / API integration (pull_request) Successful in 1m7s
CI / Production build (pull_request) Successful in 1m24s
2026-10-29 14:24:23 +08:00
que01 29116678aa Merge pull request 'test: 提取业务预览目标纯函数并补充单测' (#15) from test/offering-preview-unit into main
CI / Browser smoke (push) Has been skipped
CI / Static checks (push) Successful in 47s
CI / API integration (push) Successful in 1m7s
CI / Production build (push) Successful in 1m19s
Reviewed-on: #15
2026-10-29 06:08:37 +00:00
que01 b6fedd9f63 test: 提取业务预览目标纯函数并补充单测
CI / Browser smoke (pull_request) Successful in 46s
CI / Static checks (pull_request) Successful in 58s
CI / API integration (pull_request) Successful in 1m8s
CI / Production build (pull_request) Successful in 1m24s
2026-10-29 13:47:30 +08:00
que01 abf4e1b1c9 Merge pull request 'fix: 修复独立工坊业务详情区块字段过滤' (#14) from fix/atelier-detail-region-filter into main
CI / Browser smoke (push) Has been skipped
CI / Static checks (push) Successful in 49s
CI / API integration (push) Successful in 1m9s
CI / Production build (push) Successful in 1m25s
Reviewed-on: #14
2026-10-29 04:25:19 +00:00
que01 03460d5ab0 test: 更新品牌创建页面方案版本断言
CI / Browser smoke (pull_request) Successful in 47s
CI / Static checks (pull_request) Successful in 57s
CI / API integration (pull_request) Successful in 1m9s
CI / Production build (pull_request) Successful in 1m24s
2026-10-29 12:18:50 +08:00
que01 8f252d088a fix: 修复独立工坊业务详情区块字段过滤
CI / Static checks (pull_request) Successful in 1m10s
CI / Browser smoke (pull_request) Failing after 1m49s
CI / API integration (pull_request) Successful in 1m4s
CI / Production build (pull_request) Successful in 1m28s
2026-10-25 10:41:04 +08:00
que01 61f216ae0e Merge pull request 'fix: 业务提供项点选后仅显示当前区块字段' (#13) from fix/offering-editor-target-filter into main
CI / Browser smoke (push) Has been skipped
CI / Static checks (push) Successful in 1m0s
CI / API integration (push) Successful in 1m29s
CI / Production build (push) Failing after 14m10s
Merge pull request #13: fix: 业务提供项点选后仅显示当前区块字段
2026-10-24 02:45:42 +00:00
que01 96c3d3292d fix: 业务提供项点选后仅显示当前区块字段
CI / Browser smoke (pull_request) Successful in 51s
CI / Static checks (pull_request) Successful in 1m11s
CI / API integration (pull_request) Successful in 1m24s
CI / Production build (pull_request) Successful in 1m50s
2026-10-24 10:37:33 +08:00
que01 cbbf122280 Merge pull request #12: feat: 业务提供项编辑弹窗支持区块点选联动
CI / Browser smoke (push) Has been skipped
CI / Static checks (push) Successful in 55s
CI / API integration (push) Successful in 1m25s
CI / Production build (push) Successful in 1m55s
2026-10-24 02:07:28 +00:00
26 changed files with 1012 additions and 194 deletions

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-29T07:09:56.748Z",
"templates": { "templates": {
"acheng-campus-food": { "acheng-campus-food": {
"real-manifest-interaction": { "real-manifest-interaction": {
@@ -256,5 +256,5 @@
} }
} }
}, },
"sourceTreeHash": "9d33ce8dbbddd34b91f045f49dc2316e36738ffec1429a93733d45d1b7b2a356" "sourceTreeHash": "6c984c7a56aeef55ed6af2b9f95ec5a8fb2073405b14846fdc79e056c8fe2a65"
} }
@@ -1212,7 +1212,7 @@
"code": "CONDITIONAL_RENDER_REVIEW", "code": "CONDITIONAL_RENDER_REVIEW",
"severity": "review", "severity": "review",
"file": "packages/template-atelier-solopreneur/taro/index.tsx", "file": "packages/template-atelier-solopreneur/taro/index.tsx",
"target": "atelier-solopreneur.detail.projectDetail", "target": "atelier-solopreneur.detail.projectHero",
"line": 310, "line": 310,
"message": "条件显示需验证全部分支与空数据入口。", "message": "条件显示需验证全部分支与空数据入口。",
"reviewStatus": "source-reviewed", "reviewStatus": "source-reviewed",
@@ -1229,7 +1229,7 @@
"code": "UNRESOLVED_RENDER_VALUE", "code": "UNRESOLVED_RENDER_VALUE",
"severity": "review", "severity": "review",
"file": "packages/template-atelier-solopreneur/taro/index.tsx", "file": "packages/template-atelier-solopreneur/taro/index.tsx",
"target": "atelier-solopreneur.detail.projectDetail", "target": "atelier-solopreneur.detail.projectFacts",
"page": "detail", "page": "detail",
"expression": "[item.category, item.area, item.series].filter", "expression": "[item.category, item.area, item.series].filter",
"line": 340, "line": 340,
@@ -1248,7 +1248,7 @@
"code": "DYNAMIC_TARGET_REVIEW", "code": "DYNAMIC_TARGET_REVIEW",
"severity": "review", "severity": "review",
"file": "packages/template-atelier-solopreneur/taro/index.tsx", "file": "packages/template-atelier-solopreneur/taro/index.tsx",
"line": 433, "line": 453,
"message": "动态目标需用真实 manifest 和实际记录验证分支。", "message": "动态目标需用真实 manifest 和实际记录验证分支。",
"reviewStatus": "source-reviewed", "reviewStatus": "source-reviewed",
"decision": "formTargets 为固定映射,模板只对 inquiry 注入 chips 和隐私区,其余共享页面保持原 children;没有动态业务 binding。", "decision": "formTargets 为固定映射,模板只对 inquiry 注入 chips 和隐私区,其余共享页面保持原 children;没有动态业务 binding。",
@@ -1860,7 +1860,7 @@
"severity": "review", "severity": "review",
"file": "packages/template-atelier-solopreneur/taro/index.tsx", "file": "packages/template-atelier-solopreneur/taro/index.tsx",
"page": "detail", "page": "detail",
"target": "atelier-solopreneur.detail.projectDetail", "target": "atelier-solopreneur.detail.projectFacts",
"expression": "[item.category, item.area, item.series].filter(Boolean).map", "expression": "[item.category, item.area, item.series].filter(Boolean).map",
"line": 340, "line": 340,
"message": "需要核对循环项或间接映射,不能视为已覆盖。", "message": "需要核对循环项或间接映射,不能视为已覆盖。",
@@ -12,6 +12,7 @@ import {
type PresentationValues, type PresentationValues,
} from "../../lib/presentation/presentation-bindings.js"; } from "../../lib/presentation/presentation-bindings.js";
import type { RecordContentSource } from "./types.js"; import type { RecordContentSource } from "./types.js";
import { getFullFormValues } from "../../lib/form-values.js";
function createInitialValues( function createInitialValues(
record: Offering | TrustContent, record: Offering | TrustContent,
@@ -96,12 +97,12 @@ export function useRecordContentEditorState({
}); });
const submit = (values: PresentationValues) => { const submit = (values: PresentationValues) => {
const currentValues = form.getFieldsValue(true) as PresentationValues; const currentValues = getFullFormValues<PresentationValues>(form);
save.mutate({ ...draftValues, ...values, ...currentValues }); save.mutate({ ...draftValues, ...values, ...currentValues });
}; };
const handleValuesChange = (_values: PresentationValues) => { const handleValuesChange = (_values: PresentationValues) => {
const currentValues = form.getFieldsValue(true) as PresentationValues; const currentValues = getFullFormValues<PresentationValues>(form);
const next = { ...draftValues, ..._values, ...currentValues }; const next = { ...draftValues, ..._values, ...currentValues };
setDraftValues(next); setDraftValues(next);
onDraft?.(next); onDraft?.(next);
@@ -11,6 +11,7 @@ import {
} from "../../lib/presentation/presentation-bindings.js"; } from "../../lib/presentation/presentation-bindings.js";
import { fieldTargetTitle } from "./presentation-editor-helpers.js"; import { fieldTargetTitle } from "./presentation-editor-helpers.js";
import type { PreviewTarget } from "./preview-selection.js"; import type { PreviewTarget } from "./preview-selection.js";
import { getFullFormValues } from "../../lib/form-values.js";
interface PresentationFormPanelProps { interface PresentationFormPanelProps {
form: FormInstance<PresentationValues>; form: FormInstance<PresentationValues>;
@@ -44,7 +45,7 @@ export function PresentationFormPanel({
layout="vertical" layout="vertical"
initialValues={initialValues} initialValues={initialValues}
onValuesChange={onValuesChange} onValuesChange={onValuesChange}
onFinish={() => save.mutate(form.getFieldsValue(true) as PresentationValues)} onFinish={() => save.mutate(getFullFormValues<PresentationValues>(form))}
className="presentation-editor__form" className="presentation-editor__form"
> >
<div className="presentation-editor__form-body"> <div className="presentation-editor__form-body">
@@ -11,6 +11,7 @@ import type {
TrustContent, TrustContent,
} from "@personal-brand/api-client"; } from "@personal-brand/api-client";
import { createApiClient } from "../../lib/api.js"; import { createApiClient } from "../../lib/api.js";
import { getFullFormValues } from "../../lib/form-values.js";
import { import {
applyBrandPreviewValues, applyBrandPreviewValues,
applyPresentationValues, applyPresentationValues,
@@ -161,7 +162,7 @@ export function useBrandPreviewDraft({
const handleValuesChange = (changed: PresentationValues, allValues: PresentationValues) => { const handleValuesChange = (changed: PresentationValues, allValues: PresentationValues) => {
onDirty(); onDirty();
const synchronized: PresentationValues = { const synchronized: PresentationValues = {
...(form.getFieldsValue(true) as PresentationValues), ...getFullFormValues<PresentationValues>(form),
...allValues, ...allValues,
}; };
for (const section of sections) { for (const section of sections) {
@@ -12,6 +12,7 @@ import { ComponentTemplatePreview } from "../brand/ComponentTemplatePreview.js";
import type { PreviewSelection, PreviewTarget } from "../brand/preview-selection.js"; import type { PreviewSelection, PreviewTarget } from "../brand/preview-selection.js";
import type { FormInstance } from "antd"; import type { FormInstance } from "antd";
import "./ServicesPage.css"; import "./ServicesPage.css";
import { getFullFormValues } from "../../lib/form-values.js";
type OfferingEditorModalProps = { type OfferingEditorModalProps = {
open: boolean; open: boolean;
@@ -25,7 +26,7 @@ type OfferingEditorModalProps = {
selectedTarget: PreviewTarget | undefined; selectedTarget: PreviewTarget | undefined;
templateFieldSection: TemplateAdminSection; templateFieldSection: TemplateAdminSection;
hasTemplateDetailCopy: boolean; hasTemplateDetailCopy: boolean;
listTarget: PreviewTarget; listTarget: PreviewTarget | undefined;
detailTarget: PreviewTarget | undefined; detailTarget: PreviewTarget | undefined;
saving: boolean; saving: boolean;
onClose: () => void; onClose: () => void;
@@ -59,13 +60,26 @@ export function OfferingEditorModal({
onEditInBrand, onEditInBrand,
}: OfferingEditorModalProps) { }: OfferingEditorModalProps) {
const formScroll = useRef<HTMLDivElement>(null); const formScroll = useRef<HTMLDivElement>(null);
const defaultPreviewTarget = previewPage === "offerings" ? listTarget : detailTarget; const previewPageTarget = previewPage === "offerings" ? listTarget : detailTarget;
const previewSelectionTarget = selectedTarget ?? defaultPreviewTarget; const previewSelectionTarget = selectedTarget ?? previewPageTarget;
const viewOptions = [
...(listTarget ? [{ value: "offerings" as const, label: "列表卡片" }] : []),
...(detailTarget ? [{ value: "detail" as const, label: "详情内容" }] : []),
];
const previewSelection: PreviewSelection | undefined = previewSelectionTarget const previewSelection: PreviewSelection | undefined = previewSelectionTarget
? previewSelectionTarget.source === "offering" && editingOffering ? previewSelectionTarget.source === "offering" && editingOffering
? { targetKey: previewSelectionTarget.key, recordId: editingOffering.id } ? { targetKey: previewSelectionTarget.key, recordId: editingOffering.id }
: { targetKey: previewSelectionTarget.key } : { targetKey: previewSelectionTarget.key }
: undefined; : undefined;
// 标准字段与模板字段使用同一份 manifest binding;点选后只显示当前区域真正声明的字段。
const activeBindingSet = new Set(activePreviewBindings);
const isBaseFieldVisible = (name: string) =>
!selectedTarget || activeBindingSet.has(`offering.${name}`);
const showDescriptionField = !hasTemplateDetailCopy && isBaseFieldVisible("description");
const hasVisibleBaseFields =
["kind", "name", "summary", "priceText", "coverUrl", "sortOrder", "isEnabled"].some((name) =>
isBaseFieldVisible(name),
) || showDescriptionField;
// 点选区块后,在右侧滚动到并高亮对应的输入项;品牌通用区块没有对应输入项时只保留提示。 // 点选区块后,在右侧滚动到并高亮对应的输入项;品牌通用区块没有对应输入项时只保留提示。
useEffect(() => { useEffect(() => {
@@ -95,10 +109,7 @@ export function OfferingEditorModal({
<Segmented <Segmented
className="service-offering-editor__view" className="service-offering-editor__view"
value={previewPage} value={previewPage}
options={[ options={viewOptions}
{ value: "offerings", label: "列表卡片" },
{ value: "detail", label: "详情内容" },
]}
onChange={onPreviewPageChange} onChange={onPreviewPageChange}
/> />
<Alert <Alert
@@ -106,14 +117,16 @@ export function OfferingEditorModal({
showIcon showIcon
title={previewPage === "offerings" ? "正在核对列表展示" : "正在核对详情展示"} title={previewPage === "offerings" ? "正在核对列表展示" : "正在核对详情展示"}
description={ description={
previewPage === "offerings" selectedTarget
? "右侧「列表展示」字段修改后,会实时反映在当前卡片。" ? `右侧只显示「${selectedTarget.label}」对应的字段,修改会实时反映在左侧预览;点击预览空白处或「查看全部字段」可恢复。`
: "右侧「详情展示」字段修改后,会实时反映在当前详情内容。" : previewPage === "offerings"
? "点击左侧区块后,右侧只显示该区块对应的字段;未点选时显示全部列表展示字段。"
: "点击左侧区块后,右侧只显示该区块对应的字段;未点选时显示全部详情展示字段。"
} }
/> />
<ComponentTemplatePreview <ComponentTemplatePreview
workspace={previewWorkspace} workspace={previewWorkspace}
page={previewPage} page={previewPageTarget?.page ?? previewPage}
offeringId={editingOffering.id} offeringId={editingOffering.id}
targets={previewTargets[previewPage]} targets={previewTargets[previewPage]}
{...(previewSelection ? { selection: previewSelection } : {})} {...(previewSelection ? { selection: previewSelection } : {})}
@@ -126,10 +139,30 @@ export function OfferingEditorModal({
form={form} form={form}
layout="vertical" layout="vertical"
onValuesChange={(_, allValues) => onValuesChange(allValues)} onValuesChange={(_, allValues) => onValuesChange(allValues)}
onFinish={onFinish} // 动态隐藏的字段会被卸载,onFinish 默认只返回仍挂载的字段。
// 提交时读取完整表单存储,避免切换区块后隐藏字段的修改丢失。
onFinish={() => onFinish(getFullFormValues(form))}
> >
<div ref={formScroll} className="service-offering-editor__form-scroll"> <div ref={formScroll} className="service-offering-editor__form-scroll">
<h4 className="admin-subhead">基础信息</h4> {selectedTarget ? (
<div className="service-offering-editor__selection">
<div>
<strong>正在编辑「{selectedTarget.label}」</strong>
<p className="admin-section-description">
只显示这个区块对应的字段,其他字段已临时隐藏。
</p>
</div>
<Button
size="small"
htmlType="button"
onClick={() => onPreviewTargetSelected(undefined)}
>
查看全部字段
</Button>
</div>
) : null}
{hasVisibleBaseFields ? <h4 className="admin-subhead">基础信息</h4> : null}
{isBaseFieldVisible("kind") ? (
<Form.Item name="kind" label="类型" rules={[{ required: true }]}> <Form.Item name="kind" label="类型" rules={[{ required: true }]}>
<Select <Select
options={[ options={[
@@ -140,6 +173,8 @@ export function OfferingEditorModal({
]} ]}
/> />
</Form.Item> </Form.Item>
) : null}
{isBaseFieldVisible("name") ? (
<Form.Item <Form.Item
name="name" name="name"
label="名称" label="名称"
@@ -148,6 +183,8 @@ export function OfferingEditorModal({
> >
<Input /> <Input />
</Form.Item> </Form.Item>
) : null}
{isBaseFieldVisible("summary") ? (
<Form.Item <Form.Item
name="summary" name="summary"
label="一句话说明" label="一句话说明"
@@ -155,7 +192,8 @@ export function OfferingEditorModal({
> >
<Input /> <Input />
</Form.Item> </Form.Item>
{!hasTemplateDetailCopy ? ( ) : null}
{showDescriptionField ? (
<Form.Item <Form.Item
name="description" name="description"
label="详细介绍" label="详细介绍"
@@ -164,6 +202,7 @@ export function OfferingEditorModal({
<Input.TextArea rows={5} /> <Input.TextArea rows={5} />
</Form.Item> </Form.Item>
) : null} ) : null}
{isBaseFieldVisible("priceText") ? (
<Form.Item <Form.Item
name="priceText" name="priceText"
label="价格展示" label="价格展示"
@@ -171,6 +210,8 @@ export function OfferingEditorModal({
> >
<Input placeholder="例如:按现场评估报价 / ¥ 2,800 起" /> <Input placeholder="例如:按现场评估报价 / ¥ 2,800 起" />
</Form.Item> </Form.Item>
) : null}
{isBaseFieldVisible("coverUrl") ? (
<Form.Item <Form.Item
name="coverUrl" name="coverUrl"
label="封面图片地址" label="封面图片地址"
@@ -179,6 +220,8 @@ export function OfferingEditorModal({
> >
<ImageUrlField placeholder="粘贴服务或产品封面图片地址" scope="offering" /> <ImageUrlField placeholder="粘贴服务或产品封面图片地址" scope="offering" />
</Form.Item> </Form.Item>
) : null}
{isBaseFieldVisible("sortOrder") ? (
<Form.Item <Form.Item
name="sortOrder" name="sortOrder"
label="展示顺序" label="展示顺序"
@@ -187,6 +230,8 @@ export function OfferingEditorModal({
> >
<Input type="number" min={0} max={9999} /> <Input type="number" min={0} max={9999} />
</Form.Item> </Form.Item>
) : null}
{isBaseFieldVisible("isEnabled") ? (
<Form.Item name="isEnabled" label="公开状态"> <Form.Item name="isEnabled" label="公开状态">
<Select <Select
options={[ options={[
@@ -195,6 +240,7 @@ export function OfferingEditorModal({
]} ]}
/> />
</Form.Item> </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;
} }
@@ -9,6 +9,7 @@ import { OfferingsTable } from "./OfferingsTable.js";
import { detailPageLabel, hasTemplateDetailCopy, offeringPageLabel } from "./offering-model.js"; import { detailPageLabel, hasTemplateDetailCopy, offeringPageLabel } from "./offering-model.js";
import { import {
buildOfferingPreviewWorkspace, buildOfferingPreviewWorkspace,
pageTemplateFields as collectPageTemplateFields,
previewFieldsByTarget, previewFieldsByTarget,
previewTargetsByPage, previewTargetsByPage,
} from "./offering-preview.js"; } from "./offering-preview.js";
@@ -34,53 +35,34 @@ export function ServicesPage() {
const sections = workspace.data?.templateContent?.admin.sections ?? []; const sections = workspace.data?.templateContent?.admin.sections ?? [];
const previewTargets = useMemo(() => previewTargetsByPage(sections), [sections]); const previewTargets = useMemo(() => previewTargetsByPage(sections), [sections]);
const fieldsByTarget = useMemo(() => previewFieldsByTarget(sections), [sections]); const fieldsByTarget = useMemo(() => previewFieldsByTarget(sections), [sections]);
// 只使用 manifest 中真实存在的业务卡片区域;模板没有对应区域时不显示列表预览。
const listTarget = useMemo( const listTarget = useMemo(
() => () => previewTargets.offerings.find((target) => target.source === "offering"),
previewTargets.offerings.find((target) => [previewTargets],
templateFields.some((field) => field.previewTarget === target.key),
) ?? {
key: "offering.list.item",
label: "业务卡片",
page: "offerings",
source: "offering" as const,
},
[previewTargets, templateFields],
); );
const detailTarget = useMemo( const detailTarget = useMemo(
() => previewTargets.detail.find((target) => target.source === "offering"), () => previewTargets.detail.find((target) => target.source === "offering"),
[previewTargets], [previewTargets],
); );
const listFields = useMemo( // 页面级字段必须按该页所有真实预览区域收集,不能只取列表/详情首个区域,
() => templateFields.filter((field) => field.previewTarget === listTarget.key), // 否则模板把详情拆成多个区域后,未点选的“全部字段”会漏掉后续区域。
[templateFields, listTarget.key],
);
const detailFields = useMemo(
() => templateFields.filter((field) => field.previewTarget === detailTarget?.key),
[templateFields, detailTarget?.key],
);
const otherFields = useMemo(
() =>
templateFields.filter(
(field) => !listFields.includes(field) && !detailFields.includes(field),
),
[templateFields, listFields, detailFields],
);
const pageTemplateFields = useMemo<TemplateAdminField[]>( const pageTemplateFields = useMemo<TemplateAdminField[]>(
() => () =>
editor.previewPage === "offerings" collectPageTemplateFields({
? [...listFields, ...otherFields.filter((field) => field.page === "offerings")] previewPage: editor.previewPage,
: [...detailFields, ...otherFields.filter((field) => field.page === "detail")], previewTargets,
[editor.previewPage, listFields, detailFields, otherFields], templateFields,
listPage: listTarget?.page,
}),
[editor.previewPage, listTarget?.page, previewTargets, templateFields],
); );
// 点选预览区块后,右侧只保留该区块对应的字段,与小程序页面点选编辑保持一致。 // 点选预览区块后,右侧只保留该区块对应的字段,与小程序页面点选编辑保持一致。
const selectedTarget = useMemo(() => { const selectedTarget = useMemo(() => {
if (!editor.previewTargetKey) return undefined; if (!editor.previewTargetKey) return undefined;
return ( return previewTargets[editor.previewPage].find(
previewTargets[editor.previewPage].find((target) => target.key === editor.previewTargetKey) ?? (target) => target.key === editor.previewTargetKey,
(editor.previewTargetKey === listTarget.key ? listTarget : undefined) ??
(editor.previewTargetKey === detailTarget?.key ? detailTarget : undefined)
); );
}, [editor.previewPage, editor.previewTargetKey, previewTargets, listTarget, detailTarget]); }, [editor.previewPage, editor.previewTargetKey, previewTargets]);
const activeTemplateFields = useMemo<TemplateAdminField[]>( const activeTemplateFields = useMemo<TemplateAdminField[]>(
() => () =>
selectedTarget selectedTarget
@@ -114,13 +96,13 @@ export function ServicesPage() {
const navigateToBrand = () => { const navigateToBrand = () => {
if (!editor.editingOffering) return; if (!editor.editingOffering) return;
const target =
selectedTarget ?? (editor.previewPage === "offerings" ? listTarget : detailTarget);
if (!target) return;
void navigate("/admin/brand", { void navigate("/admin/brand", {
state: { state: {
targetKey: page: target.page,
editor.previewTargetKey ?? targetKey: target.key,
(editor.previewPage === "offerings"
? listTarget.key
: (detailTarget?.key ?? listTarget.key)),
recordId: editor.editingOffering.id, recordId: editor.editingOffering.id,
}, },
}); });
@@ -0,0 +1,63 @@
import type { RuntimeOffering } from "@personal-brand/api-client";
type RuntimePresentation = RuntimeOffering["presentation"];
function isFilledString(value: unknown): value is string {
return typeof value === "string" && value.trim() !== "";
}
/**
* 把表单草稿投影到单条 Runtime Offering 上。
* 该函数是 buildOfferingPreviewWorkspace 的核心合并规则:
* - name/coverUrl 等展示字段为空时保留原值,避免输入中间态清空预览;
* - summary/priceText 允许清空为空字符串;
* - presentation 由原值、模板 config、config.presentation 与事实字段逐层合并;
* - detailHero 优先于 coverUrl,两者都为空时保留原 heroImage。
*/
export function projectOfferingPreviewFields(options: {
item: Pick<RuntimeOffering, "name" | "summary" | "priceText" | "coverUrl" | "presentation">;
config: Record<string, unknown>;
formValues: Record<string, unknown>;
}): {
name: string;
summary: string;
priceText: string | null;
coverUrl: string | null;
presentation: RuntimePresentation;
} {
const { item, config, formValues } = options;
const nestedPresentation =
config.presentation && typeof config.presentation === "object"
? (config.presentation as Record<string, unknown>)
: {};
const configDetails =
config.details && typeof config.details === "object"
? (config.details as Record<string, unknown>)
: {};
const presentation: RuntimePresentation = {
...item.presentation,
...config,
...nestedPresentation,
...(typeof config.area === "string" ? { area: config.area } : {}),
...(typeof config.series === "string" ? { series: config.series } : {}),
...(typeof config.spaceType === "string" ? { spaceType: config.spaceType } : {}),
heroImage: isFilledString(config.detailHero)
? config.detailHero
: isFilledString(formValues.coverUrl)
? formValues.coverUrl
: (item.coverUrl ?? null),
details: {
...item.presentation.details,
...configDetails,
},
};
return {
name: isFilledString(formValues.name) ? formValues.name : item.name,
summary: typeof formValues.summary === "string" ? formValues.summary : item.summary,
priceText: typeof formValues.priceText === "string" ? formValues.priceText : item.priceText,
coverUrl: isFilledString(formValues.coverUrl) ? formValues.coverUrl : item.coverUrl,
presentation,
};
}
@@ -0,0 +1,47 @@
import type { AdminTemplateContent, TemplateAdminField } from "@personal-brand/api-client";
import type { PreviewTarget } from "../brand/preview-selection.js";
export function previewTargetsByPage(
sections: AdminTemplateContent["admin"]["sections"],
): Record<"offerings" | "detail", PreviewTarget[]> {
const targets = sections.flatMap((section) =>
(section.previewTargets ?? []).map((target) => ({
...target,
page: section.page,
source: section.fields.some(
(field) => field.binding.startsWith("offering.") && field.previewTarget === target.key,
)
? ("offering" as const)
: section.target,
})),
);
const pages = [...new Set(sections.map((section) => section.page))];
const offeringPages = pages.filter(
(page) =>
page !== "detail" &&
targets.some((target) => target.page === page && target.source === "offering"),
);
// 业务卡片不一定在“服务页”:独立工坊把案例卡片放在首页。优先使用专门的
// offerings 页,没有时退回第一个包含业务记录的页面。
const listPage = offeringPages.find((page) => page === "offerings") ?? offeringPages[0];
return {
offerings: listPage ? targets.filter((target) => target.page === listPage) : [],
detail: targets.filter((target) => target.page === "detail"),
};
}
export function pageTemplateFields(options: {
previewPage: "offerings" | "detail";
previewTargets: Record<"offerings" | "detail", PreviewTarget[]>;
templateFields: TemplateAdminField[];
listPage?: string | undefined;
}): TemplateAdminField[] {
const { previewPage, previewTargets, templateFields, listPage } = options;
const targets = previewPage === "offerings" ? previewTargets.offerings : previewTargets.detail;
const targetKeys = new Set(targets.map((target) => target.key));
return templateFields.filter(
(field) =>
(field.previewTarget && targetKeys.has(field.previewTarget)) ||
(!field.previewTarget && field.page === (previewPage === "offerings" ? listPage : "detail")),
);
}
@@ -1,36 +1,13 @@
export { pageTemplateFields, previewTargetsByPage } from "./offering-preview-targets.js";
import type { import type {
AdminTemplateContent, AdminTemplateContent,
Offering, Offering,
RuntimeWorkspace, RuntimeWorkspace,
TemplateAdminField, TemplateAdminField,
} from "@personal-brand/api-client"; } from "@personal-brand/api-client";
import type { PreviewTarget } from "../brand/preview-selection.js";
import { applyPresentationValues } from "../../lib/presentation/presentation-bindings.js"; import { applyPresentationValues } from "../../lib/presentation/presentation-bindings.js";
import { projectOfferingPreviewFields } from "./offering-preview-projection.js";
export function previewTargetsByPage(
sections: AdminTemplateContent["admin"]["sections"],
): Record<"offerings" | "detail", PreviewTarget[]> {
const result: Record<"offerings" | "detail", PreviewTarget[]> = {
offerings: [],
detail: [],
};
for (const page of ["offerings", "detail"] as const) {
result[page] = sections
.filter((section) => section.page === page)
.flatMap((section) =>
(section.previewTargets ?? []).map((target) => ({
...target,
page: section.page,
source: section.fields.some(
(field) => field.binding.startsWith("offering.") && field.previewTarget === target.key,
)
? "offering"
: section.target,
})),
);
}
return result;
}
export function previewFieldsByTarget( export function previewFieldsByTarget(
sections: AdminTemplateContent["admin"]["sections"], sections: AdminTemplateContent["admin"]["sections"],
@@ -57,60 +34,11 @@ export function buildOfferingPreviewWorkspace(options: {
[{ key: "offering", fields: templateFields }], [{ key: "offering", fields: templateFields }],
formValues, formValues,
); );
const offeringValues = {
name: formValues.name,
summary: formValues.summary,
description: formValues.description,
priceText: formValues.priceText,
coverUrl: formValues.coverUrl,
};
return { return {
...previewWorkspace, ...previewWorkspace,
offerings: previewWorkspace.offerings.map((item) => offerings: previewWorkspace.offerings.map((item) =>
item.id === editingOffering.id item.id === editingOffering.id
? { ? { ...item, ...projectOfferingPreviewFields({ item, config, formValues }) }
...item,
name:
typeof offeringValues.name === "string" && offeringValues.name.trim()
? offeringValues.name
: item.name,
summary:
typeof offeringValues.summary === "string" ? offeringValues.summary : item.summary,
priceText:
typeof offeringValues.priceText === "string"
? offeringValues.priceText
: item.priceText,
coverUrl:
typeof offeringValues.coverUrl === "string" && offeringValues.coverUrl.trim()
? offeringValues.coverUrl
: item.coverUrl,
config,
presentation: {
...item.presentation,
...config,
...(config.presentation && typeof config.presentation === "object"
? (config.presentation as Record<string, unknown>)
: {}),
...(typeof config.area === "string" ? { area: config.area } : {}),
...(typeof config.series === "string" ? { series: config.series } : {}),
...(typeof config.spaceType === "string" ? { spaceType: config.spaceType } : {}),
heroImage:
typeof config.detailHero === "string"
? config.detailHero
: typeof offeringValues.coverUrl === "string" && offeringValues.coverUrl.trim()
? offeringValues.coverUrl
: (item.coverUrl ?? null),
details: {
...item.presentation.details,
...(config.details && typeof config.details === "object"
? {
...item.presentation.details,
...(config.details as Record<string, unknown>),
}
: {}),
},
},
}
: item, : item,
), ),
}; };
@@ -6,6 +6,7 @@ import type {
TemplateAdminSection, TemplateAdminSection,
} from "@personal-brand/api-client"; } from "@personal-brand/api-client";
import { offeringDefaultFormValues, offeringEditFormValues } from "./offering-form.js"; import { offeringDefaultFormValues, offeringEditFormValues } from "./offering-form.js";
import { getFullFormValues } from "../../lib/form-values.js";
export type OfferingPreviewPage = "offerings" | "detail"; export type OfferingPreviewPage = "offerings" | "detail";
@@ -40,7 +41,7 @@ export function useOfferingEditor(templateFields: TemplateAdminField[]) {
? offeringEditFormValues(item, templateFields) ? offeringEditFormValues(item, templateFields)
: offeringDefaultFormValues(templateFields), : offeringDefaultFormValues(templateFields),
); );
setFormValues(offeringForm.getFieldsValue(true) as Record<string, unknown>); setFormValues(getFullFormValues(offeringForm));
}; };
const closeOffering = () => { const closeOffering = () => {
+7
View File
@@ -0,0 +1,7 @@
import type { FormInstance } from "antd";
// 动态隐藏的字段会被 Ant Design Form 卸载,onFinish 默认只返回仍挂载的字段。
// 提交时读取完整表单存储,避免切换区块后隐藏字段的修改丢失。
export function getFullFormValues<T = Record<string, unknown>>(form: FormInstance): T {
return form.getFieldsValue(true) as T;
}
@@ -0,0 +1,138 @@
import assert from "node:assert/strict";
import test from "node:test";
import { projectOfferingPreviewFields } from "../src/features/services/offering-preview-projection.ts";
const baseItem = {
name: "原名称",
summary: "原简介",
priceText: "原价格",
coverUrl: "/media/original-cover.jpg",
presentation: {
categoryKey: "portfolio",
categoryLabel: "品牌视觉",
heroImage: "/media/original-hero.jpg",
keywords: ["原始"],
media: [],
details: {
background: "原始背景",
designConcept: "",
crafts: [],
materialsList: [],
},
},
};
test("filled name and coverUrl override originals", () => {
const result = projectOfferingPreviewFields({
item: baseItem,
config: {},
formValues: {
name: "新名称",
coverUrl: "/media/new-cover.jpg",
summary: "",
priceText: "",
},
});
assert.equal(result.name, "新名称");
assert.equal(result.coverUrl, "/media/new-cover.jpg");
// summary/priceText 空字符串应覆盖原值(允许清空)。
assert.equal(result.summary, "");
assert.equal(result.priceText, "");
});
test("empty name and coverUrl preserve originals", () => {
const result = projectOfferingPreviewFields({
item: baseItem,
config: {},
formValues: {
name: " ",
coverUrl: "",
summary: "新简介",
},
});
assert.equal(result.name, "原名称");
assert.equal(result.coverUrl, "/media/original-cover.jpg");
assert.equal(result.summary, "新简介");
});
test("presentation merges base config and nested presentation", () => {
const result = projectOfferingPreviewFields({
item: baseItem,
config: {
area: "杭州",
series: "品牌焕新",
spaceType: "线上与线下",
presentation: { categoryLabel: "新分类" },
keywords: ["新关键词"],
},
formValues: {},
});
assert.equal(result.presentation.area, "杭州");
assert.equal(result.presentation.series, "品牌焕新");
assert.equal(result.presentation.spaceType, "线上与线下");
assert.equal(result.presentation.categoryLabel, "新分类");
assert.deepEqual(result.presentation.keywords, ["新关键词"]);
// categoryKey 不被覆盖时保留原值。
assert.equal(result.presentation.categoryKey, "portfolio");
});
test("heroImage follows detailHero, then coverUrl, then original", () => {
const hero = projectOfferingPreviewFields({
item: baseItem,
config: { detailHero: "/media/detail-hero.jpg" },
formValues: { coverUrl: "/media/new-cover.jpg" },
});
assert.equal(hero.presentation.heroImage, "/media/detail-hero.jpg");
const fallbackCover = projectOfferingPreviewFields({
item: baseItem,
config: { detailHero: "" },
formValues: { coverUrl: "/media/new-cover.jpg" },
});
assert.equal(fallbackCover.presentation.heroImage, "/media/new-cover.jpg");
const fallbackOriginal = projectOfferingPreviewFields({
item: baseItem,
config: { detailHero: "" },
formValues: { coverUrl: "" },
});
assert.equal(fallbackOriginal.presentation.heroImage, "/media/original-cover.jpg");
});
test("details merge preserves originals and applies updates", () => {
const result = projectOfferingPreviewFields({
item: baseItem,
config: {
details: {
background: "更新后的背景",
designConcept: "新的设计理念",
crafts: ["新交付"],
materialsList: [{ name: "策略", spec: "定位" }],
},
},
formValues: {},
});
assert.equal(result.presentation.details.background, "更新后的背景");
assert.equal(result.presentation.details.designConcept, "新的设计理念");
assert.deepEqual(result.presentation.details.crafts, ["新交付"]);
assert.deepEqual(result.presentation.details.materialsList, [{ name: "策略", spec: "定位" }]);
});
test("non-object config.presentation and details are ignored safely", () => {
const result = projectOfferingPreviewFields({
item: baseItem,
config: {
presentation: "invalid",
details: 42,
},
formValues: {},
});
assert.deepEqual(result.presentation.keywords, ["原始"]);
assert.equal(result.presentation.details.background, "原始背景");
assert.deepEqual(result.presentation.details.crafts, []);
});
+141
View File
@@ -0,0 +1,141 @@
import assert from "node:assert/strict";
import test from "node:test";
import {
pageTemplateFields,
previewTargetsByPage,
} from "../src/features/services/offering-preview-targets.ts";
function section(page, target, fields) {
return {
key: `${page}-${target}`,
title: target,
description: "",
page,
target,
fields,
previewTargets: [{ key: `${page}.${target}`, label: target }],
};
}
test("previewTargetsByPage prefers the offerings page for list targets", () => {
const sections = [
section("home", "homeCard", [{ binding: "offering.name", previewTarget: "home.homeCard" }]),
section("offerings", "offeringCard", [
{ binding: "offering.name", previewTarget: "offerings.offeringCard" },
]),
section("detail", "projectHero", [
{ binding: "offering.name", previewTarget: "detail.projectHero" },
]),
];
const result = previewTargetsByPage(sections);
assert.deepEqual(
result.offerings.map((target) => target.key),
["offerings.offeringCard"],
);
assert.deepEqual(
result.detail.map((target) => target.key),
["detail.projectHero"],
);
});
test("previewTargetsByPage falls back to the first non-detail page with offering records", () => {
const sections = [
section("home", "homeCard", [{ binding: "offering.name", previewTarget: "home.homeCard" }]),
section("detail", "projectHero", []),
];
const result = previewTargetsByPage(sections);
assert.equal(result.offerings.length, 1);
assert.equal(result.offerings[0].key, "home.homeCard");
assert.equal(result.offerings[0].source, "offering");
});
test("previewTargetsByPage returns no list targets without offering-backed pages", () => {
const sections = [
section("detail", "projectHero", [
{ binding: "brand.name", previewTarget: "detail.projectHero" },
]),
];
const result = previewTargetsByPage(sections);
assert.deepEqual(result.offerings, []);
assert.deepEqual(
result.detail.map((target) => target.key),
["detail.projectHero"],
);
assert.notEqual(result.detail[0].source, "offering");
});
test("pageTemplateFields collects every detail target field", () => {
const previewTargets = previewTargetsByPage([
section("detail", "projectHero", [
{ binding: "offering.name", previewTarget: "detail.projectHero" },
]),
section("detail", "projectFacts", [
{ binding: "offering.priceText", previewTarget: "detail.projectFacts" },
]),
section("home", "homeCard", [{ binding: "offering.summary", previewTarget: "home.homeCard" }]),
]);
const templateFields = [
{ key: "name", binding: "offering.name", previewTarget: "detail.projectHero" },
{ key: "priceText", binding: "offering.priceText", previewTarget: "detail.projectFacts" },
{ key: "summary", binding: "offering.summary", previewTarget: "home.homeCard" },
];
const result = pageTemplateFields({
previewPage: "detail",
previewTargets,
templateFields,
});
assert.deepEqual(
result.map((field) => field.key),
["name", "priceText"],
);
});
test("pageTemplateFields falls back to page fields without previewTarget", () => {
const previewTargets = previewTargetsByPage([
section("detail", "projectHero", [
{ binding: "offering.name", previewTarget: "detail.projectHero" },
]),
]);
const templateFields = [
{ key: "name", binding: "offering.name", previewTarget: "detail.projectHero" },
{ key: "legacy", binding: "offering.config.legacy", page: "detail" },
{ key: "other", binding: "offering.config.other", previewTarget: "unknown.target" },
];
const result = pageTemplateFields({
previewPage: "detail",
previewTargets,
templateFields,
});
assert.deepEqual(
result.map((field) => field.key),
["name", "legacy"],
);
});
test("pageTemplateFields uses the inferred list page for offerings", () => {
const previewTargets = previewTargetsByPage([
section("home", "homeCard", [{ binding: "offering.name", previewTarget: "home.homeCard" }]),
section("detail", "projectHero", []),
]);
const templateFields = [
{ key: "name", binding: "offering.name", previewTarget: "home.homeCard" },
{ key: "legacy", binding: "offering.config.legacy", page: "home" },
{ key: "detail", binding: "offering.config.detail", previewTarget: "detail.projectHero" },
];
const result = pageTemplateFields({
previewPage: "offerings",
previewTargets,
templateFields,
listPage: previewTargets.offerings[0]?.page,
});
assert.deepEqual(
result.map((field) => field.key),
["name", "legacy"],
);
});
+3 -3
View File
@@ -390,7 +390,7 @@ test("平台模板管理员可以按行业预览版本,且预览不写入品
// 预览只允许使用平台当前已部署的精确 renderer 版本;复用 prepare 阶段导入的基线版本, // 预览只允许使用平台当前已部署的精确 renderer 版本;复用 prepare 阶段导入的基线版本,
// 避免测试自造一个 renderer 尚未部署的新版本。 // 避免测试自造一个 renderer 尚未部署的新版本。
const baselineVersion = await prisma.templatePackageVersion.findFirstOrThrow({ const baselineVersion = await prisma.templatePackageVersion.findFirstOrThrow({
where: { packageKey: "atelier-solopreneur", version: "1.3.2", status: "published" }, where: { packageKey: "atelier-solopreneur", version: "1.3.3", status: "published" },
}); });
const versionId = baselineVersion.id; const versionId = baselineVersion.id;
@@ -2338,7 +2338,7 @@ test("brand creation options are owner-scoped", async () => {
assert.equal(linjingScheme.isLatestForPackage, true); assert.equal(linjingScheme.isLatestForPackage, true);
const atelierScheme = options.pageSchemes.find((scheme) => scheme.name.includes("工坊")); const atelierScheme = options.pageSchemes.find((scheme) => scheme.name.includes("工坊"));
assert.ok(atelierScheme); assert.ok(atelierScheme);
assert.equal(atelierScheme.version, "1.3.2"); assert.equal(atelierScheme.version, "1.3.3");
assert.deepEqual(atelierScheme.supportedBusinessTypes, ["personal"]); assert.deepEqual(atelierScheme.supportedBusinessTypes, ["personal"]);
assert.equal( assert.equal(
options.pageSchemes.some( options.pageSchemes.some(
@@ -2366,7 +2366,7 @@ test("owner can create an isolated brand", async () => {
const atelier = await prisma.templatePackageVersion.findFirstOrThrow({ const atelier = await prisma.templatePackageVersion.findFirstOrThrow({
where: { where: {
packageKey: "atelier-solopreneur", packageKey: "atelier-solopreneur",
version: "1.3.2", version: "1.3.3",
status: "published", status: "published",
}, },
}); });
@@ -0,0 +1,370 @@
import fs from "node:fs";
import { test, expect, type Page } from "@playwright/test";
const adminOrigin = process.env.ADMIN_URL || "http://localhost:3005";
const consoleWarnings = new WeakMap<Page, string[]>();
test.beforeEach(({ page }) => {
const warnings: string[] = [];
consoleWarnings.set(page, warnings);
page.on("console", (message) => {
const text = message.text();
const isWarning =
message.type() === "warning" ||
(message.type() === "error" &&
(text.startsWith("Warning:") ||
text.includes("non-boolean attribute") ||
text.includes("empty string")));
if (isWarning) warnings.push(text);
});
});
test.afterEach(({ page }) => {
expect(consoleWarnings.get(page) ?? []).toEqual([]);
});
const templateContent = JSON.parse(
fs.readFileSync("../../packages/template-atelier-solopreneur/template.json", "utf8"),
);
const brand = {
id: "atelier-brand-fixture",
slug: "atelier-preview-fixture",
name: "独立工坊",
templateKey: "personal",
tagline: "为独立创作者建立可信的个人品牌",
description: "品牌策略、视觉叙事与长期陪伴。",
avatarUrl: "",
coverUrl: "",
hours: "工作日 10:00-18:00",
address: "杭州",
deliveryNote: "",
contactPhone: "13800138000",
contactWechat: "atelier-example",
config: {
founder: "林予",
title: "品牌顾问",
atelier: {
identity: { status: "可预约", experience: "8 年经验", tags: [] },
badges: [{ title: "真实案例" }],
features: [],
audiences: [],
deliverables: [],
process: [],
proofs: [],
faqs: [],
},
visualPresentation: {
home: {
eyebrow: "PERSONAL BRAND",
title: "让专业被看见",
subtitle: "从定位到表达",
primaryAction: "预约沟通",
secondaryAction: "查看案例",
casesTitle: "试点案例",
casesSubtitle: "真实项目",
caseAction: "全部案例",
featuresTitle: "合作方式",
featuresEnglish: "METHOD",
audienceTitle: "适合谁",
audienceEnglish: "AUDIENCE",
ctaTitle: "一起梳理品牌",
ctaSubtitle: "先聊清楚目标",
ctaAction: "发起咨询",
},
detail: {
priceLabel: "合作方式",
spaceLabel: "适用场景",
backgroundTitle: "项目背景",
conceptTitle: "设计理念",
craftsTitle: "交付要点",
materialsTitle: "能力构成",
inquiryAction: "咨询这个案例",
inquiryHint: "提交后会在工作台跟进",
},
},
},
};
const adminOffering = {
id: "atelier-project-fixture",
kind: "service",
name: "山野茶品牌焕新",
summary: "为在地茶品牌建立清晰、可信的视觉与叙事体系。",
description: "案例详情说明",
priceText: "¥ 30,000 起",
coverUrl: "",
isEnabled: true,
sortOrder: 0,
config: {
categoryKey: "portfolio",
categoryLabel: "品牌视觉",
area: "杭州",
series: "品牌焕新",
spaceType: "线上与线下",
keywords: ["个人品牌", "视觉叙事"],
details: {
background: "品牌已有稳定客群,但表达缺少统一线索。",
designConcept: "以山野节气为线索,建立克制的视觉秩序。",
crafts: ["品牌定位梳理", "视觉系统交付", "落地陪跑"],
materialsList: [
{ name: "品牌策略", spec: "定位、叙事与内容框架" },
{ name: "视觉系统", spec: "标志、字体、色彩与版式" },
],
},
detailHero: "",
},
};
const runtimeWorkspace = {
schemaVersion: "1.0.0",
publication: { status: "published", version: 1 },
brand: {
...brand,
...brand.config,
visualPresentation: brand.config.visualPresentation,
atelier: brand.config.atelier,
},
visualTemplate: {
key: "atelier-solopreneur",
version: templateContent.version,
name: templateContent.displayName,
},
templateData: {},
navigation: { tabs: [] },
offerings: [
{
id: adminOffering.id,
name: adminOffering.name,
summary: adminOffering.summary,
priceText: adminOffering.priceText,
coverUrl: adminOffering.coverUrl,
enabled: true,
kind: adminOffering.kind,
priceAmount: null,
schemaKey: "personal-offering",
schemaVersion: "1.0.0",
presentation: {
categoryKey: adminOffering.config.categoryKey,
categoryLabel: adminOffering.config.categoryLabel,
heroImage: adminOffering.config.detailHero,
keywords: adminOffering.config.keywords,
media: [],
details: structuredClone(adminOffering.config.details),
area: adminOffering.config.area,
series: adminOffering.config.series,
spaceType: adminOffering.config.spaceType,
},
sections: [],
},
],
inquiryForms: [],
trustItems: [],
trustPresentation: {},
capabilities: [],
theme: { colors: {} },
};
test("独立工坊业务编辑按真实 manifest 区块过滤字段", async ({ page }) => {
test.setTimeout(90000);
let savedBody: any;
await page.setViewportSize({ width: 1920, height: 1000 });
await page.route("**/api/**", async (route) => {
const url = new URL(route.request().url());
const path = url.pathname.replace(/^\/api/, "");
if (path === "/admin/session/current")
return route.fulfill({ status: 401, json: { error: { message: "未登录" } } });
if (path === "/admin/session/login")
return route.fulfill({
json: {
displayName: "测试管理员",
role: "owner",
mustChangePassword: false,
},
});
if (path === "/admin/brands")
return route.fulfill({ json: [{ id: brand.id, role: "owner", brand }] });
if (path === "/admin/workspace/offerings")
return route.fulfill({
json: [{ ...adminOffering, config: structuredClone(adminOffering.config) }],
});
if (path === "/admin/workspace/forms") return route.fulfill({ json: [] });
if (
path === `/admin/workspace/offerings/${adminOffering.id}` &&
route.request().method() === "PATCH"
) {
savedBody = route.request().postDataJSON();
Object.assign(adminOffering, structuredClone(savedBody));
runtimeWorkspace.offerings[0] = {
...runtimeWorkspace.offerings[0],
name: adminOffering.name,
summary: adminOffering.summary,
priceText: adminOffering.priceText,
coverUrl: adminOffering.coverUrl,
presentation: {
...runtimeWorkspace.offerings[0].presentation,
...structuredClone(adminOffering.config),
details: structuredClone(adminOffering.config.details),
heroImage: adminOffering.config.detailHero,
},
};
return route.fulfill({ json: structuredClone(adminOffering) });
}
if (path === "/admin/workspace")
return route.fulfill({
json: {
brand,
installations: [],
fields: [],
offerings: [{ ...adminOffering, config: structuredClone(adminOffering.config) }],
forms: [],
templateContent,
},
});
if (path === "/admin/config/brand") return route.fulfill({ json: brand });
if (path === "/admin/workspace/preview")
return route.fulfill({ json: structuredClone(runtimeWorkspace) });
if (path === "/public/workspace")
return route.fulfill({ json: structuredClone(runtimeWorkspace) });
return route.fulfill({ json: {} });
});
await page.goto(`${adminOrigin}/admin/services`);
await page.getByLabel("账号").fill("admin");
await page.getByLabel("密码").fill("fixture-password");
await page.locator('button[type="submit"]').click();
await page.getByRole("button", { name: "编辑详情" }).click();
const editor = page.locator(".service-offering-editor");
const preview = editor.locator(".component-template-preview");
await expect(preview.locator(".atelier-page")).toBeVisible();
await expect(preview).toHaveAttribute(
"data-active-target",
"atelier-solopreneur.detail.projectHero",
);
await expect(preview).toHaveAttribute("data-active-record-id", adminOffering.id);
// 头图与标题:只出现名称、简介、封面和详情主图,不出现案例信息或正文区块字段。
await preview.locator(".atelier-title").click();
await expect(preview).toHaveAttribute(
"data-active-target",
"atelier-solopreneur.detail.projectHero",
);
await expect(page.getByText("正在编辑「案例头图与标题」", { exact: true })).toBeVisible();
await expect(page.getByLabel("名称", { exact: true })).toBeVisible();
await expect(page.getByLabel("一句话说明", { exact: true })).toBeVisible();
await expect(editor.locator('[data-presentation-binding="offering.coverUrl"]')).toBeVisible();
await expect(
editor.locator('[data-presentation-binding="offering.config.detailHero"]'),
).toBeVisible();
await expect(page.getByLabel("价格展示", { exact: true })).toHaveCount(0);
await expect(page.getByLabel("项目背景", { exact: true })).toHaveCount(0);
await expect(page.getByLabel("交付要点", { exact: true })).toHaveCount(0);
// 案例信息:只出现报价与事实字段,标题、封面、详情主图消失。
await preview.locator(".atelier-detail-facts .atelier-detail-value").first().click();
await expect(preview).toHaveAttribute(
"data-active-target",
"atelier-solopreneur.detail.projectFacts",
);
await expect(page.getByText("正在编辑「案例信息」", { exact: true })).toBeVisible();
await expect(page.getByLabel("价格展示", { exact: true })).toBeVisible();
await expect(page.getByLabel("案例类别", { exact: true })).toBeVisible();
await expect(page.getByLabel("项目地点", { exact: true })).toBeVisible();
await expect(page.getByLabel("方案名称", { exact: true })).toBeVisible();
await expect(page.getByLabel("适用场景", { exact: true })).toBeVisible();
await expect(
editor.locator('[data-presentation-binding="offering.config.keywords"]'),
).toBeVisible();
await expect(page.getByLabel("名称", { exact: true })).toHaveCount(0);
await expect(page.getByLabel("一句话说明", { exact: true })).toHaveCount(0);
await expect(page.getByLabel("详情主图", { exact: true })).toHaveCount(0);
// 背景、理念、交付要点、能力构成分别只保留一个区块字段。
await preview.getByText("品牌已有稳定客群,但表达缺少统一线索。").click();
await expect(preview).toHaveAttribute(
"data-active-target",
"atelier-solopreneur.detail.projectBackground",
);
await expect(
editor.locator('[data-presentation-binding="offering.config.details.background"]'),
).toBeVisible();
await expect(
editor.locator('[data-presentation-binding="offering.config.details.designConcept"]'),
).toHaveCount(0);
await expect(page.getByLabel("价格展示", { exact: true })).toHaveCount(0);
await preview.getByText("以山野节气为线索,建立克制的视觉秩序。").click();
await expect(preview).toHaveAttribute(
"data-active-target",
"atelier-solopreneur.detail.projectConcept",
);
await expect(
editor.locator('[data-presentation-binding="offering.config.details.designConcept"]'),
).toBeVisible();
await expect(
editor.locator('[data-presentation-binding="offering.config.details.background"]'),
).toHaveCount(0);
await preview.getByText("品牌定位梳理").click();
await expect(preview).toHaveAttribute(
"data-active-target",
"atelier-solopreneur.detail.projectCrafts",
);
await expect(
editor.locator('[data-presentation-binding="offering.config.details.crafts"]'),
).toBeVisible();
await expect(
editor.locator('[data-presentation-binding="offering.config.details.materialsList"]'),
).toHaveCount(0);
await preview.getByText("品牌策略 定位、叙事与内容框架", { exact: true }).click();
await expect(preview).toHaveAttribute(
"data-active-target",
"atelier-solopreneur.detail.projectMaterials",
);
await expect(
editor.locator('[data-presentation-binding="offering.config.details.materialsList"]'),
).toBeVisible();
await expect(
editor.locator('[data-presentation-binding="offering.config.details.crafts"]'),
).toHaveCount(0);
await preview.getByText("品牌已有稳定客群,但表达缺少统一线索。").click();
await page.getByLabel("项目背景", { exact: true }).fill("弹窗里更新后的项目背景");
await expect(preview.getByText("弹窗里更新后的项目背景", { exact: true })).toBeVisible();
// “查看全部字段”恢复完整表单。
await page.getByRole("button", { name: "查看全部字段" }).click();
await expect(page.getByLabel("名称", { exact: true })).toBeVisible();
await expect(page.getByLabel("价格展示", { exact: true })).toBeVisible();
await expect(page.getByLabel("项目背景", { exact: true })).toBeVisible();
// 列表卡片来自真实首页案例区域;右侧只显示名称、简介和封面。
await page.getByText("列表卡片", { exact: true }).click();
await expect(preview).toHaveAttribute("data-active-target", "atelier.home.case");
await expect(preview).toHaveAttribute("data-active-record-id", adminOffering.id);
await expect(editor.locator(".service-offering-editor__view")).toContainText("列表卡片");
await expect(preview.locator(".atelier-case")).toContainText(adminOffering.name);
await preview.locator(".atelier-case .atelier-card-title").click();
await expect(page.getByText("正在编辑「试点案例卡片」", { exact: true })).toBeVisible();
await expect(page.getByLabel("名称", { exact: true })).toBeVisible();
await expect(page.getByLabel("一句话说明", { exact: true })).toBeVisible();
await expect(editor.locator('[data-presentation-binding="offering.coverUrl"]')).toBeVisible();
await expect(page.getByLabel("价格展示", { exact: true })).toHaveCount(0);
await expect(
editor.locator('[data-presentation-binding="offering.config.detailHero"]'),
).toHaveCount(0);
await expect(page.getByLabel("项目背景", { exact: true })).toHaveCount(0);
await page
.locator(".ant-modal-footer")
.getByRole("button", { name: "确 定", exact: true })
.click();
await expect(page.getByText("业务提供项已保存")).toBeVisible();
expect(savedBody.name).toBe(adminOffering.name);
expect(savedBody.config.details.background).toBe("弹窗里更新后的项目背景");
expect(savedBody.config.details.designConcept).toBe("以山野节气为线索,建立克制的视觉秩序。");
expect(savedBody.config.details.crafts).toEqual(["品牌定位梳理", "视觉系统交付", "落地陪跑"]);
expect(savedBody.config.details.materialsList).toEqual([
{ name: "品牌策略", spec: "定位、叙事与内容框架" },
{ name: "视觉系统", spec: "标志、字体、色彩与版式" },
]);
});
@@ -10,10 +10,10 @@ const businesses = [
const pageSchemes = [ const pageSchemes = [
{ {
templatePackageVersionId: "atelier-v132", templatePackageVersionId: "atelier-v133",
name: "独立创作者画册", name: "独立创作者画册",
description: "个人品牌页面方案", description: "个人品牌页面方案",
version: "1.3.2", version: "1.3.3",
supportedBusinessTypes: ["personal"], supportedBusinessTypes: ["personal"],
isLatestForPackage: true, isLatestForPackage: true,
}, },
@@ -217,7 +217,7 @@ test("创建品牌成功后进入新品牌工作区", async ({ page }) => {
await page.goto(`${adminOrigin}/admin/brands/new`); await page.goto(`${adminOrigin}/admin/brands/new`);
await page.getByText("个人品牌", { exact: true }).click(); await page.getByText("个人品牌", { exact: true }).click();
await page.getByText(/最新版 1\.3\.2/).click(); await page.getByText(/最新版 1\.3\.3/).click();
await page.getByLabel("品牌名称").fill("新的独立品牌"); await page.getByLabel("品牌名称").fill("新的独立品牌");
await page.getByLabel("小程序地址标识").fill("new-atelier"); await page.getByLabel("小程序地址标识").fill("new-atelier");
await page.getByRole("button", { name: "创建并进入品牌" }).click(); await page.getByRole("button", { name: "创建并进入品牌" }).click();
@@ -228,7 +228,7 @@ test("创建品牌成功后进入新品牌工作区", async ({ page }) => {
name: "新的独立品牌", name: "新的独立品牌",
slug: "new-atelier", slug: "new-atelier",
businessType: "personal", businessType: "personal",
templatePackageVersionId: "atelier-v132", templatePackageVersionId: "atelier-v133",
}); });
await page.waitForURL("**/admin/overview"); await page.waitForURL("**/admin/overview");
await expect(page.getByRole("heading", { name: "品牌概览" })).toBeVisible(); await expect(page.getByRole("heading", { name: "品牌概览" })).toBeVisible();
@@ -254,7 +254,7 @@ test("创建品牌按业务类型过滤页面方案,失败后保留输入", as
await page.getByText("个人品牌", { exact: true }).click(); await page.getByText("个人品牌", { exact: true }).click();
await expect(page.getByRole("button", { name: "创建并进入品牌" })).toBeDisabled(); await expect(page.getByRole("button", { name: "创建并进入品牌" })).toBeDisabled();
await page.getByText(/最新版 1\.3\.2/).click(); await page.getByText(/最新版 1\.3\.3/).click();
await page.getByLabel("品牌名称").fill("测试独立品牌"); await page.getByLabel("品牌名称").fill("测试独立品牌");
await page.getByLabel("小程序地址标识").fill("test-atelier"); await page.getByLabel("小程序地址标识").fill("test-atelier");
@@ -268,7 +268,7 @@ test("创建品牌按业务类型过滤页面方案,失败后保留输入", as
name: "测试独立品牌", name: "测试独立品牌",
slug: "test-atelier", slug: "test-atelier",
businessType: "personal", businessType: "personal",
templatePackageVersionId: "atelier-v132", templatePackageVersionId: "atelier-v133",
}); });
}); });
+20 -5
View File
@@ -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();
@@ -243,9 +253,14 @@ test("业务编辑弹窗预览列表与详情详情同一份内容", async ({ pa
await page.getByRole("button", { name: "编辑详情" }).first().click(); await page.getByRole("button", { name: "编辑详情" }).first().click();
await expect(page.locator(".component-template-preview")).toBeVisible(); await expect(page.locator(".component-template-preview")).toBeVisible();
// 弹窗默认定位在详情页;跨入口编辑列表卡片前先切到列表并点选卡片,
// 确保“在小程序页面编辑”携带的是首页列表区域而不是详情区域。
await page.getByText("列表卡片", { exact: true }).click();
await preview.locator(".offering-card .dish-name").click();
await expect(page.getByText("业务卡片对应字段", { exact: true })).toBeVisible();
await page.getByRole("button", { name: "在小程序页面编辑" }).click(); await page.getByRole("button", { name: "在小程序页面编辑" }).click();
await expect(page.getByText("页面预览", { exact: true })).toBeVisible({ timeout: 15000 }); await expect(page.getByText("页面预览", { exact: true })).toBeVisible({ timeout: 15000 });
await page.getByText("首页业务卡片", { exact: true }).click(); // 跳转时已按 targetKey 自动选中列表卡片区域,无需再手动点选页面区域。
await expect( await expect(
page.getByText("正在编辑业务提供项:列表实时预览餐品", { exact: true }), page.getByText("正在编辑业务提供项:列表实时预览餐品", { exact: true }),
).toBeVisible(); ).toBeVisible();
@@ -264,7 +279,7 @@ test("业务编辑弹窗预览列表与详情详情同一份内容", async ({ pa
.locator(".ant-modal-footer") .locator(".ant-modal-footer")
.getByRole("button", { name: "确 定", exact: true }) .getByRole("button", { name: "确 定", exact: true })
.click(); .click();
await expect(page.getByText("业务提供项已保存")).toBeVisible(); await expect(page.getByText("业务提供项已保存").last()).toBeVisible();
expect(savedBody.name).toBe("小程序页保存后的餐品"); expect(savedBody.name).toBe("小程序页保存后的餐品");
expect(savedBody.summary).toBe("跨入口保存后的业务简介"); expect(savedBody.summary).toBe("跨入口保存后的业务简介");
expect(savedBody.config.details.background).toBe("弹窗编辑后的餐品介绍"); expect(savedBody.config.details.background).toBe("弹窗编辑后的餐品介绍");
+1 -1
View File
@@ -14,7 +14,7 @@
{ {
"packageKey": "atelier-solopreneur", "packageKey": "atelier-solopreneur",
"packageName": "@personal-brand/template-atelier-solopreneur", "packageName": "@personal-brand/template-atelier-solopreneur",
"version": "1.3.2" "version": "1.3.3"
} }
] ]
} }
+1 -1
View File
@@ -16,7 +16,7 @@
- acheng-campus-food@1.0.3:餐饮场景,使用 food 行业能力。 - acheng-campus-food@1.0.3:餐饮场景,使用 food 行业能力。
- linjing-editorial@1.0.7:林境建筑画册,仅适配 doors 业务类型。 - linjing-editorial@1.0.7:林境建筑画册,仅适配 doors 业务类型。
- atelier-solopreneur@1.3.2:独立工坊方向,适配 personal 行业。 - atelier-solopreneur@1.3.3:独立工坊方向,适配 personal 行业。
以上是仓库盘点,不表示三个包都已经通过线上导入、预览、品牌安装和微信上传验收。生成目录当前位于 packages/config/src/generated-template-packages.ts,后续必须由导出和 conformance 流程生成并校验。 以上是仓库盘点,不表示三个包都已经通过线上导入、预览、品牌安装和微信上传验收。生成目录当前位于 packages/config/src/generated-template-packages.ts,后续必须由导出和 conformance 流程生成并校验。
+1
View File
@@ -68,6 +68,7 @@ export type { PublicOffering, BookingStatus, BrandTemplateKey } from "@personal-
export type { export type {
EditorPreviewFrameMessage, EditorPreviewFrameMessage,
EditorPreviewHostMessage, EditorPreviewHostMessage,
RuntimeOffering,
RuntimeWorkspace, RuntimeWorkspace,
} from "@personal-brand/types"; } from "@personal-brand/types";
export { isTrustContentComplete } from "@personal-brand/types"; export { isTrustContentComplete } from "@personal-brand/types";
@@ -2086,7 +2086,7 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
}, },
{ {
"packageKey": "atelier-solopreneur", "packageKey": "atelier-solopreneur",
"version": "1.3.2", "version": "1.3.3",
"displayName": "独立工坊 · 品牌小程序", "displayName": "独立工坊 · 品牌小程序",
"defaultBrandSlug": "atelier-studio", "defaultBrandSlug": "atelier-studio",
"runtimeContract": "1.0", "runtimeContract": "1.0",
@@ -2974,28 +2974,28 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
"binding": "offering.name", "binding": "offering.name",
"label": "案例名称", "label": "案例名称",
"input": "text", "input": "text",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectHero"
}, },
{ {
"key": "summary", "key": "summary",
"binding": "offering.summary", "binding": "offering.summary",
"label": "案例简介", "label": "案例简介",
"input": "textarea", "input": "textarea",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectHero"
}, },
{ {
"key": "priceText", "key": "priceText",
"binding": "offering.priceText", "binding": "offering.priceText",
"label": "合作方式 / 报价说明", "label": "合作方式 / 报价说明",
"input": "text", "input": "text",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectFacts"
}, },
{ {
"key": "coverUrl", "key": "coverUrl",
"binding": "offering.coverUrl", "binding": "offering.coverUrl",
"label": "案例封面", "label": "案例封面",
"input": "image", "input": "image",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectHero"
}, },
{ {
"key": "categoryLabel", "key": "categoryLabel",
@@ -3020,49 +3020,49 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
"label": "其他服务" "label": "其他服务"
} }
], ],
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectFacts"
}, },
{ {
"key": "detailHero", "key": "detailHero",
"binding": "offering.config.detailHero", "binding": "offering.config.detailHero",
"label": "详情主图", "label": "详情主图",
"input": "image", "input": "image",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectHero"
}, },
{ {
"key": "area", "key": "area",
"binding": "offering.config.area", "binding": "offering.config.area",
"label": "项目地点", "label": "项目地点",
"input": "text", "input": "text",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectFacts"
}, },
{ {
"key": "series", "key": "series",
"binding": "offering.config.series", "binding": "offering.config.series",
"label": "方案名称", "label": "方案名称",
"input": "text", "input": "text",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectFacts"
}, },
{ {
"key": "spaceType", "key": "spaceType",
"binding": "offering.config.spaceType", "binding": "offering.config.spaceType",
"label": "适用场景", "label": "适用场景",
"input": "text", "input": "text",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectFacts"
}, },
{ {
"key": "background", "key": "background",
"binding": "offering.config.details.background", "binding": "offering.config.details.background",
"label": "项目背景", "label": "项目背景",
"input": "textarea", "input": "textarea",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectBackground"
}, },
{ {
"key": "designConcept", "key": "designConcept",
"binding": "offering.config.details.designConcept", "binding": "offering.config.details.designConcept",
"label": "设计理念", "label": "设计理念",
"input": "textarea", "input": "textarea",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectConcept"
}, },
{ {
"key": "keywords", "key": "keywords",
@@ -3076,7 +3076,7 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
"label": "关键词" "label": "关键词"
} }
], ],
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectFacts"
}, },
{ {
"key": "crafts", "key": "crafts",
@@ -3090,7 +3090,7 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
"label": "交付内容" "label": "交付内容"
} }
], ],
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectCrafts"
}, },
{ {
"key": "materialsList", "key": "materialsList",
@@ -3107,13 +3107,33 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
"label": "能力说明" "label": "能力说明"
} }
], ],
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectMaterials"
} }
], ],
"previewTargets": [ "previewTargets": [
{ {
"key": "atelier-solopreneur.detail.projectDetail", "key": "atelier-solopreneur.detail.projectHero",
"label": "案例详情" "label": "案例头图与标题"
},
{
"key": "atelier-solopreneur.detail.projectFacts",
"label": "案例信息"
},
{
"key": "atelier-solopreneur.detail.projectBackground",
"label": "项目背景"
},
{
"key": "atelier-solopreneur.detail.projectConcept",
"label": "设计理念"
},
{
"key": "atelier-solopreneur.detail.projectCrafts",
"label": "交付要点"
},
{
"key": "atelier-solopreneur.detail.projectMaterials",
"label": "能力构成"
} }
] ]
}, },
@@ -6670,4 +6690,4 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
} }
]; ];
export const generatedTemplatePackageRegistryHash = export const generatedTemplatePackageRegistryHash =
"06182e0005339404614b39e2051180d15bc6aa83f572194a7f4b7403650d3e8d"; "866a8ce5f3d22f1712de73d8cae0480a38a71c1949f541ee8b9955695be38f11";
@@ -1,6 +1,6 @@
{ {
"name": "@personal-brand/template-atelier-solopreneur", "name": "@personal-brand/template-atelier-solopreneur",
"version": "1.3.2", "version": "1.3.3",
"private": true, "private": true,
"type": "module", "type": "module",
"files": [ "files": [
@@ -304,7 +304,7 @@ function Detail({ workspace, id }: Props & { id?: string }) {
return ( return (
<View className="atelier-page"> <View className="atelier-page">
<View <View
data-editor-target="atelier-solopreneur.detail.projectDetail" data-editor-target="atelier-solopreneur.detail.projectHero"
data-editor-record-id={item.id} data-editor-record-id={item.id}
> >
{item.image && ( {item.image && (
@@ -314,7 +314,7 @@ function Detail({ workspace, id }: Props & { id?: string }) {
<Text className="atelier-body">{item.desc}</Text> <Text className="atelier-body">{item.desc}</Text>
</View> </View>
<View <View
data-editor-target="atelier-solopreneur.detail.projectDetail" data-editor-target="atelier-solopreneur.detail.projectFacts"
data-editor-record-id={item.id} data-editor-record-id={item.id}
> >
<View className="atelier-card atelier-detail-facts"> <View className="atelier-card atelier-detail-facts">
@@ -347,16 +347,31 @@ function Detail({ workspace, id }: Props & { id?: string }) {
{item.keywords.join(" · ")} {item.keywords.join(" · ")}
</Text> </Text>
</View> </View>
</View>
<View
data-editor-target="atelier-solopreneur.detail.projectBackground"
data-editor-record-id={item.id}
>
<Text className="atelier-heading"> <Text className="atelier-heading">
<Text data-editor-target="atelier-solopreneur.detail.detailCopy"> <Text data-editor-target="atelier-solopreneur.detail.detailCopy">
{p.backgroundTitle} {p.backgroundTitle}
</Text> </Text>
</Text> </Text>
<Text className="atelier-body">{item.details.background}</Text> <Text className="atelier-body">{item.details.background}</Text>
</View>
<View
data-editor-target="atelier-solopreneur.detail.projectConcept"
data-editor-record-id={item.id}
>
<Text className="atelier-heading"> <Text className="atelier-heading">
<Text data-editor-target="atelier-solopreneur.detail.detailCopy">{p.conceptTitle}</Text> <Text data-editor-target="atelier-solopreneur.detail.detailCopy">{p.conceptTitle}</Text>
</Text> </Text>
<Text className="atelier-body">{item.details.designConcept}</Text> <Text className="atelier-body">{item.details.designConcept}</Text>
</View>
<View
data-editor-target="atelier-solopreneur.detail.projectCrafts"
data-editor-record-id={item.id}
>
<Text className="atelier-heading"> <Text className="atelier-heading">
<Text data-editor-target="atelier-solopreneur.detail.detailCopy">{p.craftsTitle}</Text> <Text data-editor-target="atelier-solopreneur.detail.detailCopy">{p.craftsTitle}</Text>
</Text> </Text>
@@ -365,6 +380,11 @@ function Detail({ workspace, id }: Props & { id?: string }) {
{line} {line}
</Text> </Text>
))} ))}
</View>
<View
data-editor-target="atelier-solopreneur.detail.projectMaterials"
data-editor-record-id={item.id}
>
<Text className="atelier-heading"> <Text className="atelier-heading">
<Text data-editor-target="atelier-solopreneur.detail.detailCopy">{p.materialsTitle}</Text> <Text data-editor-target="atelier-solopreneur.detail.detailCopy">{p.materialsTitle}</Text>
</Text> </Text>
@@ -1,6 +1,6 @@
{ {
"packageKey": "atelier-solopreneur", "packageKey": "atelier-solopreneur",
"version": "1.3.2", "version": "1.3.3",
"displayName": "独立工坊 · 品牌小程序", "displayName": "独立工坊 · 品牌小程序",
"defaultBrandSlug": "atelier-studio", "defaultBrandSlug": "atelier-studio",
"runtimeContract": "1.0", "runtimeContract": "1.0",
@@ -883,28 +883,28 @@
"binding": "offering.name", "binding": "offering.name",
"label": "案例名称", "label": "案例名称",
"input": "text", "input": "text",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectHero"
}, },
{ {
"key": "summary", "key": "summary",
"binding": "offering.summary", "binding": "offering.summary",
"label": "案例简介", "label": "案例简介",
"input": "textarea", "input": "textarea",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectHero"
}, },
{ {
"key": "priceText", "key": "priceText",
"binding": "offering.priceText", "binding": "offering.priceText",
"label": "合作方式 / 报价说明", "label": "合作方式 / 报价说明",
"input": "text", "input": "text",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectFacts"
}, },
{ {
"key": "coverUrl", "key": "coverUrl",
"binding": "offering.coverUrl", "binding": "offering.coverUrl",
"label": "案例封面", "label": "案例封面",
"input": "image", "input": "image",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectHero"
}, },
{ {
"key": "categoryLabel", "key": "categoryLabel",
@@ -929,49 +929,49 @@
"label": "其他服务" "label": "其他服务"
} }
], ],
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectFacts"
}, },
{ {
"key": "detailHero", "key": "detailHero",
"binding": "offering.config.detailHero", "binding": "offering.config.detailHero",
"label": "详情主图", "label": "详情主图",
"input": "image", "input": "image",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectHero"
}, },
{ {
"key": "area", "key": "area",
"binding": "offering.config.area", "binding": "offering.config.area",
"label": "项目地点", "label": "项目地点",
"input": "text", "input": "text",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectFacts"
}, },
{ {
"key": "series", "key": "series",
"binding": "offering.config.series", "binding": "offering.config.series",
"label": "方案名称", "label": "方案名称",
"input": "text", "input": "text",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectFacts"
}, },
{ {
"key": "spaceType", "key": "spaceType",
"binding": "offering.config.spaceType", "binding": "offering.config.spaceType",
"label": "适用场景", "label": "适用场景",
"input": "text", "input": "text",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectFacts"
}, },
{ {
"key": "background", "key": "background",
"binding": "offering.config.details.background", "binding": "offering.config.details.background",
"label": "项目背景", "label": "项目背景",
"input": "textarea", "input": "textarea",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectBackground"
}, },
{ {
"key": "designConcept", "key": "designConcept",
"binding": "offering.config.details.designConcept", "binding": "offering.config.details.designConcept",
"label": "设计理念", "label": "设计理念",
"input": "textarea", "input": "textarea",
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectConcept"
}, },
{ {
"key": "keywords", "key": "keywords",
@@ -985,7 +985,7 @@
"label": "关键词" "label": "关键词"
} }
], ],
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectFacts"
}, },
{ {
"key": "crafts", "key": "crafts",
@@ -999,7 +999,7 @@
"label": "交付内容" "label": "交付内容"
} }
], ],
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectCrafts"
}, },
{ {
"key": "materialsList", "key": "materialsList",
@@ -1016,13 +1016,33 @@
"label": "能力说明" "label": "能力说明"
} }
], ],
"previewTarget": "atelier-solopreneur.detail.projectDetail" "previewTarget": "atelier-solopreneur.detail.projectMaterials"
} }
], ],
"previewTargets": [ "previewTargets": [
{ {
"key": "atelier-solopreneur.detail.projectDetail", "key": "atelier-solopreneur.detail.projectHero",
"label": "案例详情" "label": "案例头图与标题"
},
{
"key": "atelier-solopreneur.detail.projectFacts",
"label": "案例信息"
},
{
"key": "atelier-solopreneur.detail.projectBackground",
"label": "项目背景"
},
{
"key": "atelier-solopreneur.detail.projectConcept",
"label": "设计理念"
},
{
"key": "atelier-solopreneur.detail.projectCrafts",
"label": "交付要点"
},
{
"key": "atelier-solopreneur.detail.projectMaterials",
"label": "能力构成"
} }
] ]
}, },