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; // 打开弹窗 },