From af361302a6eacf6b734ad3abf77269d284e23743 Mon Sep 17 00:00:00 2001 From: yuejiayang <146344614+YangLei105@users.noreply.github.com> Date: Thu, 5 Sep 2024 18:06:02 +0800 Subject: [PATCH] =?UTF-8?q?2024.9.5=20=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95?= =?UTF-8?q?-=E7=94=9F=E4=BA=A7=E9=80=9A=E7=9F=A5=E5=8D=95=EF=BC=88?= =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E7=89=88=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shopOrder/shopOrder/shopNotice.vue | 53 ++++++++++++------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/src/views/modules/shopOrder/shopOrder/shopNotice.vue b/src/views/modules/shopOrder/shopOrder/shopNotice.vue index 2b57958..11fab77 100644 --- a/src/views/modules/shopOrder/shopOrder/shopNotice.vue +++ b/src/views/modules/shopOrder/shopOrder/shopNotice.vue @@ -3,9 +3,9 @@ - - + style="margin-top: 20px; position: fixed; top: 55px; margin-left: -20px; margin-right: 0px;width: 100%; z-index: 1000; background-color: white; padding: 10px; border: 3px solid #17B3A3;" + > + @@ -286,8 +286,7 @@
- - +
@@ -839,22 +838,38 @@ export default { }, openDialog(row) { + // 预览文件 let image = ['jpg', 'jpeg', 'png', 'gif', 'bmp'] - let pdf = ['pdf'] let type = '' if (image.includes(row.fileType.toLowerCase())) { - this.pdfUrl = '/file/' + row.newFileName + type = 'image/' + row.fileType } - else if (pdf.includes(row.fileType.toLowerCase())) { - this.pdfUrl = '/file/' + row.newFileName + let video = ['mp4', 'avi', 'mov', 'wmv', 'flv'] + if (video.includes(row.fileType.toLowerCase())) { + type = 'video/' + row.fileType } - else { - this.$message({ - message: '不支持的文件类型', - type: 'warning' - }) + let txt = ['txt'] + if (txt.includes(row.fileType.toLowerCase())) { + type = 'text/plain' + } + let office = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx'] + if (office.includes(row.fileType.toLowerCase())) { + this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`) return } + let pdf = ['pdf'] + if (pdf.includes(row.fileType.toLowerCase())) { + type = 'application/pdf' + } + if (type === ''){ + this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`) + return; + } + downLoadObjectFile(row).then(({data}) => { + const blob = new Blob([data], {type: type}); + // 创建URL来生成预览 + this.fileURL = URL.createObjectURL(blob); + }) this.dialogVisible = true; // 打开弹窗 },