-
Notifications
You must be signed in to change notification settings - Fork 1.2k
✨ feat: 增加下载重试按钮,解决卡0%问题 #614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
be31ae0
✨ feat: 增加下载重试按钮,解决卡0%问题
kazukokawagawa 7f09f91
✨ feat: 增加全部重试的刷新按钮
kazukokawagawa 4fca789
🐞 fix: 修复下载列表的排序、各项问题
kazukokawagawa 91961c0
update
kazukokawagawa 472d357
🌈 style: 优化进度条样式
imsyy a76ce18
✨ feat: 更新下载管理逻辑,重置下载状态与进度信息
imsyy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| props: { onClick: () => DownloadManager.retryDownload(song.id) }, | ||
| icon: renderIcon("Refresh"), | ||
| }, | ||
| ]; | ||
| // 显示菜单 | ||
| dropdownX.value = e.clientX; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
仅使用一个布尔值
isDownloading来判断状态过于宽泛。为了在菜单项中实现更精细的逻辑控制(例如,仅在下载失败或卡住时显示重试),建议获取完整的下载信息对象。