音乐播放

This commit is contained in:
heixinyouzi 2024-05-31 15:07:36 +08:00
parent 674f67f5e5
commit 7d5f8a5288

View File

@ -27,22 +27,39 @@ const data = reactive({
},
});
onMounted(async () => {
// if (import.meta.env.VITE_APP_ENV != "development") {
const res = await $http.file.listMusic();
data.audio = [];
res.data.forEach(i => {
let name = i.split(".")[0];
let t = name.split("-");
let mid = name + "/"+ name
// 8834041785
const res = await fetch("http://met.hxyouzi.com/meting-api/?server=tencent&type=playlist&id=8834041785")
const mlist = await res.json()
data.audio = []
mlist.forEach(i => {
data.audio.push({
title: t[1],
author: t[0],
url: res.baseUrl + mid +'.mp3',
pic: res.baseUrl + mid + ".jpg",
lrc: res.baseUrl + mid + ".lrc",
title: i.name,
author: i.artist,
url: i.url,
pic: i.pic,
lrc: i.lrc,
});
console.log('>>>>>',data.audio);
});
// if (import.meta.env.VITE_APP_ENV != "development") {
// const res = await $http.file.listMusic();
// data.audio = [];
// res.data.forEach(i => {
// let name = i.split(".")[0];
// let t = name.split("-");
// let mid = name + "/"+ name
// data.audio.push({
// title: t[1],
// author: t[0],
// url: res.baseUrl + mid +'.mp3',
// pic: res.baseUrl + mid + ".jpg",
// lrc: res.baseUrl + mid + ".lrc",
// });
// console.log('>>>>>',data.audio);
// });
// } else {
// const d = {
// title: "",