Skip to content

Commit 7f09f91

Browse files
✨ feat: 增加全部重试的刷新按钮
1 parent be31ae0 commit 7f09f91

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

src/utils/downloadManager.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,18 @@ class DownloadManager {
327327
// 继续处理队列
328328
this.processQueue();
329329
}
330+
331+
/**
332+
* 重试所有下载任务
333+
*/
334+
public retryAllDownloads() {
335+
const dataStore = useDataStore();
336+
const songsToRetry = dataStore.downloadingSongs.map((item) => item.song.id);
337+
338+
songsToRetry.forEach((id) => {
339+
this.retryDownload(id);
340+
});
341+
}
330342
}
331343

332344
export default DownloadManager.getInstance();

src/views/Download/layout.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,21 @@
3535
</n-button>
3636
<n-button
3737
:focusable="false"
38-
:disabled="currentTab !== 'download-downloaded'"
38+
:disabled="
39+
currentTab === 'download-downloaded'
40+
? false
41+
: dataStore.downloadingSongs.length === 0
42+
"
3943
:loading="loading"
4044
class="more"
4145
strong
4246
secondary
4347
circle
44-
@click="getDownloadMusic(true)"
48+
@click="
49+
currentTab === 'download-downloaded'
50+
? getDownloadMusic(true)
51+
: DownloadManager.retryAllDownloads()
52+
"
4553
>
4654
<template #icon>
4755
<SvgIcon name="Refresh" />

0 commit comments

Comments
 (0)