如果有数据 发送get请求
song.map((song))映射拿到mid
url会变化
vkey加密策略 增加过滤(筛选播放
import { get } from "./base"
export function processSongs(songs) {
if (!songs.length) {
return Promise.resolve(songs)
}
return get('/api/getSongsUrl', {
mid: songs.map((song) => {
return song.mid
})
}).then((result) => {
const map = result.map
return songs.map((song) => {
song.url = map[song.mid]
return song
}).filter((song) => {
return song.url.indexOf('vkey') > -1
})
})
}
singer-detail增加逻辑
import { getSingerDetail } from '@/service/singer'
import { processSongs } from '@/service/song';
export default {
name: 'singer-detail',
props: {
singer: Object
},
async created() {
const result = await getSingerDetail(this.singer)
const songs = await processSongs(result.songs)
}
}