From 1e4cf5a9711755051d8a3d8ce51c899d815aed01 Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Wed, 6 Aug 2025 17:32:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD):=20?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=88=90=E5=8A=9F=E5=90=8E=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=89=93=E5=BC=80=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加文件下载成功后自动打开功能,提升用户体验。若打开失败则显示提示信息引导用户手动查看。 --- pages_order/work/postConsult.vue | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pages_order/work/postConsult.vue b/pages_order/work/postConsult.vue index 190ce01..2d10ada 100644 --- a/pages_order/work/postConsult.vue +++ b/pages_order/work/postConsult.vue @@ -153,11 +153,28 @@ if (res.statusCode === 200) { uni.saveFile({ tempFilePath: res.tempFilePath, - success: () => { + success: (saveRes) => { uni.showToast({ title: '下载成功', icon: 'success' }) + // 保存成功后直接打开文件 + setTimeout(() => { + uni.openDocument({ + filePath: saveRes.savedFilePath, + success: () => { + console.log('文件打开成功') + }, + fail: (err) => { + console.log('文件打开失败', err) + uni.showToast({ + title: '文件已保存,请在文件管理器中查看', + icon: 'none', + duration: 3000 + }) + } + }) + }, 1000) }, fail: () => { uni.showToast({