From 69b1e541c63987412dd65e49ce0e8cdce26e1d48 Mon Sep 17 00:00:00 2001 From: alger Date: Thu, 15 May 2025 00:08:27 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E5=9C=A8=E6=94=B6=E8=97=8F?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=AD=E6=B7=BB=E5=8A=A0=E6=AD=8C=E6=9B=B2?= =?UTF-8?q?=E7=82=B9=E8=B5=9E=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/store/modules/player.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/renderer/store/modules/player.ts b/src/renderer/store/modules/player.ts index 0562f98..efc3b2d 100644 --- a/src/renderer/store/modules/player.ts +++ b/src/renderer/store/modules/player.ts @@ -4,7 +4,7 @@ import { computed, ref } from 'vue'; import i18n from '@/../i18n/renderer'; import { getBilibiliAudioUrl } from '@/api/bilibili'; -import { getLikedList, getMusicLrc, getMusicUrl, getParsingMusicUrl } from '@/api/music'; +import { getLikedList, getMusicLrc, getMusicUrl, getParsingMusicUrl, likeSong } from '@/api/music'; import { useMusicHistory } from '@/hooks/MusicHistoryHook'; import { audioService } from '@/services/audioService'; import type { ILyric, ILyricText, SongResult } from '@/type/music'; @@ -984,6 +984,7 @@ export const usePlayerStore = defineStore('player', () => { if (!isAlreadyInList) { favoriteList.value.push(id); localStorage.setItem('favoriteList', JSON.stringify(favoriteList.value)); + typeof id === 'number' && likeSong(id, true); } }; @@ -993,6 +994,7 @@ export const usePlayerStore = defineStore('player', () => { favoriteList.value = favoriteList.value.filter(existingId => !isBilibiliIdMatch(existingId, id)); } else { favoriteList.value = favoriteList.value.filter(existingId => existingId !== id); + likeSong(Number(id), false); } localStorage.setItem('favoriteList', JSON.stringify(favoriteList.value)); };