From 6bf343286ce1d1a8dd65f44ca080c5558e5d138f Mon Sep 17 00:00:00 2001 From: guqing <1484563614@qq.com> Date: Wed, 26 Jun 2019 22:44:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Deslint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/attachment/AttachmentList.vue | 12 ++--- .../components/AttachmentDetailDrawer.vue | 46 ++++++++++++------- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/src/views/attachment/AttachmentList.vue b/src/views/attachment/AttachmentList.vue index 85aa9c2e..3626e3bf 100644 --- a/src/views/attachment/AttachmentList.vue +++ b/src/views/attachment/AttachmentList.vue @@ -247,18 +247,18 @@ export default { handleJudgeMediaType(attachment) { var mediaType = attachment.mediaType // 判断文件类型 - if(mediaType) { + if (mediaType) { var prefix = mediaType.split('/')[0] - - if(prefix === 'image') { + + if (prefix === 'image') { // 是图片 - return true + return true } else { - // 非图片 + // 非图片 return false } } - //没有获取到文件返回false + // 没有获取到文件返回false return false } } diff --git a/src/views/attachment/components/AttachmentDetailDrawer.vue b/src/views/attachment/components/AttachmentDetailDrawer.vue index bcda0731..ba0d8427 100644 --- a/src/views/attachment/components/AttachmentDetailDrawer.vue +++ b/src/views/attachment/components/AttachmentDetailDrawer.vue @@ -20,11 +20,13 @@
此文件不支持预览
- - + +
@@ -179,13 +181,12 @@ export default { fluid: true, controls: true, loop: false, - muted: false, playbackRates: [0.7, 1.0, 1.5, 2.0], sources: [{ - type: "video/mp4", - src: "https://cdn.theguardian.tv/webM/2015/07/20/150716YesMen_synd_768k_vp8.webm" + type: 'video/mp4', + src: 'https://cdn.theguardian.tv/webM/2015/07/20/150716YesMen_synd_768k_vp8.webm' }], - poster: "/static/images/author.jpg", + poster: '/static/images/author.jpg', width: document.documentElement.clientWidth, notSupportedMessage: '此视频暂无法播放,请稍后再试' } @@ -297,10 +298,10 @@ export default { handleJudgeMediaType(attachment) { var mediaType = attachment.mediaType // 判断文件类型 - if(mediaType) { + if (mediaType) { var prefix = mediaType.split('/')[0] - - if(prefix === 'video' || prefix==='flv') { + + if (prefix === 'video' || prefix === 'flv') { this.videoPreviewVisible = true this.photoPreviewVisible = false this.nonsupportPreviewVisible = false @@ -310,10 +311,10 @@ export default { src: attachment.path }) console.log(this.playerOptions.sources) - } else if(prefix === 'image') { - this.photoPreviewVisible = true - this.videoPreviewVisible = false - this.nonsupportPreviewVisible = false + } else if (prefix === 'image') { + this.photoPreviewVisible = true + this.videoPreviewVisible = false + this.nonsupportPreviewVisible = false } else { this.nonsupportPreviewVisible = true this.videoPreviewVisible = false @@ -321,6 +322,19 @@ export default { } } } + // handleDownLoadPhoto(attachment) { + // var path = attachment.path + + // var index = path.lastIndexOf('/') + // var filename = path.substr(index+1, path.length) + // // chrome/firefox + // var aTag = document.createElement('a') + // aTag.download = filename + // aTag.href = path//URL.createObjectURL(blob) + // aTag.target = '_blank' + // aTag.click() + // URL.revokeObjectURL(aTag.href) + // } } }