Skip to content

feat(MusicWiki): 在音乐百科页面上显示操作菜单#999

Merged
apoint123 merged 2 commits into
SPlayer-Dev:devfrom
MoYingJi:pr/i
Mar 15, 2026
Merged

feat(MusicWiki): 在音乐百科页面上显示操作菜单#999
apoint123 merged 2 commits into
SPlayer-Dev:devfrom
MoYingJi:pr/i

Conversation

@MoYingJi
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings March 15, 2026 01:03
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求通过在音乐百科页面上集成歌曲操作菜单来增强用户体验。该菜单使用户能够快速访问与当前歌曲相关的操作,例如从播放列表或本地存储中删除歌曲。底层的菜单逻辑已进行重构,以支持可选的事件发射,使菜单可组合函数更适应不同的UI上下文,包括某些操作可能不直接适用的只读视图。

Highlights

  • 新增歌曲操作菜单: 在音乐百科页面上引入了一个新的下拉菜单,为当前显示的歌曲提供各种操作选项。
  • 菜单功能灵活性增强: 更新了 useSongMenu 可组合函数,使其 emit 参数变为可选,允许在不需要事件发射的场景下显示菜单选项,提高了代码复用性。
  • 菜单选项条件显示: 像“从歌单中删除”和“从本地磁盘中删除”等菜单选项现在仅在提供了 emit 函数时才条件性显示,确保了在不同上下文中的正确行为。
Changelog
  • src/composables/useSongMenu.ts
    • deleteLocalSonggetMenuOptions 函数中的 emit 参数改为可选。
    • 为“从歌单中删除”和“从本地磁盘中删除”选项添加了 emit 参数存在的条件检查。
    • 更新了 deleteSongs 的回调函数,使用可选链式调用 emit
  • src/views/Song/wiki.vue
    • 将操作容器的 div 元素替换为 n-flex 组件。
    • 添加了 n-dropdown 组件以显示歌曲操作菜单。
    • 导入了 useSongMenu 并解构了 getMenuOptions
    • 调整了操作按钮的CSS样式,包括新增的 .more 类。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

这个 PR 很好地在音乐百科页面上添加了歌曲操作菜单,并通过修改 useSongMenu 使其更具通用性。代码整体结构清晰,实现方式合理。

我发现了一个可以改进的地方:目前“从本地磁盘删除”功能在没有 emit 函数的上下文(如音乐百科页面)中被禁用了。通过小幅重构,我们可以启用这个功能,让用户在百科页面也能方便地管理本地文件。具体建议请见代码评论。

// 删除本地歌曲
const deleteLocalSong = (song: SongType, emit: (event: "removeSong", args: any[]) => void) => {
const deleteLocalSong = (song: SongType, emit?: (event: "removeSong", args: any[]) => void) => {
if (emit === undefined) return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

deleteLocalSong 函数中,当 emit 未定义时直接返回,会阻止在没有 emit 的上下文(如音乐百科页面)中执行删除本地文件的核心逻辑。为了让功能更通用,建议移除此行,并在 onPositiveClick 回调中改用可选链调用 emit (即 emit?.("removeSong", [song.id]))。

这样即使用户从音乐百科页面操作,也能成功删除本地文件。当然,这还需要配合修改菜单项的 show 条件。

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

从歌单中删除需要歌单,你在音乐百科里怎么知道你是要删哪个歌单

show: settingStore.contextMenuOptions.deleteFromLocal && isLocal && !isCurrent,
show:
settingStore.contextMenuOptions.deleteFromLocal &&
emit !== undefined &&
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

为了能在音乐百科等没有 emit 函数的页面上显示“从本地磁盘中删除”选项,应移除对 emit 的检查。此更改应与对 deleteLocalSong 函数的建议修改一并进行。

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你家本地音乐有音乐百科界面?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 为“音乐百科(Song Wiki)”页面补齐歌曲操作入口,使用户在百科页也能直接执行常见歌曲操作(播放、更多操作菜单)。

Changes:

  • Song/wiki.vue:在百科页头部新增“更多”下拉菜单按钮,并接入 useSongMenu().getMenuOptions 生成菜单项
  • useSongMenu.ts:调整菜单生成与部分删除逻辑的参数为可选/提供默认值,以支持在非列表上下文(无 index / 无 emit)调用

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/views/Song/wiki.vue 在百科页头部增加下拉操作菜单入口,并调整 actions 区域布局/样式以容纳更多按钮
src/composables/useSongMenu.ts 允许在缺少列表上下文参数时生成菜单;对依赖 emit 的删除类操作增加约束

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 153 to 159
const getMenuOptions = (
song: SongType,
index: number,
index: number = -1,
playListId: number = 0,
isDailyRecommend: boolean = false,
emit: (event: "removeSong", args: any[]) => void,
emit?: (event: "removeSong", args: any[]) => void,
): DropdownOption[] => {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里没必要改了,详见 #997

@apoint123 apoint123 merged commit 57f567a into SPlayer-Dev:dev Mar 15, 2026
@MoYingJi MoYingJi deleted the pr/i branch March 15, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants