报告下载问题

main
yanzai 5 months ago
parent 65653aee0c
commit 898a540953

@ -3,8 +3,9 @@
<view v-if="downLoadOk==false" class="loading">...</view>
<view v-else class="tishi">
<view class="tishi2">
<view style=" transform: rotate(125deg) scaleX(2) scaleY(1);margin-bottom: 30%;margin-left: 30%; " ><uni-icons type="undo" size="100"></uni-icons></view>
<view>文档打开后</view>
<view>点击右上角按钮然后选择保存到手机可下载</view>
<view>点击右上角按钮可下载或转发保存</view>
</view>
<view class="ok" @click="openfile()">
我知道了,打开文档
@ -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
// })
},
});
}

Loading…
Cancel
Save