修复某些情况下无法开始下载任务的问题

pull/277/head
lyswhut 2020-05-04 01:53:37 +08:00
parent 6aec78e153
commit 7e029b5495
2 changed files with 9 additions and 5 deletions

View File

@ -7,3 +7,4 @@
- 修复按住`Ctrl`等键触发多选机制时不松开按键的情况下切换到其他窗口后再松开按键,这时切回软件不按按键都处在多选模式的问题
- 修复Linux版开启托盘无法退出的问题
- 修复某些情况下可能导致的音源输出问题
- 修复某些情况下无法开始下载任务的问题

View File

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