🐞 fix: 修复登录状态问题 修复播放退出登录的问题

This commit is contained in:
alger
2025-01-25 21:49:22 +08:00
parent 599b0251af
commit 4fa1295b84
6 changed files with 23 additions and 27 deletions
+12 -8
View File
@@ -14,15 +14,19 @@ export const getMusicQualityDetail = (id: number) => {
// 根据音乐Id获取音乐播放URl
export const getMusicUrl = async (id: number) => {
const res = await request.get('/song/download/url/v1', {
params: {
id,
level: store.state.setData.musicQuality || 'higher'
}
});
// 判断是否登录
if (store.state.user) {
const res = await request.get('/song/download/url/v1', {
params: {
id,
level: store.state.setData.musicQuality || 'higher',
cookie: `${localStorage.getItem('token')} os=pc;`
}
});
if (res.data.data.url) {
return { data: { data: [{ ...res.data.data }] } };
if (res.data.data.url) {
return { data: { data: [{ ...res.data.data }] } };
}
}
return await request.get('/song/url/v1', {