From e5a77d6a551d13e4cf74624b31b0fa3e328b304d Mon Sep 17 00:00:00 2001 From: zhangwei <1504152376@qq.com> Date: 星期四, 23 一月 2025 17:23:39 +0800 Subject: [PATCH] - --- src/common/utils/util.js | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/src/common/utils/util.js b/src/common/utils/util.js index 2f75f03..f16ad85 100644 --- a/src/common/utils/util.js +++ b/src/common/utils/util.js @@ -838,5 +838,33 @@ } } }, - + checkFileExtensions(str) { + const extensions = ['pdf', 'doc', 'docx', 'xls', 'xlsx']; + return extensions.some(extension => str.includes(extension)); + }, + previewWechat(urlPdf) { + uni.showLoading({ + title: '姝e湪鍔犺浇涓�..' + }) + uni.downloadFile({ + url: urlPdf, + success: function(res) { + var filePath = res.tempFilePath; + const index = urlPdf.lastIndexOf("."); + const suffix = urlPdf.substring(index + 1); + uni.openDocument({ + fileType: suffix, + filePath: filePath, + showMenu: true, + success: function(res) { + console.log('鎵撳紑鏂囨。鎴愬姛'); + uni.hideLoading() + }, + }); + }, + complete: function(r) { + uni.hideLoading() + } + }); + }, } \ No newline at end of file -- Gitblit v1.9.1