From be31ae0391f0438274dc897fe1c64ac0bb876d2e Mon Sep 17 00:00:00 2001 From: kazukokawagawa <2580099704@qq.com> Date: Fri, 5 Dec 2025 23:40:45 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E2=9C=A8=20feat:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E9=87=8D=E8=AF=95=E6=8C=89=E9=92=AE=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=8D=A10%=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Menu/SongListMenu.vue | 12 +++++++++++- src/views/Download/downloading.vue | 1 - 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/Menu/SongListMenu.vue b/src/components/Menu/SongListMenu.vue index 7bc612fbf..afc9a1829 100644 --- a/src/components/Menu/SongListMenu.vue +++ b/src/components/Menu/SongListMenu.vue @@ -19,6 +19,7 @@ import type { SongType } from "@/types/main"; import { NAlert, type DropdownOption } from "naive-ui"; import { useStatusStore, useLocalStore, useDataStore, useMusicStore } from "@/stores"; +import DownloadManager from "@/utils/downloadManager"; import { renderIcon, copyData } from "@/utils/helper"; import { deleteCloudSong, importCloudSong } from "@/api/cloud"; import { @@ -74,6 +75,8 @@ const openDropdown = ( const isCurrent = statusStore.playIndex === index; // 是否为用户歌单 const isUserPlaylist = !!playListId && userPlaylistsData.some((pl) => pl.id === playListId); + // 是否正在下载或下载失败 + const isDownloading = dataStore.downloadingSongs.some((item) => item.song.id === song.id); // 生成菜单 nextTick().then(() => { dropdownOptions.value = [ @@ -246,10 +249,17 @@ const openDropdown = ( { key: "download", label: "下载歌曲", - show: !isLocal && type === "song", + show: !isLocal && type === "song" && !isDownloading, props: { onClick: () => openDownloadSong(song) }, icon: renderIcon("Download"), }, + { + key: "retry-download", + label: "重试下载", + show: isDownloading, + props: { onClick: () => DownloadManager.retryDownload(song.id) }, + icon: renderIcon("Refresh"), + }, ]; // 显示菜单 dropdownX.value = e.clientX; diff --git a/src/views/Download/downloading.vue b/src/views/Download/downloading.vue index 894de7740..0fcfd0d95 100644 --- a/src/views/Download/downloading.vue +++ b/src/views/Download/downloading.vue @@ -73,7 +73,6 @@
Date: Sat, 6 Dec 2025 00:03:35 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E2=9C=A8=20feat:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E9=87=8D=E8=AF=95=E7=9A=84=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/downloadManager.ts | 12 ++++++++++++ src/views/Download/layout.vue | 12 ++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/utils/downloadManager.ts b/src/utils/downloadManager.ts index fabb2c67e..70767fa7d 100644 --- a/src/utils/downloadManager.ts +++ b/src/utils/downloadManager.ts @@ -327,6 +327,18 @@ class DownloadManager { // 继续处理队列 this.processQueue(); } + + /** + * 重试所有下载任务 + */ + public retryAllDownloads() { + const dataStore = useDataStore(); + const songsToRetry = dataStore.downloadingSongs.map((item) => item.song.id); + + songsToRetry.forEach((id) => { + this.retryDownload(id); + }); + } } export default DownloadManager.getInstance(); diff --git a/src/views/Download/layout.vue b/src/views/Download/layout.vue index 5c72399f9..984e0711c 100644 --- a/src/views/Download/layout.vue +++ b/src/views/Download/layout.vue @@ -35,13 +35,21 @@