From 0d98d2389288559749b6cbd352ad75c48085d3ee Mon Sep 17 00:00:00 2001 From: que01 Date: Tue, 22 Sep 2026 23:41:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=A9=E6=A8=A1=E6=9D=BF=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E7=94=B1=E6=B3=A8=E5=86=8C=E8=A1=A8=E9=A9=B1=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/features/workspace/WorkspacePage.tsx | 19 +++++++++++++------ apps/api/src/main.ts | 12 +++++++++++- docs/template-runtime-progress.md | 1 + packages/api-client/src/index.ts | 13 +++++++++++++ 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/apps/admin/src/features/workspace/WorkspacePage.tsx b/apps/admin/src/features/workspace/WorkspacePage.tsx index c7c5ca6..dad9007 100644 --- a/apps/admin/src/features/workspace/WorkspacePage.tsx +++ b/apps/admin/src/features/workspace/WorkspacePage.tsx @@ -39,6 +39,10 @@ export function WorkspacePage() { queryKey: ["public-runtime-workspace"], queryFn: () => client.getPublicWorkspace(), }); + const templateCatalog = useQuery({ + queryKey: ["template-catalog"], + queryFn: () => client.listPublicTemplates(), + }); const visualTemplate = useMutation({ mutationFn: (key: string) => client.updateAdminBrand({ @@ -250,12 +254,15 @@ export function WorkspacePage() { title="行业模板" extra={ - - + {(templateCatalog.data?.industries ?? []).map((item) => ( + + ))} } > diff --git a/apps/api/src/main.ts b/apps/api/src/main.ts index 37aeb17..fb7d032 100644 --- a/apps/api/src/main.ts +++ b/apps/api/src/main.ts @@ -39,7 +39,13 @@ import type { TransformFnParams } from "class-transformer"; import { IsBoolean, IsEnum, IsOptional, IsString } from "class-validator"; import { readIdentity, signIdentity } from "./auth.js"; import { ApiExceptionFilter, RequestIdMiddleware } from "./http.js"; -import { getBrandTemplate, getVisualTemplate, resolveCapabilities } from "@personal-brand/config"; +import { + brandTemplates, + getBrandTemplate, + getVisualTemplate, + resolveCapabilities, + visualTemplates, +} from "@personal-brand/config"; import { AdminWorkspaceController } from "./admin-workspace.controller.js"; import { TemplateWorkspaceService } from "./template-workspace.service.js"; import type { @@ -99,6 +105,10 @@ export class PublicTrustContentController { @Controller("public/templates") export class PublicTemplateController { + @Get() + list(): unknown { + return { industries: Object.values(brandTemplates), visuals: Object.values(visualTemplates) }; + } @Get(":key") get(@Param("key") key: string): unknown { const template = getBrandTemplate(key); diff --git a/docs/template-runtime-progress.md b/docs/template-runtime-progress.md index 9a41720..4fd25a3 100644 --- a/docs/template-runtime-progress.md +++ b/docs/template-runtime-progress.md @@ -49,6 +49,7 @@ - [x] 后台视觉模板切换增加确认和差异说明,避免误操作覆盖业务内容。 - [x] 视觉模板切换记录历史快照,并提供后台历史查询接口。 - [x] 后台展示视觉模板历史并支持安全回滚。 +- [x] 模板中心行业 / 视觉目录由后端注册表接口驱动。 - [ ] Phase 4:Capability Plugin。 - [ ] Phase 5:林境门作与第二行业双模板验证。 - [ ] Phase 6:Stitch 到 Manifest 的转换流水线。 diff --git a/packages/api-client/src/index.ts b/packages/api-client/src/index.ts index f056a27..57359fa 100644 --- a/packages/api-client/src/index.ts +++ b/packages/api-client/src/index.ts @@ -392,6 +392,19 @@ export class ApiClient { getPublicTemplate(key: "personal" | "food"): Promise { return this.request(`/public/templates/${key}`); } + listPublicTemplates(): Promise<{ + industries: BrandTemplateDefinition[]; + visuals: Array<{ + key: string; + version: string; + name: string; + description: string; + variants: Record; + theme: unknown; + }>; + }> { + return this.request("/public/templates"); + } getPublicOffering(id: string): Promise { return this.request(`/public/offerings/${encodeURIComponent(id)}`); }