feat: 歌曲下载内置封面歌词歌曲信息等,添加无限制下载功能,优化下载管理,支持清空下载记录

This commit is contained in:
alger
2025-04-10 00:26:58 +08:00
parent 5f4b53c167
commit 3b1488f147
14 changed files with 370 additions and 34 deletions
+7 -2
View File
@@ -5,6 +5,7 @@ import { ref } from 'vue';
import { getMusicLrc, getMusicUrl, getParsingMusicUrl } from '@/api/music';
import { useMusicHistory } from '@/hooks/MusicHistoryHook';
import { audioService } from '@/services/audioService';
import { useSettingsStore } from '@/store';
import type { ILyric, ILyricText, SongResult } from '@/type/music';
import { getImgUrl } from '@/utils';
import { getImageLinearBackground } from '@/utils/linearColor';
@@ -13,12 +14,16 @@ const musicHistory = useMusicHistory();
// 获取歌曲url
export const getSongUrl = async (id: any, songData: any, isDownloaded: boolean = false) => {
const { data } = await getMusicUrl(id, isDownloaded);
const settingsStore = useSettingsStore();
const { unlimitedDownload } = settingsStore.setData;
const { data } = await getMusicUrl(id, !unlimitedDownload);
let url = '';
let songDetail = null;
try {
if (data.data[0].freeTrialInfo || !data.data[0].url) {
const res = await getParsingMusicUrl(id, songData);
const res = await getParsingMusicUrl(id, cloneDeep(songData));
url = res.data.data.url;
songDetail = res.data.data;
} else {