🐞 fix: 修复歌单歌曲数量异常 #303

This commit is contained in:
imsyy
2024-12-02 11:38:21 +08:00
parent 71a282157d
commit 852b901353
4 changed files with 601 additions and 569 deletions

View File

@@ -20,7 +20,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
node-version: "22.x"
# 复制环境变量文件
- name: Copy .env.example
run: |

View File

@@ -49,7 +49,7 @@
"@pixi/sprite": "^7.4.2",
"@vueuse/core": "^10.11.1",
"NeteaseCloudMusicApi": "^4.25.0",
"axios": "^1.7.7",
"axios": "^1.7.8",
"change-case": "^5.4.4",
"dayjs": "^1.11.13",
"electron-dl": "^3.5.2",
@@ -57,16 +57,16 @@
"electron-updater": "^6.3.9",
"file-saver": "^2.0.5",
"font-list": "^1.5.1",
"github-markdown-css": "^5.7.0",
"github-markdown-css": "^5.8.1",
"howler": "^2.2.4",
"js-cookie": "^3.0.5",
"jss": "^10.10.0",
"jss-preset-default": "^10.10.0",
"localforage": "^1.10.0",
"lodash-es": "^4.17.21",
"marked": "^14.1.3",
"marked": "^14.1.4",
"music-metadata": "7.14.0",
"pinia": "^2.2.6",
"pinia": "^2.2.8",
"pinia-plugin-persistedstate": "^3.2.3",
"plyr": "^3.7.8",
"vue-virt-list": "^1.5.5"
@@ -82,33 +82,33 @@
"@types/file-saver": "^2.0.7",
"@types/howler": "^2.2.12",
"@types/js-cookie": "^3.0.6",
"@types/node": "^22.9.0",
"@typescript-eslint/eslint-plugin": "^8.13.0",
"@typescript-eslint/parser": "^8.13.0",
"@vitejs/plugin-vue": "^5.1.4",
"@types/node": "^22.10.1",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"@vitejs/plugin-vue": "^5.2.1",
"ajv": "^8.17.1",
"crypto-js": "^4.2.0",
"electron": "^30.5.1",
"electron-builder": "^25.1.8",
"electron-log": "^5.2.0",
"electron-log": "^5.2.3",
"electron-vite": "^2.3.0",
"eslint": "^9.14.0",
"eslint-plugin-vue": "^9.30.0",
"eslint": "^9.16.0",
"eslint-plugin-vue": "^9.32.0",
"fast-glob": "^3.3.2",
"fastify": "^4.28.1",
"naive-ui": "^2.40.1",
"naive-ui": "^2.40.3",
"node-taglib-sharp": "^5.2.3",
"prettier": "^3.3.3",
"sass": "^1.80.6",
"prettier": "^3.4.1",
"sass": "^1.81.0",
"terser": "^5.36.0",
"typescript": "^5.6.3",
"unplugin-auto-import": "^0.18.3",
"unplugin-vue-components": "^0.27.4",
"vite": "^5.4.10",
"typescript": "^5.7.2",
"unplugin-auto-import": "^0.18.6",
"unplugin-vue-components": "^0.27.5",
"vite": "^5.4.11",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-wasm": "^3.3.0",
"vue": "^3.5.12",
"vue-router": "^4.4.5",
"vue": "^3.5.13",
"vue-router": "^4.5.0",
"vue-tsc": "^2.1.10"
},
"pnpm": {

1118
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -355,21 +355,24 @@ const handleLocalPlaylist = (id: number) => {
// 获取在线歌单
const handleOnlinePlaylist = async (id: number, getList: boolean, refresh: boolean) => {
console.log(id, getList, refresh);
// 获取歌单详情
const detail = await playlistDetail(id);
playlistDetailData.value = formatCoverList(detail.playlist)[0];
const count = playlistDetailData.value?.count || 0;
// 不需要获取列表或无歌曲
if (!getList || playlistDetailData.value.count === 0) {
if (!getList || count === 0) {
loading.value = false;
return;
}
// 如果已登录且歌曲数量少于 800直接加载所有歌曲
if (isLogin() === 1 && (playlistDetailData.value?.count as number) < 800) {
if (isLogin() === 1 && count === detail.privileges?.length && count < 800) {
const ids = detail.privileges.map((song: any) => song.id as number);
const result = await songDetail(ids);
playlistData.value = formatSongsList(result.songs);
} else {
await getPlaylistAllSongs(id, playlistDetailData.value.count || 0, refresh);
await getPlaylistAllSongs(id, count, refresh);
}
loading.value = false;
};
@@ -424,7 +427,6 @@ const loadingMsgShow = (show: boolean = true, count?: number) => {
closable: true,
});
} else {
loading.value = false;
loadingMsg.value?.destroy();
loadingMsg.value = null;
}