diff --git a/electron/main/ipc/ipc-file.ts b/electron/main/ipc/ipc-file.ts index af2a3c538..4cb7a683f 100644 --- a/electron/main/ipc/ipc-file.ts +++ b/electron/main/ipc/ipc-file.ts @@ -379,10 +379,10 @@ const initFileIpc = (): void => { songData?: any; skipIfExist?: boolean; } = { - fileName: "未知文件名", - fileType: "mp3", - path: app.getPath("downloads"), - }, + fileName: "未知文件名", + fileType: "mp3", + path: app.getPath("downloads"), + }, ): Promise<{ status: "success" | "skipped" | "error"; message?: string }> => { try { // 获取窗口 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/components/Setting/LocalSetting.vue b/src/components/Setting/LocalSetting.vue index 611301a5f..a313ce7b6 100644 --- a/src/components/Setting/LocalSetting.vue +++ b/src/components/Setting/LocalSetting.vue @@ -213,7 +213,6 @@