From 70587fdffac2850fcecb51b4d39d4ac8e9dd5628 Mon Sep 17 00:00:00 2001 From: jmal Date: Sat, 11 May 2024 09:11:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E6=8F=90=E7=A4=BA=E6=89=80=E9=80=89?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E4=B8=BA=E7=A9=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 39 +++++----------------- src/views/home/mobile/index.vue | 31 +++++------------- src/views/public/share/shareList.vue | 49 ++++++++++------------------ 3 files changed, 33 insertions(+), 86 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 90654a0..7387e46 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -3846,42 +3846,19 @@ export default { this.rowContextData.isShare = true; }, downloadFile() { - let totalSize = 0; + let fileIds = []; if (this.$refs.fileListTable.tableSelectData.length > 0) { - this.$refs.fileListTable.tableSelectData.forEach(item => { - totalSize += item.size; + this.$refs.fileListTable.tableSelectData.forEach(value => { + fileIds.push(value.id); }); } else { - totalSize += this.rowContextData.size; + fileIds.push(this.rowContextData.id); } - if (totalSize > 0) { - let fileIds = []; - if (this.$refs.fileListTable.tableSelectData.length > 0) { - this.$refs.fileListTable.tableSelectData.forEach(value => { - fileIds.push(value.id); - }); - } else { - fileIds.push(this.rowContextData.id); - } - if (fileIds.length > 1 || this.rowContextData.isFolder) { - fileConfig.packageDownload( - fileIds, - this.$store.state.user.token, - this.$store.state.user.name - ); - return; - } - fileConfig.download( - this.$store.state.user.name, - this.rowContextData, - this.$store.getters.token - ); - } else { - this.$message({ - message: "所选文件为空", - type: "warning" - }); + if (fileIds.length > 1 || this.rowContextData.isFolder) { + fileConfig.packageDownload(fileIds,this.$store.state.user.token,this.$store.state.user.name) + return; } + fileConfig.download(this.$store.state.user.name,this.rowContextData,this.$store.getters.token) }, // 复制下载链接 copyDownloadLink(row) { diff --git a/src/views/home/mobile/index.vue b/src/views/home/mobile/index.vue index e826fa7..e772874 100644 --- a/src/views/home/mobile/index.vue +++ b/src/views/home/mobile/index.vue @@ -611,34 +611,19 @@ export default { } }, downloadFile() { - let totalSize = 0 + let fileIds = []; if (this.selectRowData.length > 0) { - this.selectRowData.forEach(item => { - totalSize += item.size + this.selectRowData.forEach(value => { + fileIds.push(value.id) }) } else { - totalSize += this.rowContextData.size + fileIds.push(this.rowContextData.id) } - if (totalSize > 0) { - let fileIds = []; - if (this.selectRowData.length > 0) { - this.selectRowData.forEach(value => { - fileIds.push(value.id) - }) - } else { - fileIds.push(this.rowContextData.id) - } - if (fileIds.length > 1 || this.rowContextData.isFolder) { - fileConfig.packageDownload(fileIds, this.$store.state.user.token, this.$store.state.user.name) - return - } - fileConfig.download(this.$store.state.user.name, this.rowContextData, this.$store.state.user.token) - } else { - this.$message({ - message: '所选文件夹为空', - type: 'warning' - }); + if (fileIds.length > 1 || this.rowContextData.isFolder) { + fileConfig.packageDownload(fileIds, this.$store.state.user.token, this.$store.state.user.name) + return } + fileConfig.download(this.$store.state.user.name, this.rowContextData, this.$store.state.user.token) }, // 复制下载链接 copyDownloadLink(row) { diff --git a/src/views/public/share/shareList.vue b/src/views/public/share/shareList.vue index b38f135..52e3821 100644 --- a/src/views/public/share/shareList.vue +++ b/src/views/public/share/shareList.vue @@ -1000,45 +1000,30 @@ export default { this.selectTreeNode.showName = ' "' + row.name + '"' }, downloadFile(copy) { - let totalSize = 0 - if (this.indexList.length > 0) { - this.selectRowData.forEach(item => { - totalSize += item.size + let fileIds = []; + if (this.menusIsMultiple) { + this.selectRowData.forEach(value => { + fileIds.push(value.id) }) } else { - totalSize = this.rowContextData.size + fileIds.push(this.rowContextData.id) } - if (totalSize > 0) { - let fileIds = []; - if (this.menusIsMultiple) { - this.selectRowData.forEach(value => { - fileIds.push(value.id) - }) - } else { - fileIds.push(this.rowContextData.id) - } - if (fileIds.length > 1 || this.rowContextData.isFolder) { - if (copy) { - this.copyDownloadLink(fileConfig.publicPackageDownloadUrl(this.shareId, fileIds, this.$store.getters.shareToken)) - } else { - fileConfig.publicPackageDownload(this.shareId, fileIds, this.$store.getters.shareToken) - } - return - } + if (fileIds.length > 1 || this.rowContextData.isFolder) { if (copy) { - if (this.rowContextData.isShare) { - this.copyDownloadLink(window.location.origin + fileConfig.previewUrl(this.sharer.username, this.rowContextData, undefined, this.$store.getters.shareToken)) - } else { - this.copyDownloadLink(fileConfig.publicPackageDownloadUrl(this.shareId, fileIds, this.$store.getters.shareToken)) - } + this.copyDownloadLink(fileConfig.publicPackageDownloadUrl(this.shareId, fileIds, this.$store.getters.shareToken)) } else { - fileConfig.publicDownload(this.shareId, this.rowContextData, this.$store.getters.shareToken) + fileConfig.publicPackageDownload(this.shareId, fileIds, this.$store.getters.shareToken) + } + return + } + if (copy) { + if (this.rowContextData.isShare) { + this.copyDownloadLink(window.location.origin + fileConfig.previewUrl(this.sharer.username, this.rowContextData, undefined, this.$store.getters.shareToken)) + } else { + this.copyDownloadLink(fileConfig.publicPackageDownloadUrl(this.shareId, fileIds, this.$store.getters.shareToken)) } } else { - this.$message({ - message: '所选文件为空', - type: 'warning' - }); + fileConfig.publicDownload(this.shareId, this.rowContextData, this.$store.getters.shareToken) } }, // 复制下载链接