From d811428f0a2adc30c72afed529ea381728476304 Mon Sep 17 00:00:00 2001 From: guqing <1484563614@qq.com> Date: Wed, 26 Jun 2019 16:59:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=88=A4=E6=96=AD=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E6=98=AF=E5=9B=BE=E7=89=87=E5=88=99=E4=B8=8D=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/AttachmentDetailDrawer.vue | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/views/attachment/components/AttachmentDetailDrawer.vue b/src/views/attachment/components/AttachmentDetailDrawer.vue index 9ff754c2..7d9e347c 100644 --- a/src/views/attachment/components/AttachmentDetailDrawer.vue +++ b/src/views/attachment/components/AttachmentDetailDrawer.vue @@ -18,7 +18,8 @@ :paragraph="{rows: 8}" >
- +
此文件不支持预览
+
@@ -74,7 +75,7 @@ 附件大小: - + 图片尺寸: @@ -100,7 +101,7 @@ - + ![{{ attachment.name }}]({{ attachment.path }}) @@ -156,7 +157,10 @@ export default { return { detailLoading: true, editable: false, - photo: {} + photo: {}, + photoPreviewVisible: false, + vedioPreviewVisible: false, + nonsupportPreviewVisible: false } }, model: { @@ -189,6 +193,13 @@ export default { if (newValue) { this.loadSkeleton() } + }, + attachment: function(newValue, oldValue) { + if (newValue) { + var attachment = newValue + var mediaType = attachment.mediaType + this.handleJudgeMediaType(mediaType) + } } }, methods: { @@ -250,6 +261,24 @@ export default { }, onClose() { this.$emit('close', false) + }, + handleJudgeMediaType(mediaType) { + // 判断文件类型 + if(mediaType) { + var prefix = mediaType.split('/')[0] + + if(prefix === 'video' || prefix==='flv') { + this.vedioPreviewVisible = true + this.nonsupportPreviewVisible = false + } else if(prefix === 'image') { + this.photoPreviewVisible = true + this.nonsupportPreviewVisible = false + } else { + this.nonsupportPreviewVisible = true + this.vedioPreviewVisible = false + this.photoPreviewVisible = false + } + } } } }