fix: bug

This commit is contained in:
杨航
2025-11-28 15:27:51 +08:00
parent 10c9fde2fa
commit 0e3baa12cf
6 changed files with 68 additions and 86 deletions
+23 -22
View File
@@ -305,28 +305,29 @@ export const previewFileFnc = ({
}) => {
let userInfo = getUserInfo()
let userParams = '/' + (userInfo?.loginName ?? '')
if (getPhoneEnvBool('AND')) {
navigateTo('/pages/index/preview?fileId=' + fileId + '&fileApiSrc=' + getFileSrc);
} else {
if (isDownloading) return
const base_url = get_base_url(getFileSrc);
let fileUrl = base_url + getFileSrc + fileId + userParams;
const localFilePath = '_doc/pdf_view/' + fileName + '.pdf';
isDownloading = true
downloadFileFnc(fileUrl, localFilePath).then((res) => {
uni.openDocument({
filePath: res,
showMenu: true,
success: function() {
console.log('打开文档成功');
}
})
}).finally(() => {
setTimeout(() => {
isDownloading = false
}, 1000)
});
}
navigateTo('/pages/index/preview?fileId=' + fileId + '&fileApiSrc=' + getFileSrc);
// if (getPhoneEnvBool('AND')) {
// navigateTo('/pages/index/preview?fileId=' + fileId + '&fileApiSrc=' + getFileSrc);
// } else {
// if (isDownloading) return
// const base_url = get_base_url(getFileSrc);
// let fileUrl = base_url + getFileSrc + fileId + userParams;
// const localFilePath = '_doc/pdf_view/' + fileName + '.pdf';
// isDownloading = true
// downloadFileFnc(fileUrl, localFilePath).then((res) => {
// uni.openDocument({
// filePath: res,
// showMenu: true,
// success: function() {
// console.log('打开文档成功');
// }
// })
// }).finally(() => {
// setTimeout(() => {
// isDownloading = false
// }, 1000)
// });
// }
}
const downloadFileFnc = async (fileUrl, localFilePath) => {
try {