fix(player): 合并外部贡献后的集成修复

- PlayBar 下载按钮补 isElectron 守卫,Web 端不再显示无效按钮(#708 评审意见)
- preloadNextSongs 恢复 800ms 短去抖,避免快速切歌时音源请求风暴(#712 评审意见)
- 清理合并后未使用的导入
This commit is contained in:
alger
2026-07-05 14:00:07 +08:00
parent 8ea13e04f0
commit 837f0268d5
3 changed files with 13 additions and 4 deletions
+1 -1
View File
@@ -151,7 +151,7 @@
</template>
{{ t('player.playBar.reparse') }}
</n-tooltip>
<n-tooltip v-if="playMusic?.id" trigger="hover" :z-index="9999999">
<n-tooltip v-if="playMusic?.id && isElectron" trigger="hover" :z-index="9999999">
<template #trigger>
<i
class="iconfont ri-download-line"
+1 -2
View File
@@ -6,8 +6,7 @@ import { getMusicLrc, getMusicUrl, getParsingMusicUrl } from '@/api/music';
import { playbackRequestManager } from '@/services/playbackRequestManager';
import { SongSourceConfigManager } from '@/services/SongSourceConfigManager';
import type { ILyric, ILyricText, IWordData, SongResult } from '@/types/music';
import { getImgUrl, isElectron } from '@/utils';
import { getImageLinearBackground } from '@/utils/linearColor';
import { isElectron } from '@/utils';
import { parseLyrics as parseYrcLyrics } from '@/utils/yrcParser';
const { message } = createDiscreteApi(['message']);
+11 -1
View File
@@ -107,9 +107,19 @@ export const usePlaylistStore = defineStore(
};
/**
* 智能预加载下一首歌曲(立即执行,不等待)
* 智能预加载下一首歌曲
* 短去抖:快速连续切歌时只保留最后一次,避免对音源 API 的请求风暴
*/
let preloadDebounceTimer: ReturnType<typeof setTimeout> | null = null;
const preloadNextSongs = (currentIndex: number) => {
if (preloadDebounceTimer) clearTimeout(preloadDebounceTimer);
preloadDebounceTimer = setTimeout(() => {
preloadDebounceTimer = null;
doPreloadNextSongs(currentIndex);
}, 800);
};
const doPreloadNextSongs = (currentIndex: number) => {
if (playList.value.length <= 1) return;
let nextIndex: number;