Skip to content
This repository was archived by the owner on Jul 17, 2026. It is now read-only.

fix:修复歌手信息跳转更新失败和歌手头像丢失问题 - #632

Merged
imsyy merged 2 commits into
SPlayer-Dev:devfrom
flystar233:dev
Dec 15, 2025
Merged

imsyy merged 2 commits into
SPlayer-Dev:devfrom
flystar233:dev

Conversation

@flystar233

Copy link
Copy Markdown
Contributor
  1. 现在点击多个歌手名字时,歌手的头像和介绍都可以正常更新在页面了.
  2. 跳转到歌手弹窗可以正常显示头像了。
image

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @flystar233, 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!

此拉取请求主要旨在提升用户体验,通过修复在点击不同歌手时信息未能正确更新以及歌手头像显示异常的问题,确保了歌手详情页面的数据完整性和视觉一致性。

Highlights

  • 歌手信息更新: 修复了点击多个歌手名字时,歌手的头像和介绍无法正常更新的问题。
  • 歌手头像显示: 解决了跳转到歌手弹窗时,歌手头像丢失或无法正常显示的问题。
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. ↩

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

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.

Code Review

本次 PR 修复了歌手信息更新和头像显示相关的两个 bug,代码改动方向正确。在 JumpArtist.vue 中,通过获取歌手详情来补充缺失的头像信息,解决了弹窗中头像丢失的问题。我对这部分逻辑提出了一个重构建议,以使其更加健壮,能够处理部分歌手有头像而部分没有的情况,并增加了错误日志记录。在 Artist/layout.vue 中,更新了路由守卫的判断逻辑,使用了 some 方法来检查路由,这比之前检查 matched[0] 的方式更可靠,能更好地处理嵌套路由的情况。总体来说,这是一个不错的修复,在采纳建议后代码质量会更高。

Comment thread src/components/Modal/JumpArtist.vue Outdated
Comment on lines +89 to +109
// 检查是否有 cover 字段,如果没有则获取歌手详情
const hasCover = props.artist.some((ar) => ar.cover);
if (hasCover) {
artistData.value = props.artist;
} else {
// 获取每个歌手的详情以获取头像
const artistPromises = props.artist.map(async (ar) => {
try {
const result = await artistDetail(ar.id);
const artist = result.data?.artist;
return {
id: ar.id,
name: ar.name,
cover: artist?.cover || artist?.img1v1Url || artist?.picUrl,
};
} catch {
return { id: ar.id, name: ar.name, cover: undefined };
}
});
artistData.value = await Promise.all(artistPromises);
}

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.

high

当前的歌手封面检查逻辑不够健壮。使用 props.artist.some((ar) => ar.cover) 会在数组中至少有一个歌手已有封面时,跳过获取其他歌手的头像,这会导致部分歌手没有头像,UI 显示不一致。

一个更可靠的方法是单独处理每个歌手,只为缺少封面的歌手获取详情。这样可以确保所有歌手的数据在需要时都能被获取,同时避免了不必要的 API 调用。

此外,API 调用的 catch 块是空的。记录错误日志是一个好习惯,有助于调试。

建议进行如下重构,以解决上述两个问题:

    // 检查是否有 cover 字段,如果没有则获取歌手详情
    const artistPromises = props.artist.map(async (ar) => {
      // 如果已有封面,则直接返回
      if (ar.cover) {
        return ar;
      }

      // 否则,获取歌手详情
      try {
        const result = await artistDetail(ar.id);
        const artist = result.data?.artist;
        return {
          id: ar.id,
          name: ar.name,
          cover: artist?.cover || artist?.img1v1Url || artist?.picUrl,
        };
      } catch (error) {
        console.error(`获取歌手 ${ar.name} (${ar.id}) 的详情失败:`, error);
        return { id: ar.id, name: ar.name, cover: undefined };
      }
    });

    artistData.value = await Promise.all(artistPromises);

@flystar233

Copy link
Copy Markdown
Contributor Author

update by gemini-code-assist

@imsyy
imsyy merged commit 8ef6b98 into SPlayer-Dev:dev Dec 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants