diff --git a/public/template_example.html b/public/template_example.html
deleted file mode 100644
index fcbeed4..0000000
--- a/public/template_example.html
+++ /dev/null
@@ -1,213 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
标题文字
-
-
-
-
-
-

-
-
-
-
-
产品卖点描述
-
-
-
-
-
-
-
- 免责声明文字
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/components/patchTemplate/PatchTemplateEditor.vue b/src/components/patchTemplate/PatchTemplateEditor.vue
index 5cb1723..60f8131 100644
--- a/src/components/patchTemplate/PatchTemplateEditor.vue
+++ b/src/components/patchTemplate/PatchTemplateEditor.vue
@@ -166,7 +166,7 @@ function nextImageKey(template: PatchTemplate): string | null {
return null;
}
-const DEFAULT_TEMPLATE_URL = 'https://cdn.redpowerfuture.com/tenantid-1/template_example1.html';
+const DEFAULT_TEMPLATE_URL = 'https://cdn.redpowerfuture.com/tenantid-1/vertical_template_example.html';
const props = defineProps<{
modelValue: PatchTemplate[];
@@ -290,14 +290,24 @@ const handleImageUpload = async (templateIndex: number, imgIdx: number, file: an
}
};
-// 下载参考模板文件
-const handleDownload = (_e?: Event) => {
- const a = document.createElement('a');
- a.href = '/template_example.html';
- a.download = 'template_example.html';
- document.body.appendChild(a);
- a.click();
- document.body.removeChild(a);
+// 下载参考模板文件:统一走 CDN,转 blob 触发下载(避免跨域 直接打开页面)
+const handleDownload = async (_e?: Event) => {
+ try {
+ const res = await fetch(DEFAULT_TEMPLATE_URL);
+ if (!res.ok) throw new Error('参考模板获取失败');
+ const blob = await res.blob();
+ const fileName = decodeURIComponent(DEFAULT_TEMPLATE_URL.split('/').pop() || 'vertical_template_example.html');
+ const blobUrl = URL.createObjectURL(blob);
+ const a = document.createElement('a');
+ a.href = blobUrl;
+ a.download = fileName;
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ URL.revokeObjectURL(blobUrl);
+ } catch (error: any) {
+ ElMessage.error(error?.message || '参考模板下载失败');
+ }
};
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 702476e..741298f 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -1234,6 +1234,17 @@ const snapshotFormValuesToMsg = (msg: ChatMessage, formValues: Record {
+ const nodes = msg.form?.nodeInputParams;
+ if (!Array.isArray(nodes)) return;
+ nodes.forEach((n: any) => {
+ if (n.patchLayout === true) n.templates = templates;
+ });
+};
+
const startWorkflowFromCard = async (
msg: ChatMessage,
payload: { formValues: Record; formFileNames: Record; templates?: any[] }
@@ -1254,6 +1265,10 @@ const startWorkflowFromCard = async (
// 会话认领(virtual→UUID 触发 MainContent 重建)/ 历史回显重挂载时能从消息对象恢复已填值,
// 避免执行后表单被清空
snapshotFormValuesToMsg(msg, payload.formValues);
+ // 贴片模板同样写回消息对象 patchLayout 节点(保持与后端执行副本一致),重建/重挂载后能恢复回显
+ if (Array.isArray(payload.templates)) {
+ snapshotTemplatesToMsg(msg, payload.templates);
+ }
// 标记本轮发送中:工作流执行期间 InputBar 显示停止按钮(isGenerating 依赖 sendingSessions)
sendingSessions[sid] = true;