feat: 增加可视化模板页面编辑器

This commit is contained in:
que01 committed 2026-10-08 18:00:36 +08:00
1 parent 9d2038cc93
commit c5af790554
24 files changed
+773 -129

No files matched your search

+16 -3
View File
@@ -38,10 +38,23 @@ export async function request<T>(
}
export async function loadWorkspace() {
const data = await request<RuntimeWorkspace>("/public/workspace");
if (data.publication?.status !== "published") throw new Error("品牌尚未发布");
if (data.brand.visualTemplateKey !== TEMPLATE_KEY)
const editorPreview =
process.env.TARO_ENV === "h5" &&
new URLSearchParams(window.location.search).get("editor") === "1";
if (!editorPreview && data.publication?.status !== "published") throw new Error("品牌尚未发布");
if (!editorPreview && data.brand.visualTemplateKey !== TEMPLATE_KEY)
throw new Error("该品牌使用其他模板,请选择匹配的模板预览地址");
return data;
return {
...data,
brand: data.brand ?? {},
templateData: data.templateData ?? {},
offerings: data.offerings ?? [],
inquiryForms: data.inquiryForms ?? [],
trustItems: data.trustItems ?? [],
trustPresentation: data.trustPresentation ?? {},
capabilities: data.capabilities ?? [],
theme: data.theme ?? { colors: {} },
};
}
export async function ensureSession() {
if (hasSession()) return;