From 70587fdffac2850fcecb51b4d39d4ac8e9dd5628 Mon Sep 17 00:00:00 2001 From: jmal Date: Sat, 11 May 2024 09:11:53 +0800 Subject: [PATCH 1/2] =?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) } }, // 复制下载链接 From df87f3c11609279c5d644a86a9585439f4c01c53 Mon Sep 17 00:00:00 2001 From: jmal Date: Sat, 11 May 2024 09:30:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?test:=20=E5=8F=B3=E9=94=AE=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=8A=A0=E4=B8=8A=E6=98=BE=E7=A4=BA=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 7387e46..bdb4d95 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -1107,7 +1107,6 @@ export default { dragLoop: null, positionX: 0, positionY: 0, - showFolderSize: false, grid: this.defaultGrid, vmode: this.defaultGrid ? "grid" : "list", gridColumnNum: -1, @@ -2581,7 +2580,7 @@ export default { child[0].iconClass = "menu-point"; child[1].iconClass = "menu-empty"; } - if (this.showFolderSize) { + if (localStorage.getItem('showFolderSize') === 'true') { child[2].iconClass = "duigou"; } else { child[2].iconClass = "menu-empty"; @@ -2730,7 +2729,7 @@ export default { queryFileType: this.queryFileType, pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize, - showFolderSize: this.showFolderSize + showFolderSize: localStorage.getItem('showFolderSize') }) .then(res => { this.loadData(res, onLoad); @@ -2754,7 +2753,7 @@ export default { pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize, folder: this.$route.query.folder, - showFolderSize: this.showFolderSize + showFolderSize: localStorage.getItem('showFolderSize') }) .then(res => { this.loadData(res, onLoad); @@ -2775,7 +2774,7 @@ export default { pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize, folder: this.$route.query.folder, - showFolderSize: this.showFolderSize + showFolderSize: localStorage.getItem('showFolderSize') }) .then(res => { this.loadData(res, onLoad); @@ -2808,7 +2807,7 @@ export default { queryCondition: this.queryCondition, pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize, - showFolderSize: this.showFolderSize + showFolderSize: localStorage.getItem('showFolderSize') }) .then(res => { this.loadData(res, onLoad); @@ -2825,7 +2824,7 @@ export default { folder: this.$route.query.folder, pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize, - showFolderSize: this.showFolderSize + showFolderSize: localStorage.getItem('showFolderSize') }) .then(res => { this.loadData(res, onLoad); @@ -3424,7 +3423,8 @@ export default { this.changeVmode(); break; case "show-folder-size": - this.showFolderSize = !this.showFolderSize; + const showFolderSize = localStorage.getItem('showFolderSize') + localStorage.setItem('showFolderSize', showFolderSize === 'false') this.getFileList(); break; case "orderName":