fix: 重新解析功能修复缓存问题

This commit is contained in:
alger
2025-10-11 20:23:36 +08:00
parent dc8957dcf2
commit 4575e4f26d
2 changed files with 72 additions and 21 deletions
@@ -79,6 +79,7 @@ import { useMessage } from 'naive-ui';
import { ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { CacheManager } from '@/api/musicParser';
import { playMusic } from '@/hooks/MusicHook';
import { audioService } from '@/services/audioService';
import { usePlayerStore } from '@/store/modules/player';
@@ -160,12 +161,18 @@ const directReparseMusic = async (source: Platform) => {
isReparsing.value = true;
currentReparsingSource.value = source;
const songId = Number(playMusic.value.id);
await CacheManager.clearMusicCache(songId);
// 更新选中的音源值为当前点击的音源
const songId = String(playMusic.value.id);
selectedSourcesValue.value = [source];
// 保存到localStorage
localStorage.setItem(`song_source_${songId}`, JSON.stringify(selectedSourcesValue.value));
localStorage.setItem(
`song_source_${String(songId)}`,
JSON.stringify(selectedSourcesValue.value)
);
const success = await playerStore.reparseCurrentSong(source);