From 60ebb70bc143aeced7952a459dddc2b87b09b773 Mon Sep 17 00:00:00 2001 From: jmal Date: Sun, 16 Feb 2020 14:19:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=E4=B8=8B=E8=BD=BD=E6=97=B6?= =?UTF-8?q?=E6=89=80=E9=80=89=E6=96=87=E4=BB=B6=E5=A4=B9=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home/index.vue | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 7fdcde8..50ef863 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -809,15 +809,7 @@ export default { break case 'download': console.log('下载') - var fileIds = []; - if (this.menusIsMultiple) { - this.selectRowData.forEach(value => { - fileIds.push(value.id) - }) - } else { - fileIds.push(this.rowContextData.id) - } - window.open(process.env.VUE_APP_BASE_FILE_API + 'download?jmal-token=' + this.$store.state.user.token + '&fileIds=' + fileIds, '_self') + this.downloadFile() break case 'remove': console.log('operation', '删除') @@ -826,6 +818,28 @@ export default { } this.$refs.contextShow.hideMenu() }, + downloadFile() { + let totalSize = 0 + this.selectRowData.forEach(item => { + totalSize += item.size + }) + if (totalSize > 0) { + var fileIds = []; + if (this.menusIsMultiple) { + this.selectRowData.forEach(value => { + fileIds.push(value.id) + }) + } else { + fileIds.push(this.rowContextData.id) + } + window.open(process.env.VUE_APP_BASE_FILE_API + 'download?jmal-token=' + this.$store.state.user.token + '&fileIds=' + fileIds, '_self') + } else { + this.$message({ + message: '所选文件夹为空', + type: 'warning' + }); + } + }, // 收藏/取消收藏 favoriteOperating(isFavorite) { this.selectRowData[0].isFavorite = isFavorite