From 125207226be8e5f3d0246a8e82f25f65da5404da Mon Sep 17 00:00:00 2001 From: lyswhut Date: Fri, 13 Mar 2020 19:44:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=8F=98=E4=B8=8B=E8=BD=BD=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=8F=92=E5=85=A5=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publish/changeLog.md | 1 + src/renderer/store/modules/download.js | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/publish/changeLog.md b/publish/changeLog.md index 1714aeef..1b1709ec 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -11,6 +11,7 @@ - 优化月里嫦娥皮肤侧栏鼠标悬浮颜色 - 优化播放进度条的动画效果 +- 现在添加下载任务时,后面添加的任务会在列表顶部插入 ### 修复 diff --git a/src/renderer/store/modules/download.js b/src/renderer/store/modules/download.js index 580604d8..c81d2981 100644 --- a/src/renderer/store/modules/download.js +++ b/src/renderer/store/modules/download.js @@ -126,8 +126,10 @@ const refreshUrl = function(commit, downloadInfo) { getUrl(downloadInfo, true).then(result => { commit('updateUrl', { downloadInfo, url: result.url }) commit('setStatusText', { downloadInfo, text: '链接刷新成功' }) - dls[downloadInfo.key].refreshUrl(result.url) - dls[downloadInfo.key].start() + const dl = dls[downloadInfo.key] + if (!dl) return + dl.refreshUrl(result.url) + dl.start() }).catch(err => { console.log(err) this.dispatch('download/startTask') @@ -325,7 +327,7 @@ const actions = { // mitations const mutations = { addTask(state, downloadInfo) { - state.list.push(downloadInfo) + state.list.unshift(downloadInfo) }, removeTask(state, index) { state.list.splice(index, 1)