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) } }, // 复制下载链接