diff --git a/大庆普济医院小程序/pages/test/test.vue b/大庆普济医院小程序/pages/test/test.vue
index eb31e0e..ef1d213 100644
--- a/大庆普济医院小程序/pages/test/test.vue
+++ b/大庆普济医院小程序/pages/test/test.vue
@@ -3,8 +3,9 @@
正在加载请稍后...
+
文档打开后
- 点击右上角按钮,然后选择“保存到手机”即可下载
+ 点击右上角按钮,可下载或转发保存
我知道了,打开文档
@@ -35,6 +36,19 @@
success: function(res) {
downLoadOk.value = true
filePath.value = res.tempFilePath;
+ const newFilePath = `${wx.env.USER_DATA_PATH}/${e.url.split('/').pop()}`;
+ uni.saveFile({
+ tempFilePath:res.tempFilePath, // 临时文件路径
+ filePath: newFilePath, // 新的文件路径
+ success: (saveResult) => {
+ console.log("文件保存成功,新路径为:", saveResult.savedFilePath);
+ filePath.value= saveResult.savedFilePath
+ },
+ fail: (saveErr) => {
+ console.error("文件保存失败:", saveErr);
+ reject(saveErr);
+ }
+ });
},
});
@@ -44,11 +58,12 @@
uni.openDocument({
filePath: filePath.value,
showMenu: true,
+ fileType:"pdf",
success: function(res) {
console.log("打开文档成功");
- wx.navigateBack({
- delta: 1
- })
+ // wx.navigateBack({
+ // delta: 1
+ // })
},
});
}