diff --git a/index.html b/index.html index 1eb437b..1c4bca4 100644 --- a/index.html +++ b/index.html @@ -231,6 +231,21 @@ { id: '6666', name: '飙升榜', cover: 'http://imge.kugou.com/mcommon/400/20150331/20150331161100806437.png' } ] }; + + try { + const res = await fetch(`${API_BASE}/api/?source=${source}&type=toplists`); + const data = await res.json(); + if (data.code === 200) { + // 兼容多种返回结构:data本身是数组,或者data.list是数组 + const list = Array.isArray(data.data) ? data.data : (data.data?.list || data.data?.topList || []); + if (Array.isArray(list) && list.length > 0) { + return list; + } + } + } catch (e) { + console.warn("Failed to fetch remote toplists, falling back to local list", e); + } + return predefinedLists[source] || []; }, getTopListSongs: async (id, source) => { @@ -328,7 +343,7 @@ {song.name}
- {song.artist} · {SOURCES.find(s => s.id === (song.platform || song.source))?.name || song.source} + {song.artist} {song.album ? `· ${song.album}` : ''} · {SOURCES.find(s => s.id === (song.platform || song.source))?.name || song.source}
@@ -459,7 +474,9 @@
{currentSong.name}
-
{currentSong.artist}
+
+ {currentSong.artist} {currentSong.album ? `· ${currentSong.album}` : ''} +
{ e.stopPropagation(); togglePlay(); }} className="w-10 h-10 flex items-center justify-center rounded-full border border-white/20 hover:bg-white/10 active:scale-95 transition-all"> @@ -540,7 +557,9 @@

{currentSong.name}

-

{currentSong.artist}

+

+ {currentSong.artist} {currentSong.album ? `· ${currentSong.album}` : ''} +

{SOURCES.find(s=>s.id===source)?.name} {loading ? : ( -
+
{Array.isArray(lists) && lists.map(list => (
handleListClick(list)}>