From e8ccb4280b2b3f1ac27b449f6b7e087fffc9acbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=9D=E5=B0=98?= <237809796@qq.com> Date: Mon, 28 Sep 2026 09:33:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96:=20PDF=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E5=90=8E=E6=89=93=E5=BC=80=E6=89=80=E5=9C=A8?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E9=80=89=E4=B8=AD=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 导出落盘后explorer选中PDF,不再只靠一闪而过的弹窗 - 成功文案明确指向导出位置 - explorer用WINDIR绝对路径,不依赖PATH --- .../components/FileSystem/components/FileEditorPanel.vue | 3 ++- internal/api/pdf_api.go | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/FileSystem/components/FileEditorPanel.vue b/frontend/src/components/FileSystem/components/FileEditorPanel.vue index 8b91c9e..ff64e29 100644 --- a/frontend/src/components/FileSystem/components/FileEditorPanel.vue +++ b/frontend/src/components/FileSystem/components/FileEditorPanel.vue @@ -929,7 +929,8 @@ const handleExportHtmlPDF = async () => { try { const res = await ExportHtmlFileToPDF(srcPath, baseName) if (res?.success) { - Message.success(`PDF 已导出到: ${res.path}`) + // 后端导出成功已自动打开资源管理器选中文件,弹窗只做明确指向,不依赖用户记住路径 + Message.success('PDF 已导出,已在桌面打开所在位置') } else { Message.error(res?.message || 'PDF 导出失败') } diff --git a/internal/api/pdf_api.go b/internal/api/pdf_api.go index 201c50d..2b85bce 100644 --- a/internal/api/pdf_api.go +++ b/internal/api/pdf_api.go @@ -451,6 +451,15 @@ func (api *PdfAPI) ExportHtmlFileToPDF(srcPath string, saveName string) (resp *P return nil, fmt.Errorf("获取文件信息失败: %v", err) } + // 成功弹窗几秒即逝用户难感知产物位置,改用资源管理器选中 PDF 明示落盘位置;失败静默不影响导出结果 + // 用户 PATH 无 C:\Windows 根目录,explorer 走 LookPath 解析不到,必须用 WINDIR 拼绝对路径 + if common.IsWindows() { + exePath := filepath.Join(os.Getenv("WINDIR"), "explorer.exe") + if selectErr := exec.Command(exePath, "/select,", savePath).Start(); selectErr != nil { + appendExportLog(fmt.Sprintf("ExportHtmlFileToPDF explorer select error=%s", selectErr.Error())) + } + } + return &PdfExportResponse{ Success: true, Message: "PDF生成成功",