From 0ec961e210c02843f8184992d483fc8de2b7c2b1 Mon Sep 17 00:00:00 2001 From: 2910410219 <2910410219@qq.com> Date: Thu, 27 Aug 2026 11:54:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E8=B4=B4=E7=89=87?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E7=BB=9F=E4=B8=80=E8=B5=B0CDN=E5=8F=82?= =?UTF-8?q?=E8=80=83=EF=BC=88=E9=BB=98=E8=AE=A4=E6=A8=A1=E6=9D=BF=E4=B8=8E?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E3=80=81=E7=A7=BB=E9=99=A4=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=96=87=E4=BB=B6=EF=BC=89=E3=80=81=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E6=96=B0=E5=BB=BA=E4=BC=9A=E8=AF=9D=E9=A6=96=E6=AC=A1?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E5=90=8E=E8=B4=B4=E7=89=87=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=9B=9E=E6=98=BE=E7=A9=BA=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude --- public/template_example.html | 213 ------------------ .../patchTemplate/PatchTemplateEditor.vue | 28 ++- src/views/home/index.vue | 15 ++ 3 files changed, 34 insertions(+), 222 deletions(-) delete mode 100644 public/template_example.html 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;