修复:下载时所选文件夹为空下载失败的问题

This commit is contained in:
jmal 2020-02-16 14:19:06 +08:00
parent e97dbd5ac3
commit 60ebb70bc1

View File

@ -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