From cb5c4ac1a8a8ee1b5f70a9af4b0424a2f60d19d7 Mon Sep 17 00:00:00 2001 From: sigoden Date: Thu, 4 Nov 2021 11:38:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=AD=8C=E6=9B=B2=E6=94=B6=E8=97=8F?= =?UTF-8?q?=E5=88=B0=E7=9B=AE=E6=A0=87=E6=AD=8C=E5=8D=95=E5=90=8E=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E8=A7=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/background/store.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/background/store.js b/src/background/store.js index a9f6319..a6e8db5 100644 --- a/src/background/store.js +++ b/src/background/store.js @@ -62,7 +62,7 @@ export function togglePlaying () { export function toggleMute () { if (store.volume === 0) { - updateVolume(volumeMute) + updateVolume(volumeMute || COMMON_PROPS.volume) } else { volumeMute = store.volume updateVolume(0) @@ -150,9 +150,7 @@ export async function likeSong (playlistId) { if (!playlistId) throw new Error(errMsg) const res = await api.likeSong(playlistId, selectedSong.id, true) if (res.code === 200) { - // 更新收藏到歌单 - const playlist = store.playlists.find(v => v.id === playlistId) - await loadPlaylistDetails(playlist) + refreshPlaylistDetails(playlistId) return { message: '收藏成功' } } else { throw new Error(errMsg) @@ -382,6 +380,13 @@ async function loadPlaylistDetails (playlist) { } } +async function refreshPlaylistDetails (playlistId) { + const playlist = store.playlists.find(v => v.id === playlistId) + delete playlistDetailStore[playlistId] + await loadPlaylistDetails(playlist) + logger.debug('refreshPlaylistDetails', playlist.name) +} + async function loadSongDetail (playlistDetail, songId, retry) { const { normalIndexes, invalidIndexes } = playlistDetail let songsMap = songsStore[playlistDetail.id]