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生成成功",