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 + } + } } } }