feat: 完善模板内容后台配置能力

This commit is contained in:
que01 committed 2026-09-28 17:30:34 +08:00
1 parent 2bc2193b44
commit 9266ec824a
37 files changed
+2273 -63

No files matched your search

@@ -0,0 +1,55 @@
# Progress Log
## Session Start
- **Date**: 2026-09-28
- **Task name**: `template-content-coverage`
- **Task dir**: `.codex-tasks/template-content-coverage/`
- **Spec**: `SPEC.md`
- **Plan**: `TODO.csv` (4 milestones)
- **Environment**: TypeScript / React / NestJS / Node test
## Context Recovery Block
- **Current milestone**: #4 — Run delivery gates and review
- **Current status**: DONE
- **Last completed**: #4 — Run delivery gates and review
- **Current artifact**: `TODO.csv`
- **Key context**: Previous task made many fields editable but omitted shared detail/success/records presentation fields and Acheng offering details. Existing changes are uncommitted and must be preserved.
- **Known issues**: Publication snapshot tests passed previously, but did not prove complete field coverage.
- **Next action**: User performs manual Admin edit, save, publish, and miniapp visual acceptance for both brands.
## Milestone 1: Inventory rendered brand and offering fields
- **Status**: DONE
- **What was done**: Mapped presentation and offering fields from both template WXML trees and shared detail, success, records, and inquiry pages.
- **Validation**: `rg -n 'presentation\.|item\.' packages/template-*/miniapp apps/miniapp/components/modules` → exit 0.
## Milestone 2: Complete template editing declarations
- **Status**: DONE
- **What was done**: Added missing brand presentation groups, per-offering food details, detail images, and nontechnical Admin labels; removed unsupported default contact and privacy claims.
- **Validation**: `pnpm validate:templates` → exit 0.
## Milestone 3: Add comprehensive coverage regression tests
- **Status**: DONE
- **What was done**: Added a package-discovered test that traverses page component references and verifies page presentation, hero, profile, trust, and shared offering detail bindings. Corrected one false positive from nested offering presentation access.
- **Validation**: `pnpm --filter @personal-brand/template-contract test` → 6 tests passed.
## Milestone 4: Run delivery gates and review
- **Status**: DONE
- **What was done**: Extended the isolated API publication test to cover success text, detail promise, and detail image; removed unsupported fallback promises; verified template compiler and fixture output; restarted the local API process so Admin sees the new manifest.
- **Validation**: API integration 38/38, `pnpm template:check`, `pnpm typecheck`, `pnpm lint`, Admin production build, `pnpm format:check`, and `git diff --check` → exit 0.
- **Known warning**: Admin's existing >500 kB vendor chunk warning remains. Owner: Admin frontend; follow-up: evaluate bundle splitting separately.
## Final Summary
- **Total milestones**: 4
- **Completed**: 4
- **Failed + recovered**: 1 test extraction false positive, corrected before delivery.
- **External unblock events**: 0
- **Total retries**: 1
- **Key learnings**: Renderer consumption, Admin edit declarations, and release snapshots must be verified as one contract.
- **Recommendations for future tasks**: Include the package-discovered editability test whenever a template adds a page or content field.
@@ -0,0 +1,48 @@
# Task Specification
## Task Shape
- **Shape**: `single-full`
## Goals
- Ensure the Acheng and Linjing miniapp templates expose their displayed brand and offering content through ordinary Admin controls.
- Prevent future partial coverage by testing template render bindings against manifest editing declarations.
## Non-Goals
- Make structural UI labels, backend status codes, or WeChat system controls brand-editable.
- Add industry fields to the shared brand database model.
## Constraints
- Preserve existing uncommitted work and template visual structure.
- Changes to published miniapps require an explicit release.
- Template declarations, not template-key branches in Admin, define editing controls.
## Environment
- **Project root**: `/home/que01/Project/persionalBrand`
- **Language/runtime**: TypeScript, React, NestJS, WeChat miniapp JavaScript
- **Package manager**: pnpm
- **Test framework**: Node test and API integration tests
- **Build command**: `pnpm build`
## Deliverables
- Complete editable declarations for both templates' displayed presentation and offering details.
- Coverage tests tying rendered content to Admin bindings.
- Verified template catalog, API publication tests, type checks and production Admin build.
## Done-When
- [ ] Each displayed template presentation field is declared in the corresponding Admin form.
- [ ] Each material offering detail shown by either template is editable.
- [ ] No factual service promise is left solely as a fixed template string.
- [ ] Relevant automated checks pass.
## Final Validation Command
```bash
pnpm format:check && pnpm lint && pnpm typecheck && pnpm template:check && pnpm --filter @personal-brand/admin build
```
@@ -0,0 +1,5 @@
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
1,Inventory rendered brand and offering fields,DONE,Two template field matrices complete,rg -n 'presentation\.|item\.' packages/template-*/miniapp apps/miniapp/components/modules,2026-09-28,0,Shared detail success records pages and both template components mapped
2,Complete template editing declarations,DONE,Admin exposes displayed brand and offering content,pnpm validate:templates,2026-09-28,0,Both manifests extended and catalog regenerated
3,Add comprehensive coverage regression tests,DONE,Rendered fields map to manifest bindings,pnpm --filter @personal-brand/template-contract test,2026-09-28,1,Test initially misclassified offering presentation then fixed; both templates pass
4,Run delivery gates and review,DONE,Relevant checks pass and diff is coherent,pnpm format:check,2026-09-28,0,API integration 38 tests template checks lint typecheck Admin build format and diff check passed; API restarted
1 id task status acceptance_criteria validation_command completed_at retry_count notes
2 1 Inventory rendered brand and offering fields DONE Two template field matrices complete rg -n 'presentation\.|item\.' packages/template-*/miniapp apps/miniapp/components/modules 2026-09-28 0 Shared detail success records pages and both template components mapped
3 2 Complete template editing declarations DONE Admin exposes displayed brand and offering content pnpm validate:templates 2026-09-28 0 Both manifests extended and catalog regenerated
4 3 Add comprehensive coverage regression tests DONE Rendered fields map to manifest bindings pnpm --filter @personal-brand/template-contract test 2026-09-28 1 Test initially misclassified offering presentation then fixed; both templates pass
5 4 Run delivery gates and review DONE Relevant checks pass and diff is coherent pnpm format:check 2026-09-28 0 API integration 38 tests template checks lint typecheck Admin build format and diff check passed; API restarted
@@ -0,0 +1,63 @@
# Progress Log
## Session Start
- **Date**: 2026-09-28
- **Task name**: `template-editability`
- **Task dir**: `.codex-tasks/template-editability/`
- **Spec**: `SPEC.md`
- **Plan**: `TODO.csv` (5 milestones)
- **Environment**: TypeScript / React / NestJS / Node test
## Context Recovery Block
- **Current milestone**: #5 — Run delivery checks and review diff
- **Current status**: DONE
- **Last completed**: #5 — Run delivery checks and review diff
- **Current artifact**: `TODO.csv`
- **Key context**: Acheng contains unsupported fixed food and response claims. Linjing consumes structured trust and profile configuration that normal administrators cannot edit; offering details also lack form controls.
- **Known issues**: Published workspace reads release snapshots, so save and publish must be tested separately.
- **Next action**: Ask the user to inspect editability and visual results in Admin and both compiled miniapp templates; this is acceptance, not an unimplemented code step.
## Milestone 2: Add manifest-driven structured editors
- **Status**: DONE
- **What was done**: Added list field declarations and plain-language list controls for brand, trust, and offering content.
- **Validation**: `pnpm --filter @personal-brand/admin typecheck` → exit 0.
## Milestone 3: Connect both template renderers and remove false claims
- **Status**: DONE
- **What was done**: Added Linjing editing declarations and replaced Acheng unsupported business claims with editable content or omission.
- **Validation**: `pnpm validate:templates` → exit 0.
## Milestone 4: Add regression coverage for edit and publish behavior
- **Status**: DONE
- **What was done**: Added binding and manifest tests plus an API integration test that edits brand, trust, and offering fields and verifies snapshot publication.
- **Validation**: `pnpm --filter @personal-brand/api test:integration` → 38 tests passed.
## Milestone 5: Run delivery checks and review diff
- **Status**: DONE
- **What was done**: Reviewed field-to-editor mappings, scoped brand form fields to brand bindings, documented the structured editing rule in ADR 0016, and confirmed the running Admin and API respond.
- **Validation**: `pnpm format:check`, `pnpm lint`, `pnpm typecheck`, `pnpm template:check`, `pnpm --filter @personal-brand/admin build`, `git diff --check` → exit 0.
- **Known warning**: The Admin production bundle still reports a pre-existing >500 kB chunk warning. Owner: Admin frontend; follow-up: evaluate route-level/vendor chunk splitting separately from template content editing.
## Final Summary
- **Total milestones**: 5
- **Completed**: 5
- **Failed + recovered**: 1 compiler assertion updated for the generic startup title; 1 lint and 2 formatting issues fixed.
- **External unblock events**: 0
- **Total retries**: 3
- **Key learnings**: A template-rendered field is not truly configurable until the ordinary Admin form can edit it and a release test proves the public snapshot changes only after publication.
- **Recommendations for future tasks**: Require every new template to document its rendered business facts and matching editor bindings during template validation.
## Milestone 1: Audit source-to-editor coverage
- **Status**: DONE
- **What was done**: Traced both template renderers to published workspace, admin forms, and template declarations.
- **Key decisions**: Preserve the existing snapshot contract; use template-declared plain-language editing fields instead of exposing JSON.
- **Validation**: `rg -n 'profilePresentation|trustPresentation|今日有售' packages apps` → exit 0.
- **Next step**: Milestone 2 — Add manifest-driven structured editors.
+47
View File
@@ -0,0 +1,47 @@
# Task Specification
## Task Shape
- **Shape**: `single-full`
## Goals
- Make material business facts shown by the Linjing and Acheng miniapp templates editable by a brand administrator, or remove unsupported claims.
- Preserve template-owned visual design while keeping content brand-scoped and release-snapshot based.
## Non-Goals
- Inventory, payment, or real-time opening-state management.
- New database tables or template-specific fields in the shared brand model.
## Constraints
- Template manifests declare template-specific editable content.
- Admin UI uses plain-language controls, never asks users to edit JSON.
- Published miniapp content changes only after a new release.
## Environment
- **Project root**: `/home/que01/Project/persionalBrand`
- **Language/runtime**: TypeScript, React, NestJS, WeChat miniapp JavaScript
- **Package manager**: pnpm
- **Test framework**: Node test, API integration tests
- **Build command**: `pnpm build`
## Deliverables
- Template declarations and admin editing controls for material content.
- Miniapp rendering without unsupported hard-coded factual claims.
- Contract, runtime, and integration regression tests.
## Done-When
- [ ] Both templates expose all material displayed facts through admin content controls or omit them.
- [ ] Published workspace consumes the edited snapshot and does not change before publication.
- [ ] Relevant tests, type checks, template validation, formatting, and build pass.
## Final Validation Command
```bash
pnpm format:check && pnpm lint && pnpm typecheck && pnpm template:check && pnpm --filter @personal-brand/admin build
```
@@ -0,0 +1,6 @@
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
1,Audit source-to-editor coverage,DONE,Map material displayed fields and unsupported claims,rg -n 'profilePresentation|trustPresentation|今日有售' packages apps,2026-09-28,0,Acheng claims and Linjing structured content identified
2,Add manifest-driven structured editors,DONE,Brand and trust lists editable without JSON,pnpm --filter @personal-brand/admin typecheck,2026-09-28,0,Typecheck passed after api-client build
3,Connect both template renderers and remove false claims,DONE,Displayed facts come from published data or are omitted,pnpm validate:templates,2026-09-28,0,Template validation passed after catalog generation
4,Add regression coverage for edit and publish behavior,DONE,Contract and integration tests pass,pnpm --filter @personal-brand/api test:integration,2026-09-28,0,38 API integration tests passed
5,Run delivery checks and review diff,DONE,Checks pass and no unmapped material claims remain,pnpm format:check,2026-09-28,0,Format lint typecheck template checks admin build and diff check passed; manual miniapp visual acceptance pending user
1 id task status acceptance_criteria validation_command completed_at retry_count notes
2 1 Audit source-to-editor coverage DONE Map material displayed fields and unsupported claims rg -n 'profilePresentation|trustPresentation|今日有售' packages apps 2026-09-28 0 Acheng claims and Linjing structured content identified
3 2 Add manifest-driven structured editors DONE Brand and trust lists editable without JSON pnpm --filter @personal-brand/admin typecheck 2026-09-28 0 Typecheck passed after api-client build
4 3 Connect both template renderers and remove false claims DONE Displayed facts come from published data or are omitted pnpm validate:templates 2026-09-28 0 Template validation passed after catalog generation
5 4 Add regression coverage for edit and publish behavior DONE Contract and integration tests pass pnpm --filter @personal-brand/api test:integration 2026-09-28 0 38 API integration tests passed
6 5 Run delivery checks and review diff DONE Checks pass and no unmapped material claims remain pnpm format:check 2026-09-28 0 Format lint typecheck template checks admin build and diff check passed; manual miniapp visual acceptance pending user
@@ -0,0 +1,41 @@
import { Button, Form, Input, Space } from "antd";
import type { TemplateAdminField } from "@personal-brand/api-client";
export function TemplateListField({
field,
name,
}: {
field: TemplateAdminField;
name: string | (string | number)[];
}) {
return (
<Form.Item label={field.label} help={field.help}>
<Form.List name={name}>
{(rows, { add, remove }) => (
<Space direction="vertical" style={{ width: "100%" }}>
{rows.map((row, index) => (
<Space key={row.key} align="start" wrap>
{field.itemFields?.map((itemField) => (
<Form.Item
key={itemField.key}
name={[row.name, itemField.key]}
label={`${index + 1}. ${itemField.label}`}
rules={
itemField.required === false
? []
: [{ required: true, message: `请填写${itemField.label}` }]
}
>
{itemField.input === "textarea" ? <Input.TextArea rows={2} /> : <Input />}
</Form.Item>
))}
<Button onClick={() => remove(row.name)}>删除</Button>
</Space>
))}
<Button onClick={() => add()}>新增{field.label}</Button>
</Space>
)}
</Form.List>
</Form.Item>
);
}
@@ -16,6 +16,7 @@ import { useEffect, useMemo } from "react";
import type { AdminTemplateContent, TemplateAdminField } from "@personal-brand/api-client";
import { createApiClient } from "../../lib/api.js";
import { ImageUrlField } from "../../components/ImageUrlField.js";
import { TemplateListField } from "../../components/TemplateListField.js";
import { MutationError } from "../../components/QueryState.js";
import {
applyPresentationValues,
@@ -62,7 +63,16 @@ export function PresentationEditor({
}: PresentationEditorProps) {
const [form] = Form.useForm<PresentationValues>();
const queryClient = useQueryClient();
const sections = templateContent?.admin.sections ?? [];
const sections = useMemo(
() =>
(templateContent?.admin.sections ?? [])
.map((section) => ({
...section,
fields: section.fields.filter((field) => field.binding.startsWith("brand.config.")),
}))
.filter((section) => section.fields.length > 0),
[templateContent],
);
const initialValues = useMemo(() => {
const values: PresentationValues = {};
for (const section of sections) {
@@ -70,6 +80,7 @@ export function PresentationEditor({
values[presentationFieldName(section.key, field.key)] = readPresentationValue(
config,
field.binding,
field,
);
}
}
@@ -82,7 +93,7 @@ export function PresentationEditor({
return createApiClient().updateAdminBrand({ config: nextConfig });
},
onSuccess: () => {
message.success("页面内容已保存,小程序将使用最新内容");
message.success("页面内容已保存为草稿,发布后小程序才会更新");
void queryClient.invalidateQueries({ queryKey: ["admin-brand"] });
void queryClient.invalidateQueries({ queryKey: ["admin-workspace"] });
void queryClient.invalidateQueries({ queryKey: ["public-runtime-workspace"] });
@@ -125,17 +136,28 @@ export function PresentationEditor({
<Typography.Paragraph type="secondary">{section.description}</Typography.Paragraph>
<Row gutter={16}>
{section.fields.map((field) => (
<Col key={field.key} xs={24} md={field.input === "textarea" ? 24 : 12}>
<Form.Item
name={presentationFieldName(section.key, field.key)}
label={field.label}
{...(field.help ? { help: field.help } : {})}
{...(field.required
? { rules: [{ required: true, message: `请填写${field.label}` }] }
: {})}
>
{renderField(field)}
</Form.Item>
<Col
key={field.key}
xs={24}
md={field.input === "textarea" || field.input === "list" ? 24 : 12}
>
{field.input === "list" ? (
<TemplateListField
field={field}
name={presentationFieldName(section.key, field.key)}
/>
) : (
<Form.Item
name={presentationFieldName(section.key, field.key)}
label={field.label}
{...(field.help ? { help: field.help } : {})}
{...(field.required
? { rules: [{ required: true, message: `请填写${field.label}` }] }
: {})}
>
{renderField(field)}
</Form.Item>
)}
</Col>
))}
</Row>
@@ -1,6 +1,8 @@
export type PresentationField = {
key: string;
binding: string;
input?: string;
itemValueKey?: string;
};
export type PresentationSection = {
@@ -8,7 +10,7 @@ export type PresentationSection = {
fields: PresentationField[];
};
export type PresentationValues = Record<string, string | number | null | undefined>;
export type PresentationValues = Record<string, unknown>;
function asObject(value: unknown): Record<string, unknown> {
return value && typeof value === "object" && !Array.isArray(value)
@@ -17,8 +19,11 @@ function asObject(value: unknown): Record<string, unknown> {
}
function safePath(binding: string): string[] | null {
if (!binding.startsWith("brand.config.")) return null;
const path = binding.slice("brand.config.".length).split(".");
const prefix = ["brand.config.", "offering.config.", "trust.config."].find((candidate) =>
binding.startsWith(candidate),
);
if (!prefix) return null;
const path = binding.slice(prefix.length).split(".");
if (path.some((part) => !part || ["__proto__", "prototype", "constructor"].includes(part)))
return null;
return path;
@@ -31,18 +36,25 @@ export function presentationFieldName(sectionKey: string, fieldKey: string): str
export function readPresentationValue(
config: Record<string, unknown> | null | undefined,
binding: string,
): string | number | undefined {
field?: PresentationField,
): unknown {
const path = safePath(binding);
if (!path) return undefined;
let value: unknown = asObject(config);
for (const part of path) value = asObject(value)[part];
if (field?.input === "list") {
if (!Array.isArray(value)) return [];
return field.itemValueKey
? (value as unknown[]).map((item) => ({ [field.itemValueKey as string]: item }))
: value;
}
return typeof value === "string" || typeof value === "number" ? value : undefined;
}
function writePath(
source: Record<string, unknown>,
path: string[],
value: string | number | null | undefined,
value: unknown,
): Record<string, unknown> {
const [head, ...tail] = path;
if (!head) return source;
@@ -63,11 +75,16 @@ export function applyPresentationValues(
for (const field of section.fields) {
const path = safePath(field.binding);
if (!path) continue;
nextConfig = writePath(
nextConfig,
path,
values[presentationFieldName(section.key, field.key)],
);
const raw = values[presentationFieldName(section.key, field.key)];
const value =
field.input === "list" && Array.isArray(raw)
? field.itemValueKey
? raw
.map((item) => asObject(item)[field.itemValueKey as string])
.filter((item) => typeof item === "string" && item.trim())
: raw
: raw;
nextConfig = writePath(nextConfig, path, value);
}
}
return nextConfig;
@@ -13,11 +13,17 @@ import {
message,
} from "antd";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import type { Offering } from "@personal-brand/api-client";
import type { Offering, TemplateAdminField } from "@personal-brand/api-client";
import { useState } from "react";
import { createApiClient } from "../../lib/api.js";
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
import { ImageUrlField } from "../../components/ImageUrlField.js";
import { TemplateListField } from "../../components/TemplateListField.js";
import {
applyPresentationValues,
presentationFieldName,
readPresentationValue,
} from "../brand/presentation-bindings.js";
import { MutationError, QueryState } from "../../components/QueryState.js";
export function ServicesPage() {
@@ -30,11 +36,32 @@ export function ServicesPage() {
queryKey: ["admin-offerings"],
queryFn: () => client.listAdminOfferings(),
});
const workspace = useQuery({
queryKey: ["admin-workspace-offering-fields"],
queryFn: () => client.getAdminWorkspace(),
});
const templateFields: TemplateAdminField[] = (
workspace.data?.templateContent?.admin.sections ?? []
)
.filter((section) => section.target === "offering")
.flatMap((section) =>
section.fields.filter((field) => field.binding.startsWith("offering.config.")),
);
const saveOffering = useMutation({
mutationFn: (values: Record<string, unknown>) =>
editingOffering
? client.updateAdminOffering(editingOffering.id, values)
: client.createAdminOffering(values as Omit<Offering, "id" | "brandId">),
mutationFn: (values: Record<string, unknown>) => {
const fields = Object.fromEntries(
Object.entries(values).filter(([key]) => key !== "config" && !key.startsWith("offering:")),
);
const config = applyPresentationValues(
editingOffering?.config,
[{ key: "offering", fields: templateFields }],
values,
);
const body = { ...fields, config };
return editingOffering
? client.updateAdminOffering(editingOffering.id, body)
: client.createAdminOffering(body as Omit<Offering, "id" | "brandId">);
},
onSuccess: () => {
message.success("业务提供项已保存");
setOfferingOpen(false);
@@ -72,16 +99,33 @@ export function ServicesPage() {
coverUrl: item.coverUrl ?? "",
sortOrder: item.sortOrder,
isEnabled: item.isEnabled,
...Object.fromEntries(
templateFields.map((field) => [
presentationFieldName("offering", field.key),
readPresentationValue(item.config, field.binding, field),
]),
),
}
: { kind: "service", isEnabled: true, sortOrder: 0 },
: {
kind: "service",
isEnabled: true,
sortOrder: 0,
...Object.fromEntries(
templateFields.map((field) => [
presentationFieldName("offering", field.key),
field.input === "list" ? [] : undefined,
]),
),
},
);
};
return (
<QueryState
loading={offerings.isLoading}
error={offerings.error}
loading={offerings.isLoading || workspace.isLoading}
error={offerings.error || workspace.error}
onRetry={() => {
void offerings.refetch();
void workspace.refetch();
}}
>
<AdminPageHeader
@@ -229,6 +273,30 @@ export function ServicesPage() {
]}
/>
</Form.Item>
{templateFields.map((field) =>
field.input === "list" ? (
<TemplateListField
key={field.key}
field={field}
name={presentationFieldName("offering", field.key)}
/>
) : (
<Form.Item
key={field.key}
name={presentationFieldName("offering", field.key)}
label={field.label}
help={field.help}
>
{field.input === "textarea" ? (
<Input.TextArea rows={3} />
) : field.input === "image" ? (
<ImageUrlField />
) : (
<Input />
)}
</Form.Item>
),
)}
</Form>
</Modal>
</QueryState>
@@ -14,11 +14,16 @@ import {
message,
} from "antd";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import type { TrustContent, TrustContentInput } from "@personal-brand/api-client";
import type {
TemplateAdminField,
TrustContent,
TrustContentInput,
} from "@personal-brand/api-client";
import { useState } from "react";
import { createApiClient } from "../../lib/api.js";
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
import { ImageUrlField } from "../../components/ImageUrlField.js";
import { TemplateListField } from "../../components/TemplateListField.js";
import { MutationError, QueryState } from "../../components/QueryState.js";
const types = [
@@ -59,6 +64,7 @@ type TrustTypeOption = {
help?: string;
placeholder?: string;
required?: boolean;
configFields?: TemplateAdminField[];
};
const fallbackTypes: TrustTypeOption[] = types.map(({ value, label, help }) => ({
type: value,
@@ -86,7 +92,19 @@ export function TrustContentPage() {
? workspace.data.templateContent.trustContentTypes
: fallbackTypes;
const selectedTypeMeta = availableTypes.find((item) => item.type === selectedType);
const contentByType = new Map((query.data ?? []).map((item) => [item.type, item]));
const contentByType = new Map<string, TrustContent>();
for (const item of query.data ?? []) {
const current = contentByType.get(item.type);
const hasConfig = Object.keys(item.config ?? {}).length > 0;
const currentHasConfig = Object.keys(current?.config ?? {}).length > 0;
if (
!current ||
(item.isPublished && !current.isPublished) ||
(item.isPublished === current.isPublished && hasConfig && !currentHasConfig)
) {
contentByType.set(item.type, item);
}
}
const firstMissingRequiredType =
availableTypes.find((item) => item.required && !contentByType.has(item.type))?.type ??
availableTypes[0]?.type ??
@@ -121,10 +139,11 @@ export function TrustContentPage() {
title: item.title,
...(item.summary ? { summary: item.summary } : {}),
content: item.content,
config: item.config ?? {},
...(item.coverUrl ? { coverUrl: item.coverUrl } : {}),
isPublished: item.isPublished,
}
: { type: type ?? firstMissingRequiredType, isPublished: false },
: { type: type ?? firstMissingRequiredType, isPublished: false, config: {} },
);
};
return (
@@ -266,6 +285,21 @@ export function TrustContentPage() {
placeholder={selectedTypeMeta?.placeholder ?? "例如:\n第一项内容\n第二项内容"}
/>
</Form.Item>
{(!editing || contentByType.get(selectedType)?.id === editing.id) &&
selectedTypeMeta?.configFields?.map((field) =>
field.input === "list" ? (
<TemplateListField key={field.key} field={field} name={["config", field.key]} />
) : (
<Form.Item
key={field.key}
name={["config", field.key]}
label={field.label}
help={field.help}
>
{field.input === "textarea" ? <Input.TextArea rows={3} /> : <Input />}
</Form.Item>
),
)}
<Form.Item
name="coverUrl"
label="配图地址"
@@ -56,3 +56,55 @@ const unsafe = applyPresentationValues(
assert.deepEqual(unsafe, { founder: "原主理人" });
assert.equal({}.polluted, undefined);
const listFields = [
{
key: "details",
fields: [
{ key: "coverage", binding: "brand.config.profilePresentation.coverage", input: "list" },
{
key: "warranty",
binding: "brand.config.profilePresentation.warranty",
input: "list",
itemValueKey: "value",
},
],
},
];
const existingLists = {
profilePresentation: {
coverage: [{ title: "原区域", content: "原说明" }],
warranty: ["原承诺"],
other: "保留",
},
};
assert.deepEqual(
readPresentationValue(
existingLists,
"brand.config.profilePresentation.warranty",
listFields[0].fields[1],
),
[{ value: "原承诺" }],
);
const updatedLists = applyPresentationValues(existingLists, listFields, {
[presentationFieldName("details", "coverage")]: [{ title: "新区域", content: "新说明" }],
[presentationFieldName("details", "warranty")]: [{ value: "新承诺" }, { value: "" }],
});
assert.deepEqual(updatedLists.profilePresentation.coverage, [
{ title: "新区域", content: "新说明" },
]);
assert.deepEqual(updatedLists.profilePresentation.warranty, ["新承诺"]);
assert.equal(updatedLists.profilePresentation.other, "保留");
assert.deepEqual(existingLists.profilePresentation.warranty, ["原承诺"]);
const offering = applyPresentationValues(
{ details: { background: "旧背景", preserve: "保留" } },
[
{
key: "offering",
fields: [{ key: "background", binding: "offering.config.details.background" }],
},
],
{ [presentationFieldName("offering", "background")]: "新背景" },
);
assert.deepEqual(offering.details, { background: "新背景", preserve: "保留" });
+119
View File
@@ -1206,6 +1206,125 @@ test("public workspace exposes declared brand and trust presentation data", asyn
}
});
test("edited template facts reach public workspace only after publication", async () => {
const doorsBrand = await prisma.brandProfile.findUniqueOrThrow({
where: { slug: "linjing-doors" },
});
const trust = await prisma.trustContent.findFirstOrThrow({
where: { brandId: doorsBrand.id, type: "credential", isPublished: true },
orderBy: { sortOrder: "asc" },
});
const offering = await prisma.offering.findFirstOrThrow({
where: { brandId: doorsBrand.id, isEnabled: true },
orderBy: { sortOrder: "asc" },
});
const adminUser = await prisma.adminUser.findUniqueOrThrow({
where: { username: "admin" },
select: { id: true },
});
const token = signIdentity({ subject: adminUser.id, brandId: doorsBrand.id, role: "admin" });
const headers = { authorization: `Bearer ${token}` };
const originalBrandConfig = doorsBrand.config;
const originalTrustConfig = trust.config;
const originalOfferingConfig = offering.config;
const before = JSON.parse((await request("/public/workspace?brandSlug=linjing-doors")).body);
const changedTitle = "集成测试定制首页标题";
const changedArea = "集成测试项目地点";
const changedIntro = "集成测试发布后联系说明";
const changedHint = "集成测试咨询后处理说明";
const changedDetailHero = "https://example.com/integration-detail.jpg";
const changedStats = [{ value: "42", label: "测试成果" }];
try {
const brandConfig = originalBrandConfig ?? {};
const presentation = brandConfig.visualPresentation ?? {};
const brandUpdate = await request("/admin/config/brand", {
method: "PATCH",
headers,
payload: {
config: {
homeHero: { ...brandConfig.homeHero, title: changedTitle },
visualPresentation: {
...presentation,
success: { ...presentation.success, intro: changedIntro },
detail: { ...presentation.detail, inquiryHint: changedHint },
},
},
},
});
assert.equal(brandUpdate.statusCode, 200);
const trustUpdate = await request(`/admin/config/trust-content/${trust.id}`, {
method: "PATCH",
headers,
payload: { config: { ...(trust.config ?? {}), stats: changedStats } },
});
assert.equal(trustUpdate.statusCode, 200);
const offeringUpdate = await request(`/admin/workspace/offerings/${offering.id}`, {
method: "PATCH",
headers,
payload: {
config: {
...(offering.config ?? {}),
area: changedArea,
detailHero: changedDetailHero,
},
},
});
assert.equal(offeringUpdate.statusCode, 200);
const draftView = JSON.parse((await request("/public/workspace?brandSlug=linjing-doors")).body);
assert.deepEqual(draftView.brand.homeHero, before.brand.homeHero);
assert.equal(
draftView.brand.visualPresentation.success.intro,
before.brand.visualPresentation.success.intro,
);
assert.equal(
draftView.brand.visualPresentation.detail.inquiryHint,
before.brand.visualPresentation.detail.inquiryHint,
);
assert.deepEqual(draftView.trustPresentation.stats, before.trustPresentation.stats);
assert.equal(draftView.offerings[0].presentation.area, before.offerings[0].presentation.area);
assert.equal(
draftView.offerings[0].presentation.heroImage,
before.offerings[0].presentation.heroImage,
);
const publish = await request("/admin/releases/publish", {
method: "POST",
headers,
payload: { note: "集成测试模板内容编辑" },
});
assert.equal(publish.statusCode, 201);
const afterPublish = JSON.parse(
(await request("/public/workspace?brandSlug=linjing-doors")).body,
);
assert.equal(afterPublish.brand.homeHero.title, changedTitle);
assert.equal(afterPublish.brand.visualPresentation.success.intro, changedIntro);
assert.equal(afterPublish.brand.visualPresentation.detail.inquiryHint, changedHint);
assert.deepEqual(afterPublish.trustPresentation.stats, changedStats);
assert.equal(afterPublish.offerings[0].presentation.area, changedArea);
assert.equal(afterPublish.offerings[0].presentation.heroImage, changedDetailHero);
} finally {
await prisma.brandProfile.update({
where: { id: doorsBrand.id },
data: { config: originalBrandConfig },
});
await prisma.trustContent.update({
where: { id: trust.id },
data: { config: originalTrustConfig },
});
await prisma.offering.update({
where: { id: offering.id },
data: { config: originalOfferingConfig },
});
const restored = await request("/admin/releases/publish", {
method: "POST",
headers,
payload: { note: "恢复集成测试模板基线" },
});
assert.equal(restored.statusCode, 201);
}
});
test("admin can create and version an inquiry form", async () => {
const login = await request("/admin/session/login", {
method: "POST",
@@ -1 +1 @@
<view class="form"><view wx:for="{{fields}}" wx:key="key" class="field"><text class="label">{{item.label}}{{item.required ? ' *' : ''}}</text><input wx:if="{{item.type === 'tel' || item.type === 'phone' || item.type === 'number' || item.type === 'text'}}" type="{{item.type === 'number' ? 'number' : item.type === 'tel' || item.type === 'phone' ? 'number' : 'text'}}" data-key="{{item.key}}" placeholder="{{item.placeholder || '请填写'}}" value="{{values[item.key]}}" bindinput="input"/><textarea wx:elif="{{item.type === 'textarea'}}" data-key="{{item.key}}" placeholder="{{item.placeholder || '请填写'}}" value="{{values[item.key]}}" bindinput="input" auto-height="true"/><picker wx:elif="{{item.type === 'date'}}" mode="date" data-key="{{item.key}}" value="{{values[item.key]}}" bindchange="dateChange"><view class="picker-value">{{values[item.key] || '请选择日期'}}</view></picker><picker wx:elif="{{item.type === 'select' || item.type === 'radio'}}" mode="selector" range="{{item.options}}" range-key="label" data-key="{{item.key}}" bindchange="choose"><view class="picker-value">{{values[item.key] || '请选择'}}</view></picker></view><button class="submit" loading="{{submitting}}" bindtap="submit">{{submitLabel || '提交需求'}}</button><text class="privacy">信息仅用于本次方案沟通,我们不会向第三方披露。</text></view>
<view class="form"><view wx:for="{{fields}}" wx:key="key" class="field"><text class="label">{{item.label}}{{item.required ? ' *' : ''}}</text><input wx:if="{{item.type === 'tel' || item.type === 'phone' || item.type === 'number' || item.type === 'text'}}" type="{{item.type === 'number' ? 'number' : item.type === 'tel' || item.type === 'phone' ? 'number' : 'text'}}" data-key="{{item.key}}" placeholder="{{item.placeholder || '请填写'}}" value="{{values[item.key]}}" bindinput="input"/><textarea wx:elif="{{item.type === 'textarea'}}" data-key="{{item.key}}" placeholder="{{item.placeholder || '请填写'}}" value="{{values[item.key]}}" bindinput="input" auto-height="true"/><picker wx:elif="{{item.type === 'date'}}" mode="date" data-key="{{item.key}}" value="{{values[item.key]}}" bindchange="dateChange"><view class="picker-value">{{values[item.key] || '请选择日期'}}</view></picker><picker wx:elif="{{item.type === 'select' || item.type === 'radio'}}" mode="selector" range="{{item.options}}" range-key="label" data-key="{{item.key}}" bindchange="choose"><view class="picker-value">{{values[item.key] || '请选择'}}</view></picker></view><button class="submit" loading="{{submitting}}" bindtap="submit">{{submitLabel || '提交需求'}}</button></view>
@@ -1 +1 @@
<view class="success"><view class="mark">✓</view><text class="eyebrow">{{presentation.eyebrow}}</text><text class="title">{{presentation.title}}</text><text class="intro">{{presentation.intro}}</text><view class="summary"><view><text>档案编号</text><text>{{record.id}}</text></view><view><text>定制类型</text><text>{{record.type}}</text></view><view><text>当前状态</text><text>{{record.status}}</text></view></view><button bindtap="records">{{presentation.recordsAction}}</button><button class="secondary" bindtap="home">{{presentation.homeAction}}</button></view>
<view class="success"><view class="mark">✓</view><text class="eyebrow">{{presentation.eyebrow}}</text><text class="title">{{presentation.title}}</text><text class="intro">{{presentation.intro}}</text><view class="summary"><view><text>档案编号</text><text>{{record.id}}</text></view><view wx:if="{{record.type}}"><text>咨询类型</text><text>{{record.type}}</text></view><view><text>当前状态</text><text>{{record.status}}</text></view></view><button bindtap="records">{{presentation.recordsAction}}</button><button class="secondary" bindtap="home">{{presentation.homeAction}}</button></view>
+2 -2
View File
@@ -6,7 +6,7 @@ Page({
submitting: false,
eyebrow: "CONSULTATION",
title: "需求咨询",
subtitle: "提交信息后由主理人与你联系",
subtitle: "",
submitLabel: "提交需求",
presentation: {},
values: {},
@@ -34,7 +34,7 @@ Page({
formId: form?.key || form?.id || "",
title: isQuote ? "获取报价方案" : presentation.title || "需求咨询",
eyebrow: isQuote ? "QUOTE REQUEST" : presentation.eyebrow || "CONSULTATION",
subtitle: presentation.subtitle || "提交信息后由主理人与你联系",
subtitle: presentation.subtitle || "",
submitLabel: isQuote ? "提交报价需求" : presentation.submitLabel || "提交需求",
presentation,
});
@@ -0,0 +1,31 @@
# 0016 模板结构化内容的品牌编辑方式
## Context
林境模板的信任数据、合作流程、服务区域和案例材料不是单段文字。它们已存入品牌或信任内容配置并进入发布快照,但普通品牌管理员没有可用的编辑入口。阿成模板还存在未经配置支持的营业状态和服务承诺文案。仅验证页面能显示,不能证明品牌能够自主运营。
## Decision
- 模板包通过 `admin.sections` 和 `trustContentTypes.configFields` 声明可编辑字段。`list` 字段声明每条记录的业务名称及输入方式,Admin 渲染可增删的列表表单,不展示内部 JSON。
- 品牌、业务项和信任内容继续存入各自现有的配置,不向共享品牌模型添加门窗或餐饮专属字段。公开页面只读取已发布快照。
- 涉及价格、营业、配送、订金、响应时效和质保等事实或承诺的文案,必须来自可编辑的品牌内容或业务项;没有可靠数据时不展示肯定性声明。
- 同类型信任内容可能有多条,后台必须将结构化字段的编辑入口指向实际提供页面数据的条目,避免保存成功但页面不变。
- 模板测试需从页面及其引用组件提取实际展示的 `presentation`、首屏、信任和业务详情字段,并核对模板声明中的后台绑定;仅检查声明自身是否合法不足以证明内容可编辑。
## Alternatives
- 在 Admin 为每个行业写专属表单:模板数量增长后无法维护。
- 让品牌管理员直接编辑配置 JSON:易错且不符合非技术用户的使用目标。
- 把结构化数据压成换行文本再解析:缺少字段校验,容易因文案修改破坏页面。
## Consequences
- 新模板交付时需要核对“渲染字段 → 声明字段 → 后台表单 → 发布快照”完整链路。
- 新增可重复内容时,需要同时更新模板契约、Admin 控件和回归测试。
- 普通按钮和栏目标签可由模板决定;事实性业务信息不得靠模板默认文案冒充品牌配置。
## Migration Plan
1. 为现有林境和阿成模板补齐声明及后台表单,移除未经配置支持的事实性文案。
2. 用独立测试数据库验证保存草稿不会影响公开页面,发布后才更新。
3. 新模板入库时沿用同一核查项,不在共享后台增加模板 key 分支。
+9 -1
View File
@@ -70,7 +70,14 @@ export interface TemplateAdminField {
binding: string;
label: string;
help?: string;
input: "text" | "textarea" | "phone" | "image" | "number";
input: "text" | "textarea" | "phone" | "image" | "number" | "list";
itemFields?: Array<{
key: string;
label: string;
input?: "text" | "textarea";
required?: boolean;
}>;
itemValueKey?: string;
required?: boolean;
maxLength?: number;
placeholder?: string;
@@ -93,6 +100,7 @@ export interface AdminTemplateContent {
help?: string;
placeholder?: string;
required?: boolean;
configFields?: TemplateAdminField[];
}>;
assetSlots: Array<{
key: string;
@@ -223,6 +223,24 @@ export const generatedTemplatePackageRegistry = [
"input": "text",
"placeholder": "例如:17:00 - 22:30 · 今日营业中"
},
{
"key": "coverageContent",
"binding": "brand.config.visualPresentation.profile.coverageContent",
"label": "取餐与配送说明",
"input": "textarea"
},
{
"key": "coverageTitle",
"binding": "brand.config.visualPresentation.profile.coverageTitle",
"label": "服务方式标题",
"input": "text"
},
{
"key": "worksEyebrow",
"binding": "brand.config.visualPresentation.home.worksEyebrow",
"label": "餐品区域小标题",
"input": "text"
},
{
"key": "worksTitle",
"binding": "brand.config.visualPresentation.home.worksTitle",
@@ -255,6 +273,13 @@ export const generatedTemplatePackageRegistry = [
"label": "菜单页说明",
"input": "textarea",
"maxLength": 120
},
{
"key": "menuTip",
"binding": "brand.config.visualPresentation.offerings.menuTip",
"label": "菜单提示",
"help": "只填写当前实际提供的取餐、加菜或定制服务。",
"input": "textarea"
}
]
},
@@ -283,6 +308,239 @@ export const generatedTemplatePackageRegistry = [
"label": "提交按钮文字",
"input": "text",
"placeholder": "例如:提交预订需求"
},
{
"key": "promise",
"binding": "brand.config.visualPresentation.inquiry.promise",
"label": "真实服务承诺",
"help": "仅填写能兑现的回复时间、订金和联系规则;留空则不显示。",
"input": "textarea"
}
]
},
{
"key": "dishDetail",
"title": "餐品与服务详情",
"description": "每项餐品或服务单独填写;没有内容的详情区块不会展示。",
"target": "offering",
"fields": [
{
"key": "categoryLabel",
"binding": "offering.config.categoryLabel",
"label": "餐品类别",
"input": "text"
},
{
"key": "detailHero",
"binding": "offering.config.detailHero",
"label": "详情主图",
"input": "image"
},
{
"key": "area",
"binding": "offering.config.area",
"label": "供应地点",
"input": "text"
},
{
"key": "series",
"binding": "offering.config.series",
"label": "套餐或系列说明",
"input": "text"
},
{
"key": "spaceType",
"binding": "offering.config.spaceType",
"label": "适合场景",
"input": "text"
},
{
"key": "background",
"binding": "offering.config.details.background",
"label": "餐品介绍",
"input": "textarea"
},
{
"key": "designConcept",
"binding": "offering.config.details.designConcept",
"label": "口味与分量",
"input": "textarea"
},
{
"key": "keywords",
"binding": "offering.config.keywords",
"label": "餐品特色",
"input": "list",
"itemValueKey": "value",
"itemFields": [
{
"key": "value",
"label": "特色"
}
]
},
{
"key": "crafts",
"binding": "offering.config.details.crafts",
"label": "制作方式",
"input": "list",
"itemValueKey": "value",
"itemFields": [
{
"key": "value",
"label": "制作说明"
}
]
},
{
"key": "materialsList",
"binding": "offering.config.details.materialsList",
"label": "食材与搭配",
"input": "list",
"itemFields": [
{
"key": "name",
"label": "食材或搭配"
},
{
"key": "spec",
"label": "说明"
}
]
}
]
},
{
"key": "detailCopy",
"title": "详情页说明",
"description": "解释价格、餐品内容和咨询后会怎样处理。",
"target": "brand",
"fields": [
{
"key": "priceLabel",
"binding": "brand.config.visualPresentation.detail.priceLabel",
"label": "价格说明标题",
"input": "text"
},
{
"key": "spaceLabel",
"binding": "brand.config.visualPresentation.detail.spaceLabel",
"label": "适合场景标题",
"input": "text"
},
{
"key": "backgroundTitle",
"binding": "brand.config.visualPresentation.detail.backgroundTitle",
"label": "餐品介绍标题",
"input": "text"
},
{
"key": "conceptTitle",
"binding": "brand.config.visualPresentation.detail.conceptTitle",
"label": "口味与分量标题",
"input": "text"
},
{
"key": "craftsTitle",
"binding": "brand.config.visualPresentation.detail.craftsTitle",
"label": "制作方式标题",
"input": "text"
},
{
"key": "materialsTitle",
"binding": "brand.config.visualPresentation.detail.materialsTitle",
"label": "食材与搭配标题",
"input": "text"
},
{
"key": "inquiryAction",
"binding": "brand.config.visualPresentation.detail.inquiryAction",
"label": "咨询按钮文字",
"input": "text"
},
{
"key": "inquiryHint",
"binding": "brand.config.visualPresentation.detail.inquiryHint",
"label": "咨询后的处理说明",
"help": "只写能够兑现的联系和确认方式。",
"input": "textarea"
}
]
},
{
"key": "successCopy",
"title": "提交成功页",
"description": "顾客提交后看到的确认信息与后续预期。",
"target": "brand",
"fields": [
{
"key": "eyebrow",
"binding": "brand.config.visualPresentation.success.eyebrow",
"label": "页面小标题",
"input": "text"
},
{
"key": "title",
"binding": "brand.config.visualPresentation.success.title",
"label": "确认标题",
"input": "text"
},
{
"key": "intro",
"binding": "brand.config.visualPresentation.success.intro",
"label": "后续联系说明",
"help": "若写回复时间,请确认日常能兑现。",
"input": "textarea"
},
{
"key": "recordsAction",
"binding": "brand.config.visualPresentation.success.recordsAction",
"label": "查看记录按钮",
"input": "text"
},
{
"key": "homeAction",
"binding": "brand.config.visualPresentation.success.homeAction",
"label": "返回首页按钮",
"input": "text"
}
]
},
{
"key": "recordsCopy",
"title": "咨询记录页",
"description": "顾客查看预订与咨询处理进度时看到的内容。",
"target": "brand",
"fields": [
{
"key": "title",
"binding": "brand.config.visualPresentation.records.title",
"label": "记录页标题",
"input": "text"
},
{
"key": "createAction",
"binding": "brand.config.visualPresentation.records.createAction",
"label": "新增咨询按钮",
"input": "text"
},
{
"key": "emptyTitle",
"binding": "brand.config.visualPresentation.records.emptyTitle",
"label": "暂无记录标题",
"input": "text"
},
{
"key": "emptyDescription",
"binding": "brand.config.visualPresentation.records.emptyDescription",
"label": "暂无记录说明",
"input": "textarea"
},
{
"key": "emptyAction",
"binding": "brand.config.visualPresentation.records.emptyAction",
"label": "空状态按钮",
"input": "text"
}
]
}
@@ -649,17 +907,176 @@ export const generatedTemplatePackageRegistry = [
"label": "信任介绍标题",
"input": "text"
},
{
"key": "proofEyebrow",
"binding": "brand.config.visualPresentation.home.proofEyebrow",
"label": "信任介绍小标题",
"input": "text"
},
{
"key": "manifestoEyebrow",
"binding": "brand.config.visualPresentation.home.manifestoEyebrow",
"label": "品牌主张小标题",
"input": "text"
},
{
"key": "manifestoTitle",
"binding": "brand.config.visualPresentation.home.manifestoTitle",
"label": "品牌主张",
"input": "text"
},
{
"key": "worksEyebrow",
"binding": "brand.config.visualPresentation.home.worksEyebrow",
"label": "代表案例小标题",
"input": "text"
},
{
"key": "worksTitle",
"binding": "brand.config.visualPresentation.home.worksTitle",
"label": "代表案例标题",
"input": "text"
},
{
"key": "worksAction",
"binding": "brand.config.visualPresentation.home.worksAction",
"label": "查看案例入口",
"input": "text"
},
{
"key": "flowEyebrow",
"binding": "brand.config.visualPresentation.home.flowEyebrow",
"label": "合作流程小标题",
"input": "text"
},
{
"key": "flowTitle",
"binding": "brand.config.visualPresentation.home.flowTitle",
"label": "项目流程标题",
"input": "text"
},
{
"key": "heroTitle",
"binding": "brand.config.homeHero.title",
"label": "首页主标题",
"input": "text"
},
{
"key": "heroEyebrow",
"binding": "brand.config.homeHero.eyebrow",
"label": "主图项目标注",
"input": "text"
},
{
"key": "heroDescription",
"binding": "brand.config.homeHero.slogan",
"label": "首页主图说明",
"input": "textarea"
},
{
"key": "heroAction",
"binding": "brand.config.homeHero.cta",
"label": "主图行动文字",
"input": "text"
}
]
},
{
"key": "profileDetails",
"title": "服务区域与履约说明",
"description": "在主理人与我页面说明可服务的地区和真实履约承诺。",
"target": "brand",
"fields": [
{
"key": "coverage",
"binding": "brand.config.profilePresentation.coverage",
"label": "服务区域",
"input": "list",
"itemFields": [
{
"key": "title",
"label": "区域名称"
},
{
"key": "content",
"label": "服务说明",
"input": "textarea"
}
]
},
{
"key": "warranty",
"binding": "brand.config.profilePresentation.warranty",
"label": "履约与维护说明",
"input": "list",
"itemValueKey": "value",
"itemFields": [
{
"key": "value",
"label": "承诺内容",
"input": "textarea"
}
]
},
{
"key": "recordsTitle",
"binding": "brand.config.visualPresentation.profile.recordsTitle",
"label": "咨询记录入口标题",
"input": "text"
},
{
"key": "recordsSubtitle",
"binding": "brand.config.visualPresentation.profile.recordsSubtitle",
"label": "咨询记录入口说明",
"input": "textarea"
},
{
"key": "coverageTitle",
"binding": "brand.config.visualPresentation.profile.coverageTitle",
"label": "服务区域标题",
"input": "text"
},
{
"key": "warrantyTitle",
"binding": "brand.config.visualPresentation.profile.warrantyTitle",
"label": "履约说明标题",
"input": "text"
},
{
"key": "phoneLabel",
"binding": "brand.config.visualPresentation.profile.phoneLabel",
"label": "电话标签",
"input": "text"
},
{
"key": "wechatLabel",
"binding": "brand.config.visualPresentation.profile.wechatLabel",
"label": "微信标签",
"input": "text"
},
{
"key": "addressLabel",
"binding": "brand.config.visualPresentation.profile.addressLabel",
"label": "地址标签",
"input": "text"
},
{
"key": "callAction",
"binding": "brand.config.visualPresentation.profile.callAction",
"label": "拨打电话按钮",
"input": "text"
},
{
"key": "copyAction",
"binding": "brand.config.visualPresentation.profile.copyAction",
"label": "复制微信按钮",
"input": "text"
},
{
"key": "recordsCountUnit",
"binding": "brand.config.visualPresentation.profile.recordsCountUnit",
"label": "记录数量单位",
"input": "text"
}
]
},
@@ -687,6 +1104,18 @@ export const generatedTemplatePackageRegistry = [
"label": "案例页说明",
"input": "textarea",
"maxLength": 140
},
{
"key": "closingText",
"binding": "brand.config.visualPresentation.offerings.closingText",
"label": "案例页结语",
"input": "textarea"
},
{
"key": "closingAction",
"binding": "brand.config.visualPresentation.offerings.closingAction",
"label": "案例页咨询入口",
"input": "text"
}
]
},
@@ -714,6 +1143,244 @@ export const generatedTemplatePackageRegistry = [
"binding": "brand.config.visualPresentation.inquiry.submitLabel",
"label": "提交按钮文字",
"input": "text"
},
{
"key": "eyebrow",
"binding": "brand.config.visualPresentation.inquiry.eyebrow",
"label": "咨询页小标题",
"input": "text"
},
{
"key": "note",
"binding": "brand.config.visualPresentation.inquiry.note",
"label": "咨询前提示",
"input": "textarea"
}
]
},
{
"key": "projectDetail",
"title": "案例详情",
"description": "以下内容分别填写在每个案例中,空白内容不会展示。",
"target": "offering",
"fields": [
{
"key": "categoryLabel",
"binding": "offering.config.categoryLabel",
"label": "案例类别",
"input": "text"
},
{
"key": "detailHero",
"binding": "offering.config.detailHero",
"label": "详情主图",
"input": "image"
},
{
"key": "area",
"binding": "offering.config.area",
"label": "项目地点",
"input": "text"
},
{
"key": "series",
"binding": "offering.config.series",
"label": "产品系列",
"input": "text"
},
{
"key": "spaceType",
"binding": "offering.config.spaceType",
"label": "适用空间",
"input": "text"
},
{
"key": "background",
"binding": "offering.config.details.background",
"label": "项目背景",
"input": "textarea"
},
{
"key": "designConcept",
"binding": "offering.config.details.designConcept",
"label": "设计理念",
"input": "textarea"
},
{
"key": "keywords",
"binding": "offering.config.keywords",
"label": "项目关键词",
"input": "list",
"itemValueKey": "value",
"itemFields": [
{
"key": "value",
"label": "关键词"
}
]
},
{
"key": "crafts",
"binding": "offering.config.details.crafts",
"label": "工艺要点",
"input": "list",
"itemValueKey": "value",
"itemFields": [
{
"key": "value",
"label": "工艺说明"
}
]
},
{
"key": "materialsList",
"binding": "offering.config.details.materialsList",
"label": "材料说明",
"input": "list",
"itemFields": [
{
"key": "name",
"label": "材料名称"
},
{
"key": "spec",
"label": "规格说明"
}
]
}
]
},
{
"key": "detailCopy",
"title": "详情页说明",
"description": "说明案例内容、价格与咨询后的真实处理方式。",
"target": "brand",
"fields": [
{
"key": "priceLabel",
"binding": "brand.config.visualPresentation.detail.priceLabel",
"label": "价格说明标题",
"input": "text"
},
{
"key": "spaceLabel",
"binding": "brand.config.visualPresentation.detail.spaceLabel",
"label": "适用空间标题",
"input": "text"
},
{
"key": "backgroundTitle",
"binding": "brand.config.visualPresentation.detail.backgroundTitle",
"label": "项目背景标题",
"input": "text"
},
{
"key": "conceptTitle",
"binding": "brand.config.visualPresentation.detail.conceptTitle",
"label": "设计理念标题",
"input": "text"
},
{
"key": "craftsTitle",
"binding": "brand.config.visualPresentation.detail.craftsTitle",
"label": "工艺要点标题",
"input": "text"
},
{
"key": "materialsTitle",
"binding": "brand.config.visualPresentation.detail.materialsTitle",
"label": "材料说明标题",
"input": "text"
},
{
"key": "inquiryAction",
"binding": "brand.config.visualPresentation.detail.inquiryAction",
"label": "咨询按钮文字",
"input": "text"
},
{
"key": "inquiryHint",
"binding": "brand.config.visualPresentation.detail.inquiryHint",
"label": "咨询后的处理说明",
"help": "只填写能兑现的服务安排。",
"input": "textarea"
}
]
},
{
"key": "successCopy",
"title": "提交成功页",
"description": "访客提交后看到的确认信息与后续预期。",
"target": "brand",
"fields": [
{
"key": "eyebrow",
"binding": "brand.config.visualPresentation.success.eyebrow",
"label": "页面小标题",
"input": "text"
},
{
"key": "title",
"binding": "brand.config.visualPresentation.success.title",
"label": "确认标题",
"input": "text"
},
{
"key": "intro",
"binding": "brand.config.visualPresentation.success.intro",
"label": "后续联系说明",
"help": "回复时间必须与实际承诺一致。",
"input": "textarea"
},
{
"key": "recordsAction",
"binding": "brand.config.visualPresentation.success.recordsAction",
"label": "查看记录按钮",
"input": "text"
},
{
"key": "homeAction",
"binding": "brand.config.visualPresentation.success.homeAction",
"label": "返回首页按钮",
"input": "text"
}
]
},
{
"key": "recordsCopy",
"title": "咨询记录页",
"description": "访客查看咨询状态时看到的内容。",
"target": "brand",
"fields": [
{
"key": "title",
"binding": "brand.config.visualPresentation.records.title",
"label": "记录页标题",
"input": "text"
},
{
"key": "createAction",
"binding": "brand.config.visualPresentation.records.createAction",
"label": "新增咨询按钮",
"input": "text"
},
{
"key": "emptyTitle",
"binding": "brand.config.visualPresentation.records.emptyTitle",
"label": "暂无记录标题",
"input": "text"
},
{
"key": "emptyDescription",
"binding": "brand.config.visualPresentation.records.emptyDescription",
"label": "暂无记录说明",
"input": "textarea"
},
{
"key": "emptyAction",
"binding": "brand.config.visualPresentation.records.emptyAction",
"label": "空状态按钮",
"input": "text"
}
]
}
@@ -741,6 +1408,65 @@ export const generatedTemplatePackageRegistry = [
"type": "credential",
"label": "专业资历与方法",
"help": "填写经验、资质、专业标准或工作方法。",
"configFields": [
{
"key": "stats",
"binding": "trust.config.stats",
"label": "信任数据",
"input": "list",
"itemFields": [
{
"key": "value",
"label": "数字或成果"
},
{
"key": "label",
"label": "说明"
},
{
"key": "sub",
"label": "补充说明",
"required": false
}
]
},
{
"key": "pillars",
"binding": "trust.config.pillars",
"label": "专业方法",
"input": "list",
"itemFields": [
{
"key": "title",
"label": "方法名称"
},
{
"key": "desc",
"label": "方法说明"
}
]
},
{
"key": "serviceFlow",
"binding": "trust.config.serviceFlow",
"label": "合作流程",
"input": "list",
"itemFields": [
{
"key": "step",
"label": "步骤编号"
},
{
"key": "name",
"label": "步骤名称"
},
{
"key": "desc",
"label": "步骤说明"
}
]
}
],
"required": true
},
{
@@ -985,4 +1711,4 @@ export const generatedTemplatePackageRegistry = [
}
];
export const generatedTemplatePackageRegistryHash =
"f7ba069156be4fdf8f21c6e600796082ff87d5c04b0ed2a07d3b7d4ca68817b5";
"2a4344e4bb932b06eb386cba64d407290fa125799bf16a204eddb945179e68fc";
+17 -1
View File
@@ -222,7 +222,15 @@ export interface TemplatePackageManifest {
title: string;
description: string;
target: "brand" | "offering" | "trust" | "inquiry";
fields: readonly { key: string; binding: string; label: string; required?: boolean }[];
fields: readonly {
key: string;
binding: string;
label: string;
input: string;
required?: boolean;
itemFields?: readonly { key: string; label: string; input?: string; required?: boolean }[];
itemValueKey?: string;
}[];
}[];
};
trustContentTypes?: readonly {
@@ -231,6 +239,14 @@ export interface TemplatePackageManifest {
help?: string;
placeholder?: string;
required?: boolean;
configFields?: readonly {
key: string;
binding: string;
label: string;
input: string;
itemFields?: readonly { key: string; label: string; input?: string; required?: boolean }[];
itemValueKey?: string;
}[];
}[];
sampleContent?: Partial<Record<BrandTemplateKey, TemplateSampleContent>>;
}
@@ -1,7 +1,7 @@
{
"pages": ["pages/index/index"],
"window": {
"navigationBarTitleText": "阿成校园餐",
"navigationBarTitleText": "品牌首页",
"navigationBarBackgroundColor": "#FFF8F0",
"navigationBarTextStyle": "black"
},
@@ -1 +1 @@
<view class="page"><view class="brand-card"><view class="identity"><image src="{{brand.avatarUrl}}" mode="aspectFill"/><view><text class="name">{{brand.founder}}</text><text class="title">{{brand.title}}</text><text class="slogan">“{{brand.slogan}}”</text></view></view><view class="notice"><text class="notice-title">{{presentation.stallTitle || '今日出摊点'}}</text><text>{{brand.studioAddress || brand.address}}</text><text class="notice-time">{{presentation.stallTime || '17:00 - 22:30 · 今日营业中'}}</text><text wx:for="{{trustItems}}" wx:if="{{item.type === 'schedule'}}" wx:key="title" class="notice-desc">{{item.content}}</text></view><view class="actions"><button bindtap="openInquiry">预约 / 定制</button><button class="muted" bindtap="openOfferings">今日菜单</button></view></view><view class="scene-wrap"><view class="section-head"><text class="eyebrow">真实出摊现场</text><text class="more">{{brand.name}}</text></view><image src="{{brand.heroImage}}" mode="aspectFill" bindtap="openService"/></view><view class="section-head"><view><text class="eyebrow">{{presentation.worksEyebrow || '今日餐品与预订'}}</text><text class="heading">{{presentation.worksTitle || '套餐、聚餐与定制餐'}}</text></view><text class="more" bindtap="openOfferings">全部餐品 ›</text></view><view class="dish-grid"><view wx:for="{{offerings}}" wx:key="id" class="dish" data-id="{{item.id}}" bindtap="openOffering"><image src="{{item.image}}" mode="aspectFill"/><view class="dish-copy"><text class="dish-name">{{item.name}}</text><text class="dish-sub">{{item.desc}}</text><text class="price">{{item.priceRange}}</text></view></view></view><view wx:for="{{trustItems}}" wx:if="{{item.type === 'promise' || item.type === 'case'}}" wx:key="title" class="promise"><text class="eyebrow light">{{item.title}}</text><text class="promise-title">{{item.summary}}</text><text class="quote">{{item.content}}</text></view></view>
<view class="page"><view class="brand-card"><view class="identity"><image src="{{brand.avatarUrl}}" mode="aspectFill"/><view><text class="name">{{brand.founder}}</text><text class="title">{{brand.title}}</text><text class="slogan">“{{brand.slogan}}”</text></view></view><view class="notice"><text class="notice-title">{{presentation.stallTitle || '服务地点'}}</text><text>{{brand.studioAddress || brand.address}}</text><text wx:if="{{presentation.stallTime}}" class="notice-time">{{presentation.stallTime}}</text><text wx:for="{{trustItems}}" wx:if="{{item.type === 'schedule'}}" wx:key="title" class="notice-desc">{{item.content}}</text></view><view class="actions"><button bindtap="openInquiry">咨询 / 预订</button><button class="muted" bindtap="openOfferings">查看餐品</button></view></view><view class="scene-wrap"><view class="section-head"><text class="eyebrow">{{brand.name}}</text></view><image src="{{brand.heroImage}}" mode="aspectFill" bindtap="openService"/></view><view class="section-head"><view><text class="eyebrow">{{presentation.worksEyebrow || '餐品与服务'}}</text><text class="heading">{{presentation.worksTitle || '可选餐品'}}</text></view><text class="more" bindtap="openOfferings">查看全部 ›</text></view><view class="dish-grid"><view wx:for="{{offerings}}" wx:key="id" class="dish" data-id="{{item.id}}" bindtap="openOffering"><image src="{{item.image}}" mode="aspectFill"/><view class="dish-copy"><text class="dish-name">{{item.name}}</text><text class="dish-sub">{{item.desc}}</text><text class="price">{{item.priceRange}}</text></view></view></view><view wx:for="{{trustItems}}" wx:if="{{item.type === 'promise' || item.type === 'case'}}" wx:key="title" class="promise"><text class="eyebrow light">{{item.title}}</text><text class="promise-title">{{item.summary}}</text><text class="quote">{{item.content}}</text></view></view>
@@ -1 +1 @@
<view class="page"><view class="head"><text class="eyebrow">{{brand.name}}</text><text class="title">{{presentation.title || '今日菜单'}}</text><text class="subtitle">{{presentation.subtitle || '现做现吃,支持提前预留和团体定制'}}</text></view><view wx:if="{{categories.length > 1}}" class="filters"><view wx:for="{{categories}}" wx:key="key" class="filter {{item.key === category ? 'active' : ''}}" data-key="{{item.key}}" bindtap="chooseCategory">{{item.label}}</view></view><view class="search"><text class="search-icon">⌕</text><input value="{{query}}" placeholder="搜索餐品、牛肉、卤肉、鸡腿" bindinput="search" /></view><view class="tip">米饭免费续,支持微辣、免葱姜蒜,团体餐可提前预留。</view><view class="list"><view wx:for="{{visibleOfferings}}" wx:key="id" class="dish" data-id="{{item.id}}" bindtap="open"><view class="dish-media"><image src="{{item.image}}" mode="aspectFill"/><text class="tag">{{item.category || '现做餐品'}}</text></view><view class="copy"><text class="name">{{item.name}}</text><text class="desc">{{item.desc}}</text><view class="chips"><text>现做</text><text>今日有售</text></view><view class="bottom"><text class="price">{{item.priceRange}}</text><text class="action">详情 / 预留 ›</text></view></view></view></view><button class="cta" bindtap="inquire">团体活动 / 定制餐咨询</button></view>
<view class="page"><view class="head"><text class="eyebrow">{{brand.name}}</text><text class="title">{{presentation.title || '餐品与服务'}}</text><text class="subtitle">{{presentation.subtitle}}</text></view><view wx:if="{{categories.length > 1}}" class="filters"><view wx:for="{{categories}}" wx:key="key" class="filter {{item.key === category ? 'active' : ''}}" data-key="{{item.key}}" bindtap="chooseCategory">{{item.label}}</view></view><view class="search"><text class="search-icon">⌕</text><input value="{{query}}" placeholder="搜索餐品" bindinput="search" /></view><view wx:if="{{presentation.menuTip}}" class="tip">{{presentation.menuTip}}</view><view class="list"><view wx:for="{{visibleOfferings}}" wx:key="id" class="dish" data-id="{{item.id}}" bindtap="open"><view class="dish-media"><image src="{{item.image}}" mode="aspectFill"/><text class="tag">{{item.category || '餐品'}}</text></view><view class="copy"><text class="name">{{item.name}}</text><text class="desc">{{item.desc}}</text><view class="bottom"><text class="price">{{item.priceRange}}</text><text class="action">查看详情 ›</text></view></view></view></view><button class="cta" bindtap="inquire">咨询 / 预订</button></view>
@@ -1 +1 @@
<view class="page"><view class="profile-card"><image src="{{brand.avatarUrl}}" mode="aspectFill"/><text class="name">{{brand.founder}}</text><text class="title">{{brand.title}}</text><text class="bio">{{brand.slogan}}</text><view class="contact"><button bindtap="call">电话联系</button><button bindtap="copy">复制微信</button></view></view><view class="card"><text class="card-title">{{presentation.coverageTitle || '出摊与配送'}}</text><text>{{brand.studioAddress || brand.address}}</text><text>{{presentation.coverageContent || '支持校园摊位自取、宿舍配送和班级活动定制。'}}</text></view><view class="card" bindtap="records"><text class="card-title">我的预约记录</text><text>{{recordsCount}} 条记录 ›</text></view></view>
<view class="page"><view class="profile-card"><image src="{{brand.avatarUrl}}" mode="aspectFill"/><text class="name">{{brand.founder}}</text><text class="title">{{brand.title}}</text><text class="bio">{{brand.slogan}}</text><view class="contact"><button bindtap="call">电话联系</button><button bindtap="copy">复制微信</button></view></view><view class="card"><text class="card-title">{{presentation.coverageTitle || '服务地点与方式'}}</text><text>{{brand.studioAddress || brand.address}}</text><text wx:if="{{presentation.coverageContent}}">{{presentation.coverageContent}}</text></view><view class="card" bindtap="records"><text class="card-title">我的预约记录</text><text>{{recordsCount}} 条记录 ›</text></view></view>
@@ -5,14 +5,15 @@ Page({
data: { brand: {}, presentation: {}, trustItems: [], offerings: [], error: "" },
onLoad() {
loadWorkspaceWithFallback()
.then((workspace) =>
.then((workspace) => {
this.setData({
brand: workspace.brand || {},
presentation: workspace.brand?.visualPresentation?.home || {},
trustItems: workspace.trustItems || [],
offerings: workspace.offerings || [],
}),
)
});
wx.setNavigationBarTitle({ title: workspace.brand?.name || "品牌首页" });
})
.catch((error) => this.setData({ error: error.message }));
},
selectOffering(event) {
@@ -1,5 +1,5 @@
{
"navigationBarTitleText": "阿成校园餐",
"navigationBarTitleText": "品牌首页",
"usingComponents": {
"acheng-home": "/components/templates/acheng-home/acheng-home"
}
@@ -34,12 +34,14 @@ Page({
formId: "",
submitting: false,
formError: "",
presentation: {},
},
onLoad(options) {
this.offeringId = options.offeringId || "";
loadWorkspaceWithFallback()
.then((workspace) => {
this.forms = workspace.inquiryForms || [];
this.setData({ presentation: workspace.brand?.visualPresentation?.inquiry || {} });
this.selectForm();
})
.catch((error) => this.setData({ formError: error.message }));
@@ -112,7 +114,7 @@ Page({
wx.setStorageSync("latestInquirySubmission", result);
this.setData({ submitting: false, subView: "history" });
this.loadRecords();
wx.showToast({ title: "已提交,阿成会尽快联系你", icon: "none" });
wx.showToast({ title: "咨询已提交", icon: "none" });
});
const fail = (error) =>
this.setData({ submitting: false, formError: error.message || "提交失败,请重试" });
@@ -2,8 +2,8 @@
<view class="sub-tabs"><view class="sub-tab {{subView === 'form' ? 'active' : ''}}" data-view="form" bindtap="switchView">▤ 新建咨询 / 预订</view><view class="sub-tab {{subView === 'history' ? 'active' : ''}}" data-view="history" bindtap="switchView">▣ 我的咨询记录 ({{records.length}})</view></view>
<block wx:if="{{subView === 'form'}}">
<view class="form-card">
<text class="form-title">定制 / 预留需求登记</text>
<text class="form-desc">告诉阿成时间与人数,阿成量身帮你们排菜(免收预约定金)</text>
<text class="form-title">{{presentation.title || '咨询 / 预订'}}</text>
<text wx:if="{{presentation.subtitle}}" class="form-desc">{{presentation.subtitle}}</text>
<view wx:for="{{fields}}" wx:key="key" class="field">
<text class="label">{{item.label}} <b wx:if="{{item.required}}">*</b></text>
<picker wx:if="{{item.type === 'select' || item.type === 'radio'}}" range="{{item.options}}" range-key="label" data-key="{{item.key}}" bindchange="choose"><view class="picker">{{values[item.key] || '请选择' + item.label}}</view></picker>
@@ -12,21 +12,20 @@
<input wx:else type="{{item.type === 'number' ? 'number' : 'text'}}" value="{{values[item.key]}}" data-key="{{item.key}}" bindinput="input" placeholder="{{item.placeholder || '请填写' + item.label}}" />
</view>
<view wx:if="{{formError}}" class="error">! {{formError}}</view>
<view class="promise">◷ <text>承诺:阿成将在 15~30 分钟内主动加微信沟通,未成单绝不骚扰。</text></view>
<button class="submit" loading="{{submitting}}" bindtap="submit">➤ 立即提交咨询(免收定金)</button>
<view wx:if="{{presentation.promise}}" class="promise"><text>{{presentation.promise}}</text></view>
<button class="submit" loading="{{submitting}}" bindtap="submit">{{presentation.submitLabel || '提交咨询'}}</button>
</view>
</block>
<block wx:else>
<view wx:if="{{!records.length}}" class="empty"><text class="empty-icon">▣</text><text class="empty-title">暂无咨询记录</text><text>快向阿成提交一份预订需求吧~</text><button bindtap="switchToForm">新建咨询</button></view>
<view wx:if="{{!records.length}}" class="empty"><text class="empty-icon">▣</text><text class="empty-title">暂无咨询记录</text><text>提交需求后,可以在这里查看处理进度。</text><button bindtap="switchToForm">新建咨询</button></view>
<view wx:else class="history-list">
<view wx:for="{{records}}" wx:key="id" class="history-card">
<view class="history-head"><text class="record-id">单号 #{{item.id}}</text><text class="record-status">{{item.status}}</text></view>
<text class="history-title">{{item.title}}</text>
<text wx:for="{{item.summary}}" wx:for-item="line" wx:key="key">{{line.label}}:{{line.value}}</text>
<view wx:if="{{item.replyNote}}" class="reply"><b>阿成微信留言:</b>{{item.replyNote}}</view>
<view class="history-foot">提交时间:{{item.createdAt}}<text>如有修改可随时微信留言</text></view>
<view wx:if="{{item.replyNote}}" class="reply"><b>处理回复:</b>{{item.replyNote}}</view>
<view class="history-foot">提交时间:{{item.createdAt}}</view>
</view>
<text class="history-note">仅展示近 30 天内的微信预约咨询历史</text>
</view>
</block>
</view>
@@ -1,6 +1,6 @@
<view class="page service-page">
<block wx:for="{{trustItems}}" wx:key="title">
<view wx:if="{{item.type === 'schedule'}}" class="service-card"><view class="card-head"><view class="head-title"><text class="icon">◷</text><text>{{item.title}}</text></view><text class="status-pill">准时出摊</text></view><view class="schedule schedule-primary"><view class="schedule-main"><view class="schedule-title"><text class="dot orange"></text><text>{{item.summary}}</text></view><text class="schedule-line">{{item.content}}</text></view></view></view>
<view wx:if="{{item.type === 'schedule'}}" class="service-card"><view class="card-head"><view class="head-title"><text class="icon">◷</text><text>{{item.title}}</text></view></view><view class="schedule schedule-primary"><view class="schedule-main"><view class="schedule-title"><text class="dot orange"></text><text>{{item.summary}}</text></view><text class="schedule-line">{{item.content}}</text></view></view></view>
<view wx:if="{{item.type === 'coverage'}}" class="service-card"><view class="card-title"><text class="icon">⌁</text><text>{{item.title}}</text></view><view class="delivery-grid"><view class="delivery-item"><text class="delivery-title orange-text">服务范围</text><text>{{item.content}}</text></view></view></view>
<view wx:if="{{item.type === 'process'}}" class="service-card process-card"><view class="card-title"><text class="icon">☷</text><text>{{item.title}}</text></view><text wx:if="{{item.summary}}" class="card-sub">{{item.summary}}</text><view class="steps"><view wx:for="{{item.lines}}" wx:key="*this" class="step"><text class="step-no">{{index + 1}}</text><view><text class="step-title">步骤 {{index + 1}}</text><text>{{item}}</text></view></view></view><view class="process-foot"><text>{{item.content}}</text><button bindtap="inquire">立即咨询 <text>→</text></button></view></view>
</block>
@@ -216,6 +216,24 @@
"input": "text",
"placeholder": "例如:17:00 - 22:30 · 今日营业中"
},
{
"key": "coverageContent",
"binding": "brand.config.visualPresentation.profile.coverageContent",
"label": "取餐与配送说明",
"input": "textarea"
},
{
"key": "coverageTitle",
"binding": "brand.config.visualPresentation.profile.coverageTitle",
"label": "服务方式标题",
"input": "text"
},
{
"key": "worksEyebrow",
"binding": "brand.config.visualPresentation.home.worksEyebrow",
"label": "餐品区域小标题",
"input": "text"
},
{
"key": "worksTitle",
"binding": "brand.config.visualPresentation.home.worksTitle",
@@ -248,6 +266,13 @@
"label": "菜单页说明",
"input": "textarea",
"maxLength": 120
},
{
"key": "menuTip",
"binding": "brand.config.visualPresentation.offerings.menuTip",
"label": "菜单提示",
"help": "只填写当前实际提供的取餐、加菜或定制服务。",
"input": "textarea"
}
]
},
@@ -276,6 +301,223 @@
"label": "提交按钮文字",
"input": "text",
"placeholder": "例如:提交预订需求"
},
{
"key": "promise",
"binding": "brand.config.visualPresentation.inquiry.promise",
"label": "真实服务承诺",
"help": "仅填写能兑现的回复时间、订金和联系规则;留空则不显示。",
"input": "textarea"
}
]
},
{
"key": "dishDetail",
"title": "餐品与服务详情",
"description": "每项餐品或服务单独填写;没有内容的详情区块不会展示。",
"target": "offering",
"fields": [
{
"key": "categoryLabel",
"binding": "offering.config.categoryLabel",
"label": "餐品类别",
"input": "text"
},
{
"key": "detailHero",
"binding": "offering.config.detailHero",
"label": "详情主图",
"input": "image"
},
{
"key": "area",
"binding": "offering.config.area",
"label": "供应地点",
"input": "text"
},
{
"key": "series",
"binding": "offering.config.series",
"label": "套餐或系列说明",
"input": "text"
},
{
"key": "spaceType",
"binding": "offering.config.spaceType",
"label": "适合场景",
"input": "text"
},
{
"key": "background",
"binding": "offering.config.details.background",
"label": "餐品介绍",
"input": "textarea"
},
{
"key": "designConcept",
"binding": "offering.config.details.designConcept",
"label": "口味与分量",
"input": "textarea"
},
{
"key": "keywords",
"binding": "offering.config.keywords",
"label": "餐品特色",
"input": "list",
"itemValueKey": "value",
"itemFields": [{ "key": "value", "label": "特色" }]
},
{
"key": "crafts",
"binding": "offering.config.details.crafts",
"label": "制作方式",
"input": "list",
"itemValueKey": "value",
"itemFields": [{ "key": "value", "label": "制作说明" }]
},
{
"key": "materialsList",
"binding": "offering.config.details.materialsList",
"label": "食材与搭配",
"input": "list",
"itemFields": [
{ "key": "name", "label": "食材或搭配" },
{ "key": "spec", "label": "说明" }
]
}
]
},
{
"key": "detailCopy",
"title": "详情页说明",
"description": "解释价格、餐品内容和咨询后会怎样处理。",
"target": "brand",
"fields": [
{
"key": "priceLabel",
"binding": "brand.config.visualPresentation.detail.priceLabel",
"label": "价格说明标题",
"input": "text"
},
{
"key": "spaceLabel",
"binding": "brand.config.visualPresentation.detail.spaceLabel",
"label": "适合场景标题",
"input": "text"
},
{
"key": "backgroundTitle",
"binding": "brand.config.visualPresentation.detail.backgroundTitle",
"label": "餐品介绍标题",
"input": "text"
},
{
"key": "conceptTitle",
"binding": "brand.config.visualPresentation.detail.conceptTitle",
"label": "口味与分量标题",
"input": "text"
},
{
"key": "craftsTitle",
"binding": "brand.config.visualPresentation.detail.craftsTitle",
"label": "制作方式标题",
"input": "text"
},
{
"key": "materialsTitle",
"binding": "brand.config.visualPresentation.detail.materialsTitle",
"label": "食材与搭配标题",
"input": "text"
},
{
"key": "inquiryAction",
"binding": "brand.config.visualPresentation.detail.inquiryAction",
"label": "咨询按钮文字",
"input": "text"
},
{
"key": "inquiryHint",
"binding": "brand.config.visualPresentation.detail.inquiryHint",
"label": "咨询后的处理说明",
"help": "只写能够兑现的联系和确认方式。",
"input": "textarea"
}
]
},
{
"key": "successCopy",
"title": "提交成功页",
"description": "顾客提交后看到的确认信息与后续预期。",
"target": "brand",
"fields": [
{
"key": "eyebrow",
"binding": "brand.config.visualPresentation.success.eyebrow",
"label": "页面小标题",
"input": "text"
},
{
"key": "title",
"binding": "brand.config.visualPresentation.success.title",
"label": "确认标题",
"input": "text"
},
{
"key": "intro",
"binding": "brand.config.visualPresentation.success.intro",
"label": "后续联系说明",
"help": "若写回复时间,请确认日常能兑现。",
"input": "textarea"
},
{
"key": "recordsAction",
"binding": "brand.config.visualPresentation.success.recordsAction",
"label": "查看记录按钮",
"input": "text"
},
{
"key": "homeAction",
"binding": "brand.config.visualPresentation.success.homeAction",
"label": "返回首页按钮",
"input": "text"
}
]
},
{
"key": "recordsCopy",
"title": "咨询记录页",
"description": "顾客查看预订与咨询处理进度时看到的内容。",
"target": "brand",
"fields": [
{
"key": "title",
"binding": "brand.config.visualPresentation.records.title",
"label": "记录页标题",
"input": "text"
},
{
"key": "createAction",
"binding": "brand.config.visualPresentation.records.createAction",
"label": "新增咨询按钮",
"input": "text"
},
{
"key": "emptyTitle",
"binding": "brand.config.visualPresentation.records.emptyTitle",
"label": "暂无记录标题",
"input": "text"
},
{
"key": "emptyDescription",
"binding": "brand.config.visualPresentation.records.emptyDescription",
"label": "暂无记录说明",
"input": "textarea"
},
{
"key": "emptyAction",
"binding": "brand.config.visualPresentation.records.emptyAction",
"label": "空状态按钮",
"input": "text"
}
]
}
+5 -1
View File
@@ -25,7 +25,11 @@ test("compiler generates an isolated Acheng runtime manifest", () => {
});
const app = JSON.parse(fs.readFileSync(path.join(output, "app.json"), "utf8"));
const runtime = JSON.parse(fs.readFileSync(path.join(output, "template.runtime.json"), "utf8"));
assert.equal(app.window.navigationBarTitleText, "阿成校园餐");
assert.equal(app.window.navigationBarTitleText, "品牌首页");
assert.match(
fs.readFileSync(path.join(output, "pages/index/index.js"), "utf8"),
/setNavigationBarTitle/,
);
assert.equal(runtime.packageKey, "acheng-campus-food");
assert.equal(runtime.entrypoints.home, "pages/index/index");
assert.match(fs.readFileSync(path.join(output, "runtime-config.js"), "utf8"), /default-brand/);
+22 -1
View File
@@ -45,7 +45,14 @@ export type TemplateAdminField = {
binding: string;
label: string;
help?: string;
input: "text" | "textarea" | "phone" | "image" | "number";
input: "text" | "textarea" | "phone" | "image" | "number" | "list";
itemFields?: Array<{
key: string;
label: string;
input?: "text" | "textarea";
required?: boolean;
}>;
itemValueKey?: string;
required?: boolean;
maxLength?: number;
placeholder?: string;
@@ -70,6 +77,7 @@ export type TemplateTrustContentType = {
help?: string;
placeholder?: string;
required?: boolean;
configFields?: TemplateAdminField[];
};
export type TemplateSampleContent = {
@@ -147,6 +155,12 @@ export function validateTemplatePackageManifest(value: unknown): string[] {
errors.push(`trustContentTypes.${index}.type is required`);
if (typeof item.label !== "string" || !item.label.trim())
errors.push(`trustContentTypes.${index}.label is required`);
for (const field of item.configFields ?? []) {
if (!field.key?.trim() || !field.binding?.startsWith("trust.config."))
errors.push(`trustContentTypes.${index}.configFields binding is invalid`);
if (field.input === "list" && !field.itemFields?.length)
errors.push(`trustContentTypes.${index}.configFields list requires itemFields`);
}
}
}
}
@@ -168,6 +182,13 @@ export function validateTemplatePackageManifest(value: unknown): string[] {
for (const field of section.fields ?? []) {
if (!field?.key?.trim() || !field.binding?.trim() || !field.label?.trim())
errors.push("every admin field requires key, binding and label");
if (field.input === "list" && !field.itemFields?.length)
errors.push("list admin fields require itemFields");
if (
field.itemValueKey &&
!field.itemFields?.some((item) => item.key === field.itemValueKey)
)
errors.push("list itemValueKey must match an itemField");
}
}
}
@@ -0,0 +1,128 @@
import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import test from "node:test";
const packagesRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
const runtimeRoot = path.resolve(packagesRoot, "../apps/miniapp");
function sourceFile(templateRoot, relativePath, extension) {
const local = path.join(templateRoot, "miniapp", `${relativePath}.${extension}`);
const runtime = path.join(runtimeRoot, `${relativePath}.${extension}`);
return fs.existsSync(local) ? local : fs.existsSync(runtime) ? runtime : null;
}
function renderedFields(templateRoot, entrypoint) {
const seen = new Set();
const fields = new Set();
const heroFields = new Set();
const profileFields = new Set();
const trustFields = new Set();
function visit(relativePath) {
if (seen.has(relativePath)) return;
seen.add(relativePath);
for (const extension of ["wxml", "js"]) {
const source = sourceFile(templateRoot, relativePath, extension);
if (!source) continue;
const content = fs.readFileSync(source, "utf8");
for (const match of content.matchAll(/(?<![.\w])presentation\.([A-Za-z][A-Za-z0-9]*)/g)) {
fields.add(match[1]);
}
for (const match of content.matchAll(/(?<![.\w])hero\.([A-Za-z][A-Za-z0-9]*)/g)) {
heroFields.add(match[1]);
}
for (const match of content.matchAll(/brand\.profilePresentation\.([A-Za-z][A-Za-z0-9]*)/g)) {
profileFields.add(match[1]);
}
for (const match of content.matchAll(/trustContent\.([A-Za-z][A-Za-z0-9]*)/g)) {
trustFields.add(match[1]);
}
}
const componentConfig = sourceFile(templateRoot, relativePath, "json");
if (!componentConfig) return;
const config = JSON.parse(fs.readFileSync(componentConfig, "utf8"));
for (const component of Object.values(config.usingComponents ?? {})) {
if (typeof component === "string" && component.startsWith("/components/")) {
visit(component.slice(1));
}
}
}
visit(entrypoint);
return { fields, heroFields, profileFields, trustFields, seen };
}
const sharedOfferingBindings = [
"offering.config.categoryLabel",
"offering.config.detailHero",
"offering.config.area",
"offering.config.series",
"offering.config.spaceType",
"offering.config.keywords",
"offering.config.details.background",
"offering.config.details.designConcept",
"offering.config.details.crafts",
"offering.config.details.materialsList",
];
for (const directory of fs
.readdirSync(packagesRoot)
.filter((name) => name.startsWith("template-"))) {
const templateRoot = path.join(packagesRoot, directory);
const manifestPath = path.join(templateRoot, "template.json");
if (!fs.existsSync(manifestPath)) continue;
test(`${directory} exposes rendered content through Admin bindings`, () => {
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
const bindings = new Set(
manifest.admin.sections.flatMap((section) => section.fields.map((field) => field.binding)),
);
for (const [pageKey, entrypoint] of Object.entries(manifest.entrypoints)) {
const { fields, heroFields, profileFields, trustFields, seen } = renderedFields(
templateRoot,
entrypoint,
);
for (const field of fields) {
assert.ok(
bindings.has(`brand.config.visualPresentation.${pageKey}.${field}`),
`${manifest.packageKey}: ${pageKey}.${field} is rendered but has no Admin field`,
);
}
for (const field of heroFields) {
const binding =
field === "image" ? "brand.config.heroImage" : `brand.config.homeHero.${field}`;
assert.ok(
bindings.has(binding),
`${manifest.packageKey}: ${pageKey} hero.${field} has no Admin field`,
);
}
for (const field of profileFields) {
assert.ok(
bindings.has(`brand.config.profilePresentation.${field}`),
`${manifest.packageKey}: profilePresentation.${field} has no Admin field`,
);
}
for (const field of trustFields) {
if (field === "bio") {
assert.ok(
manifest.trustContentTypes?.some((type) => type.type === "credential"),
`${manifest.packageKey}: biography has no editable trust content type`,
);
continue;
}
assert.ok(
manifest.trustContentTypes?.some((type) =>
type.configFields?.some(
(configField) => configField.binding === `trust.config.${field}`,
),
),
`${manifest.packageKey}: trustContent.${field} has no Admin field`,
);
}
if (seen.has("components/modules/offering-detail/offering-detail")) {
for (const binding of sharedOfferingBindings) {
assert.ok(bindings.has(binding), `${manifest.packageKey}: missing ${binding}`);
}
}
}
});
}
@@ -25,3 +25,37 @@ test("template contract rejects technical or incomplete admin declarations", ()
"every admin field requires key, binding and label",
]);
});
test("template manifests declare editable material content", () => {
const linjing = JSON.parse(
fs.readFileSync(path.join(packageRoot, "template-linjing-editorial/template.json"), "utf8"),
);
const acheng = JSON.parse(
fs.readFileSync(path.join(packageRoot, "template-acheng-campus-food/template.json"), "utf8"),
);
const bindings = (manifest) =>
new Set(
manifest.admin.sections.flatMap((section) => section.fields.map((field) => field.binding)),
);
for (const binding of [
"brand.config.homeHero.title",
"brand.config.profilePresentation.coverage",
"brand.config.profilePresentation.warranty",
"offering.config.area",
"offering.config.details.designConcept",
"brand.config.visualPresentation.offerings.closingText",
])
assert.ok(bindings(linjing).has(binding), binding);
for (const binding of [
"brand.config.visualPresentation.profile.coverageContent",
"brand.config.visualPresentation.offerings.menuTip",
"brand.config.visualPresentation.inquiry.promise",
])
assert.ok(bindings(acheng).has(binding), binding);
assert.deepEqual(
linjing.trustContentTypes
.find((item) => item.type === "credential")
.configFields.map((field) => field.key),
["stats", "pillars", "serviceFlow"],
);
});
@@ -1 +1 @@
<view class="page linjing-works"><view class="works-intro"><text class="eyebrow">{{presentation.worksEyebrow || 'SELECTED WORKS'}}</text><text class="title">{{presentation.worksTitle || '案例与体系'}}</text><text class="subtitle">{{presentation.subtitle || '从建筑入口到室内秩序,呈现每一扇门的完整构造。'}}</text></view><view class="category-line"><text wx:for="{{categories}}" wx:key="*this" class="category-tab {{activeCategory === item ? 'active' : ''}}" data-category="{{item}}" bindtap="chooseCategory">{{item}}</text></view><view wx:if="{{!visibleOfferings.length}}" class="empty">暂无该类别案例</view><view class="works-list"><view wx:for="{{visibleOfferings}}" wx:key="id" class="work" data-id="{{item.id}}" bindtap="open"><image src="{{item.image || item.coverUrl}}" mode="aspectFill"/><view class="work-copy"><text class="category">{{item.category || item.presentation.categoryLabel}}</text><text class="name">{{item.name}}</text><text class="series">{{item.series || item.summary}}</text><view class="meta"><text>{{item.area || 'PRIVATE RESIDENCE'}}</text><text>查看项目 →</text></view></view></view></view><view class="closing"><text>每一套门系统,都是建筑秩序的一部分。</text><text class="more" bindtap="more">预约一次私宅门系统沟通 →</text></view></view>
<view class="page linjing-works"><view class="works-intro"><text class="eyebrow">{{presentation.worksEyebrow || 'SELECTED WORKS'}}</text><text class="title">{{presentation.worksTitle || '案例与体系'}}</text><text class="subtitle">{{presentation.subtitle}}</text></view><view class="category-line"><text wx:for="{{categories}}" wx:key="*this" class="category-tab {{activeCategory === item ? 'active' : ''}}" data-category="{{item}}" bindtap="chooseCategory">{{item}}</text></view><view wx:if="{{!visibleOfferings.length}}" class="empty">暂无该类别案例</view><view class="works-list"><view wx:for="{{visibleOfferings}}" wx:key="id" class="work" data-id="{{item.id}}" bindtap="open"><image src="{{item.image || item.coverUrl}}" mode="aspectFill"/><view class="work-copy"><text class="category">{{item.category || item.presentation.categoryLabel}}</text><text class="name">{{item.name}}</text><text class="series">{{item.series || item.summary}}</text><view class="meta"><text wx:if="{{item.area}}">{{item.area}}</text><text>查看项目 →</text></view></view></view></view><view wx:if="{{presentation.closingText || presentation.closingAction}}" class="closing"><text>{{presentation.closingText}}</text><text wx:if="{{presentation.closingAction}}" class="more" bindtap="more">{{presentation.closingAction}} →</text></view></view>
@@ -17,7 +17,13 @@ Page({
brand.homeHero && typeof brand.homeHero === "object" ? brand.homeHero : {};
this.setData({
brand,
trustContent: workspace.trustPresentation || {},
trustContent: {
...(workspace.trustPresentation || {}),
bio:
workspace.trustPresentation?.bio ||
(workspace.trustItems || []).find((item) => item.type === "credential")?.content ||
"",
},
offerings,
hero: {
...this.data.hero,
@@ -26,6 +32,7 @@ Page({
title: (offerings[0] && offerings[0].name) || brand.name,
slogan: brand.description || "",
...configuredHero,
image: brand.heroImage || "",
},
});
wx.setNavigationBarTitle({ title: brand.name || "个人品牌" });
@@ -199,17 +199,163 @@
"label": "信任介绍标题",
"input": "text"
},
{
"key": "proofEyebrow",
"binding": "brand.config.visualPresentation.home.proofEyebrow",
"label": "信任介绍小标题",
"input": "text"
},
{
"key": "manifestoEyebrow",
"binding": "brand.config.visualPresentation.home.manifestoEyebrow",
"label": "品牌主张小标题",
"input": "text"
},
{
"key": "manifestoTitle",
"binding": "brand.config.visualPresentation.home.manifestoTitle",
"label": "品牌主张",
"input": "text"
},
{
"key": "worksEyebrow",
"binding": "brand.config.visualPresentation.home.worksEyebrow",
"label": "代表案例小标题",
"input": "text"
},
{
"key": "worksTitle",
"binding": "brand.config.visualPresentation.home.worksTitle",
"label": "代表案例标题",
"input": "text"
},
{
"key": "worksAction",
"binding": "brand.config.visualPresentation.home.worksAction",
"label": "查看案例入口",
"input": "text"
},
{
"key": "flowEyebrow",
"binding": "brand.config.visualPresentation.home.flowEyebrow",
"label": "合作流程小标题",
"input": "text"
},
{
"key": "flowTitle",
"binding": "brand.config.visualPresentation.home.flowTitle",
"label": "项目流程标题",
"input": "text"
},
{
"key": "heroTitle",
"binding": "brand.config.homeHero.title",
"label": "首页主标题",
"input": "text"
},
{
"key": "heroEyebrow",
"binding": "brand.config.homeHero.eyebrow",
"label": "主图项目标注",
"input": "text"
},
{
"key": "heroDescription",
"binding": "brand.config.homeHero.slogan",
"label": "首页主图说明",
"input": "textarea"
},
{
"key": "heroAction",
"binding": "brand.config.homeHero.cta",
"label": "主图行动文字",
"input": "text"
}
]
},
{
"key": "profileDetails",
"title": "服务区域与履约说明",
"description": "在主理人与我页面说明可服务的地区和真实履约承诺。",
"target": "brand",
"fields": [
{
"key": "coverage",
"binding": "brand.config.profilePresentation.coverage",
"label": "服务区域",
"input": "list",
"itemFields": [
{ "key": "title", "label": "区域名称" },
{ "key": "content", "label": "服务说明", "input": "textarea" }
]
},
{
"key": "warranty",
"binding": "brand.config.profilePresentation.warranty",
"label": "履约与维护说明",
"input": "list",
"itemValueKey": "value",
"itemFields": [{ "key": "value", "label": "承诺内容", "input": "textarea" }]
},
{
"key": "recordsTitle",
"binding": "brand.config.visualPresentation.profile.recordsTitle",
"label": "咨询记录入口标题",
"input": "text"
},
{
"key": "recordsSubtitle",
"binding": "brand.config.visualPresentation.profile.recordsSubtitle",
"label": "咨询记录入口说明",
"input": "textarea"
},
{
"key": "coverageTitle",
"binding": "brand.config.visualPresentation.profile.coverageTitle",
"label": "服务区域标题",
"input": "text"
},
{
"key": "warrantyTitle",
"binding": "brand.config.visualPresentation.profile.warrantyTitle",
"label": "履约说明标题",
"input": "text"
},
{
"key": "phoneLabel",
"binding": "brand.config.visualPresentation.profile.phoneLabel",
"label": "电话标签",
"input": "text"
},
{
"key": "wechatLabel",
"binding": "brand.config.visualPresentation.profile.wechatLabel",
"label": "微信标签",
"input": "text"
},
{
"key": "addressLabel",
"binding": "brand.config.visualPresentation.profile.addressLabel",
"label": "地址标签",
"input": "text"
},
{
"key": "callAction",
"binding": "brand.config.visualPresentation.profile.callAction",
"label": "拨打电话按钮",
"input": "text"
},
{
"key": "copyAction",
"binding": "brand.config.visualPresentation.profile.copyAction",
"label": "复制微信按钮",
"input": "text"
},
{
"key": "recordsCountUnit",
"binding": "brand.config.visualPresentation.profile.recordsCountUnit",
"label": "记录数量单位",
"input": "text"
}
]
},
@@ -237,6 +383,18 @@
"label": "案例页说明",
"input": "textarea",
"maxLength": 140
},
{
"key": "closingText",
"binding": "brand.config.visualPresentation.offerings.closingText",
"label": "案例页结语",
"input": "textarea"
},
{
"key": "closingAction",
"binding": "brand.config.visualPresentation.offerings.closingAction",
"label": "案例页咨询入口",
"input": "text"
}
]
},
@@ -264,6 +422,228 @@
"binding": "brand.config.visualPresentation.inquiry.submitLabel",
"label": "提交按钮文字",
"input": "text"
},
{
"key": "eyebrow",
"binding": "brand.config.visualPresentation.inquiry.eyebrow",
"label": "咨询页小标题",
"input": "text"
},
{
"key": "note",
"binding": "brand.config.visualPresentation.inquiry.note",
"label": "咨询前提示",
"input": "textarea"
}
]
},
{
"key": "projectDetail",
"title": "案例详情",
"description": "以下内容分别填写在每个案例中,空白内容不会展示。",
"target": "offering",
"fields": [
{
"key": "categoryLabel",
"binding": "offering.config.categoryLabel",
"label": "案例类别",
"input": "text"
},
{
"key": "detailHero",
"binding": "offering.config.detailHero",
"label": "详情主图",
"input": "image"
},
{
"key": "area",
"binding": "offering.config.area",
"label": "项目地点",
"input": "text"
},
{
"key": "series",
"binding": "offering.config.series",
"label": "产品系列",
"input": "text"
},
{
"key": "spaceType",
"binding": "offering.config.spaceType",
"label": "适用空间",
"input": "text"
},
{
"key": "background",
"binding": "offering.config.details.background",
"label": "项目背景",
"input": "textarea"
},
{
"key": "designConcept",
"binding": "offering.config.details.designConcept",
"label": "设计理念",
"input": "textarea"
},
{
"key": "keywords",
"binding": "offering.config.keywords",
"label": "项目关键词",
"input": "list",
"itemValueKey": "value",
"itemFields": [{ "key": "value", "label": "关键词" }]
},
{
"key": "crafts",
"binding": "offering.config.details.crafts",
"label": "工艺要点",
"input": "list",
"itemValueKey": "value",
"itemFields": [{ "key": "value", "label": "工艺说明" }]
},
{
"key": "materialsList",
"binding": "offering.config.details.materialsList",
"label": "材料说明",
"input": "list",
"itemFields": [
{ "key": "name", "label": "材料名称" },
{ "key": "spec", "label": "规格说明" }
]
}
]
},
{
"key": "detailCopy",
"title": "详情页说明",
"description": "说明案例内容、价格与咨询后的真实处理方式。",
"target": "brand",
"fields": [
{
"key": "priceLabel",
"binding": "brand.config.visualPresentation.detail.priceLabel",
"label": "价格说明标题",
"input": "text"
},
{
"key": "spaceLabel",
"binding": "brand.config.visualPresentation.detail.spaceLabel",
"label": "适用空间标题",
"input": "text"
},
{
"key": "backgroundTitle",
"binding": "brand.config.visualPresentation.detail.backgroundTitle",
"label": "项目背景标题",
"input": "text"
},
{
"key": "conceptTitle",
"binding": "brand.config.visualPresentation.detail.conceptTitle",
"label": "设计理念标题",
"input": "text"
},
{
"key": "craftsTitle",
"binding": "brand.config.visualPresentation.detail.craftsTitle",
"label": "工艺要点标题",
"input": "text"
},
{
"key": "materialsTitle",
"binding": "brand.config.visualPresentation.detail.materialsTitle",
"label": "材料说明标题",
"input": "text"
},
{
"key": "inquiryAction",
"binding": "brand.config.visualPresentation.detail.inquiryAction",
"label": "咨询按钮文字",
"input": "text"
},
{
"key": "inquiryHint",
"binding": "brand.config.visualPresentation.detail.inquiryHint",
"label": "咨询后的处理说明",
"help": "只填写能兑现的服务安排。",
"input": "textarea"
}
]
},
{
"key": "successCopy",
"title": "提交成功页",
"description": "访客提交后看到的确认信息与后续预期。",
"target": "brand",
"fields": [
{
"key": "eyebrow",
"binding": "brand.config.visualPresentation.success.eyebrow",
"label": "页面小标题",
"input": "text"
},
{
"key": "title",
"binding": "brand.config.visualPresentation.success.title",
"label": "确认标题",
"input": "text"
},
{
"key": "intro",
"binding": "brand.config.visualPresentation.success.intro",
"label": "后续联系说明",
"help": "回复时间必须与实际承诺一致。",
"input": "textarea"
},
{
"key": "recordsAction",
"binding": "brand.config.visualPresentation.success.recordsAction",
"label": "查看记录按钮",
"input": "text"
},
{
"key": "homeAction",
"binding": "brand.config.visualPresentation.success.homeAction",
"label": "返回首页按钮",
"input": "text"
}
]
},
{
"key": "recordsCopy",
"title": "咨询记录页",
"description": "访客查看咨询状态时看到的内容。",
"target": "brand",
"fields": [
{
"key": "title",
"binding": "brand.config.visualPresentation.records.title",
"label": "记录页标题",
"input": "text"
},
{
"key": "createAction",
"binding": "brand.config.visualPresentation.records.createAction",
"label": "新增咨询按钮",
"input": "text"
},
{
"key": "emptyTitle",
"binding": "brand.config.visualPresentation.records.emptyTitle",
"label": "暂无记录标题",
"input": "text"
},
{
"key": "emptyDescription",
"binding": "brand.config.visualPresentation.records.emptyDescription",
"label": "暂无记录说明",
"input": "textarea"
},
{
"key": "emptyAction",
"binding": "brand.config.visualPresentation.records.emptyAction",
"label": "空状态按钮",
"input": "text"
}
]
}
@@ -291,6 +671,40 @@
"type": "credential",
"label": "专业资历与方法",
"help": "填写经验、资质、专业标准或工作方法。",
"configFields": [
{
"key": "stats",
"binding": "trust.config.stats",
"label": "信任数据",
"input": "list",
"itemFields": [
{ "key": "value", "label": "数字或成果" },
{ "key": "label", "label": "说明" },
{ "key": "sub", "label": "补充说明", "required": false }
]
},
{
"key": "pillars",
"binding": "trust.config.pillars",
"label": "专业方法",
"input": "list",
"itemFields": [
{ "key": "title", "label": "方法名称" },
{ "key": "desc", "label": "方法说明" }
]
},
{
"key": "serviceFlow",
"binding": "trust.config.serviceFlow",
"label": "合作流程",
"input": "list",
"itemFields": [
{ "key": "step", "label": "步骤编号" },
{ "key": "name", "label": "步骤名称" },
{ "key": "desc", "label": "步骤说明" }
]
}
],
"required": true
},
{ "type": "case", "label": "项目案例与客户反馈", "help": "填写代表性项目、成果或客户评价。" },