From 4593898549e5dfac2431b27850012440766d7352 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 10 Mar 2025 10:42:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=AA=92=E4=BD=93?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=BA=93=E5=92=8C=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E6=B7=BB=E5=8A=A0=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=E9=87=8D=E5=A4=8D=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/dashboard/MediaServerLibrary.vue | 6 +++++- src/views/dashboard/MediaServerPlaying.vue | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/views/dashboard/MediaServerLibrary.vue b/src/views/dashboard/MediaServerLibrary.vue index 98a1e3c1..251d484b 100644 --- a/src/views/dashboard/MediaServerLibrary.vue +++ b/src/views/dashboard/MediaServerLibrary.vue @@ -26,7 +26,11 @@ async function loadLibrary(server: string) { params: { server: server, hidden: true }, }) if (result && result.length > 0) { - libraryList.value = libraryList.value.concat(result) + // 不存在时添加 + for (const item of result) { + const index = libraryList.value.findIndex(i => i.id === item.id) + if (index === -1) libraryList.value.push(item) + } } } catch (e) { console.log(e) diff --git a/src/views/dashboard/MediaServerPlaying.vue b/src/views/dashboard/MediaServerPlaying.vue index 0cef1208..f15550d2 100644 --- a/src/views/dashboard/MediaServerPlaying.vue +++ b/src/views/dashboard/MediaServerPlaying.vue @@ -24,7 +24,11 @@ async function loadPlayingList(server: string) { try { const result: MediaServerPlayItem[] = await api.get('mediaserver/playing', { params: { server } }) if (result && result.length > 0) { - playingList.value = playingList.value.concat(result) + // 不存在时添加 + for (const item of result) { + const index = playingList.value.findIndex(i => i.id === item.id) + if (index === -1) playingList.value = playingList.value.concat(result) + } } } catch (e) { console.log(e)