)[key],
- ),
- );
- const client = createApiClient();
- if (source === "offering")
- await client.updateAdminOffering(record.id, { ...changed, config });
- else await client.updateAdminTrustContent(record.id, { ...changed, config });
- },
- onSuccess: () => {
- message.success("内容已保存为草稿,发布后访客才会看到更新");
- onSaved();
- void queryClient.invalidateQueries({
- queryKey: [source === "offering" ? "admin-offerings" : "trust-content"],
- });
- void queryClient.invalidateQueries({ queryKey: ["admin-workspace"] });
- void queryClient.invalidateQueries({ queryKey: ["admin-preview-workspace"] });
- },
- });
- return (
-
- );
-}
-
function pageTitle(page: string): string {
return (
(
diff --git a/apps/admin/src/features/services/ServicesPage.tsx b/apps/admin/src/features/services/ServicesPage.tsx
index 36e4fae..6353dbf 100644
--- a/apps/admin/src/features/services/ServicesPage.tsx
+++ b/apps/admin/src/features/services/ServicesPage.tsx
@@ -12,12 +12,16 @@ import {
message,
} from "antd";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
-import type { Offering, TemplateAdminField } from "@personal-brand/api-client";
-import { useState } from "react";
+import type {
+ Offering,
+ TemplateAdminField,
+ TemplateAdminSection,
+} from "@personal-brand/api-client";
+import { useMemo, 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 { RecordContentFields } from "../../components/RecordContentEditor.js";
import {
applyPresentationValues,
presentationFieldName,
@@ -46,6 +50,17 @@ export function ServicesPage() {
.flatMap((section) =>
section.fields.filter((field) => field.binding.startsWith("offering.config.")),
);
+ const templateFieldSection = useMemo(
+ () => ({
+ key: "offering",
+ title: "模板内容",
+ description: "",
+ page: "detail",
+ target: "offering",
+ fields: templateFields,
+ }),
+ [templateFields],
+ );
const offeringPageLabel =
workspace.data?.templateContent?.navigation.find((item) => item.page === "offerings")?.label ??
"业务展示页";
@@ -299,30 +314,14 @@ export function ServicesPage() {
]}
/>
- {templateFields.map((field) =>
- field.input === "list" ? (
-
- ) : (
-
- {field.input === "textarea" ? (
-
- ) : field.input === "image" ? (
-
- ) : (
-
- )}
-
- ),
- )}
+ {templateFields.length ? (
+ <>
+
+ 以下模板字段与小程序页面编辑的是同一份业务数据;可在此集中修改,也可到页面编辑中点选对应卡片。
+
+
+ >
+ ) : null}