feat: 增加模板组合预览接口
This commit is contained in:
1 parent
4c9f9a05d0
commit
6c049b8672
3 files changed
+49
No files matched your search
@@ -109,6 +109,30 @@ export class PublicTemplateController {
|
||||
list(): unknown {
|
||||
return { industries: Object.values(brandTemplates), visuals: Object.values(visualTemplates) };
|
||||
}
|
||||
@Get("preview")
|
||||
preview(
|
||||
@Query("industry") industry = "personal",
|
||||
@Query("visual") visual = "linjing-editorial",
|
||||
): unknown {
|
||||
const industryTemplate = getBrandTemplate(industry);
|
||||
const visualTemplate = getVisualTemplate(visual) ?? getVisualTemplate("linjing-editorial");
|
||||
if (!industryTemplate || !visualTemplate) throw new BadRequestException("模板组合不存在");
|
||||
return {
|
||||
industry: industryTemplate,
|
||||
visual: visualTemplate,
|
||||
runtime: {
|
||||
schemaVersion: "1.0.0",
|
||||
modules: industryTemplate.modules.map((module) => ({
|
||||
key: module.key,
|
||||
type: module.type,
|
||||
title: module.title,
|
||||
variant: visualTemplate.variants[module.type] ?? "default",
|
||||
})),
|
||||
capabilities: resolveCapabilities(industryTemplate.capabilities),
|
||||
theme: visualTemplate.theme,
|
||||
},
|
||||
};
|
||||
}
|
||||
@Get(":key")
|
||||
get(@Param("key") key: string): unknown {
|
||||
const template = getBrandTemplate(key);
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
- [x] 模板中心行业 / 视觉目录由后端注册表接口驱动。
|
||||
- [x] 行业模板安装增加版本、描述和能力依赖确认。
|
||||
- [x] Admin 展示视觉模板主题色、适用场景和模块变体预览卡片。
|
||||
- [x] 增加行业模板与视觉模板的安装前组合预览接口,不写入品牌配置。
|
||||
- [ ] Phase 4:Capability Plugin。
|
||||
- [ ] Phase 5:林境门作与第二行业双模板验证。
|
||||
- [ ] Phase 6:Stitch 到 Manifest 的转换流水线。
|
||||
|
||||
@@ -405,6 +405,30 @@ export class ApiClient {
|
||||
}> {
|
||||
return this.request("/public/templates");
|
||||
}
|
||||
previewPublicTemplateCombination(
|
||||
industry: string,
|
||||
visual: string,
|
||||
): Promise<{
|
||||
industry: BrandTemplateDefinition;
|
||||
visual: {
|
||||
key: string;
|
||||
version: string;
|
||||
name: string;
|
||||
description: string;
|
||||
variants: Record<string, string>;
|
||||
theme: { colors: Record<string, string> };
|
||||
};
|
||||
runtime: {
|
||||
schemaVersion: string;
|
||||
modules: Array<{ key: string; type: string; title: string; variant: string }>;
|
||||
capabilities: Array<{ key: string; version: string }>;
|
||||
theme: unknown;
|
||||
};
|
||||
}> {
|
||||
return this.request(
|
||||
`/public/templates/preview?industry=${encodeURIComponent(industry)}&visual=${encodeURIComponent(visual)}`,
|
||||
);
|
||||
}
|
||||
getPublicOffering(id: string): Promise<Offering> {
|
||||
return this.request(`/public/offerings/${encodeURIComponent(id)}`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user