fix: batch download

This commit is contained in:
putyy
2025-09-23 09:24:40 +08:00
committed by putyy
parent 2beecdade2
commit 779f56dd91
3 changed files with 15 additions and 7 deletions

View File

@@ -82,7 +82,7 @@
"import_placeholder": "When adding multiple items, ensure each line contains only one (each link on a new line)",
"import_empty": "Please enter data to import",
"win_install_tip": "For the first time using this software, please right-click and select 'Run as administrator'",
"download_queued": "Download has been added to the queue, current queue length{count}",
"download_queued": "has been added to the queue, current queue length{count}",
"search": "Search",
"search_description": "Keyword Search...",
"start_err_tip": "Error Message",

View File

@@ -82,7 +82,7 @@
"import_placeholder": "添加多个时,请确保每行只有一个(每个链接回车换行)",
"import_empty": "请输入需要导入的数据",
"win_install_tip": "首次启用本软件,请使用鼠标右键选择以管理员身份运行",
"download_queued": "下载已加入队列,当前队列长度:{count}",
"download_queued": "已加入队列,当前队列长度:{count}",
"search": "搜索",
"search_description": "关键字搜索...",
"start_err_tip": "错误提示",

View File

@@ -451,6 +451,9 @@ onMounted(() => {
item.SavePath = res.SavePath
item.Status = 'done'
})
if (activeDownloads > 0) {
activeDownloads--
}
cacheData()
checkQueue()
break
@@ -459,6 +462,9 @@ onMounted(() => {
item.SavePath = res.Message
item.Status = 'error'
})
if (activeDownloads > 0) {
activeDownloads--
}
cacheData()
checkQueue()
break
@@ -530,6 +536,9 @@ const dataAction = (row: appType.MediaInfo, index: number, type: string) => {
item.Status = 'ready'
item.SavePath = ''
})
if (activeDownloads > 0) {
activeDownloads--
}
cacheData()
checkQueue()
if (res.code === 0) {
@@ -624,6 +633,9 @@ const batchCancel = () =>{
data.value.forEach(async (item, index) => {
if (checkedRowKeysValue.value.includes(item.Id) && item.Status === "running") {
appApi.cancel({id: item.Id})
if (activeDownloads > 0) {
activeDownloads--
}
data.value[index].Status = 'ready'
data.value[index].SavePath = ''
}
@@ -688,8 +700,7 @@ const download = (row: appType.MediaInfo, index: number) => {
if (activeDownloads >= maxConcurrentDownloads.value) {
downloadQueue.value.push(row)
window?.$message?.info((row.Description ? `「${row.Description}」` : "")
+ t("index.download_queued", {count: downloadQueue.value.length}))
window?.$message?.info(t("index.download_queued", {count: downloadQueue.value.length}))
return
}
@@ -707,9 +718,6 @@ const startDownload = (row: appType.MediaInfo, index: number) => {
if (res.code === 0) {
window?.$message?.error(res.message)
}
}).finally(() => {
activeDownloads--
checkQueue()
})
}