refactor: 统一模板契约并修复预览版本

This commit is contained in:
que01 committed 2026-10-18 17:09:09 +08:00
1 parent cd2992c00a
commit 50b87e48de
56 files changed
+7849 -5756

No files matched your search

@@ -17,11 +17,7 @@ function pageContent({ workspace, page }) {
}
export function resolveTemplateRenderer(workspace) {
const config = workspace?.brand?.config;
const key =
config && typeof config === "object" && !Array.isArray(config)
? config.visualTemplateKey
: undefined;
const key = workspace?.visualTemplate?.key;
if (typeof key !== "string") return null;
if (resolvedRenderers.has(key)) return resolvedRenderers.get(key);
const suffix = `/template-${key}/taro/index.tsx`;
@@ -111,8 +111,6 @@ export function useBrandSaveMutation({
return useMutation({
mutationFn: (values: PresentationValues) => {
const nextConfig = applyPresentationValues(config, sections, values);
const contentConfig = { ...nextConfig };
delete contentConfig.visualTemplateKey;
const standard = applyStandardBrandValues(
brand as unknown as Record<string, unknown>,
sections,
@@ -124,7 +122,7 @@ export function useBrandSaveMutation({
key !== "config" && value !== (brand as unknown as Record<string, unknown>)[key],
),
);
return createApiClient().updateAdminBrand({ ...changed, config: contentConfig });
return createApiClient().updateAdminBrand({ ...changed, config: nextConfig });
},
onSuccess: () => {
onSaved();