diff --git a/publish/changeLog.md b/publish/changeLog.md index 470251ed..3d6a8110 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -7,3 +7,4 @@ - 修复按住`Ctrl`等键触发多选机制时不松开按键的情况下切换到其他窗口后再松开按键,这时切回软件不按按键都处在多选模式的问题 - 修复Linux版开启托盘无法退出的问题 - 修复某些情况下可能导致的音源输出问题 +- 修复某些情况下无法开始下载任务的问题 diff --git a/src/renderer/store/modules/download.js b/src/renderer/store/modules/download.js index 4d7c5894..de8695eb 100644 --- a/src/renderer/store/modules/download.js +++ b/src/renderer/store/modules/download.js @@ -68,7 +68,7 @@ const getStartTask = (list, downloadStatus, maxDownloadNum) => { let downloadCount = 0 const waitList = list.filter(item => item.status == downloadStatus.WAITING ? true : (item.status === downloadStatus.RUN && ++downloadCount && false)) // console.log(downloadCount, waitList) - return downloadCount < maxDownloadNum && waitList.length > 0 && waitList.shift() + return downloadCount < maxDownloadNum ? waitList.shift() || null : false } const awaitRequestAnimationFrame = () => new Promise(resolve => window.requestAnimationFrame(() => resolve())) @@ -409,11 +409,14 @@ const actions = { async startTask({ state, rootState, commit, dispatch }, downloadInfo) { // 检查是否可以开始任务 let result = getStartTask(state.list, state.downloadStatus, rootState.setting.download.maxDownloadNum) - if (result) { - if (!downloadInfo || downloadInfo.isComplate || downloadInfo.status == state.downloadStatus.RUN) downloadInfo = result + if (downloadInfo && !downloadInfo.isComplate && downloadInfo.status != state.downloadStatus.RUN) { + if (result === false) { + commit('setStatus', { downloadInfo, status: state.downloadStatus.WAITING }) + return + } } else { - if (downloadInfo) commit('setStatus', { downloadInfo, status: state.downloadStatus.WAITING }) - return + if (!result) return + downloadInfo = result } let dl = dls[downloadInfo.key]