支持加载大于1000首歌的歌单
parent
9cebaa0d97
commit
9eec1adf77
|
@ -83,10 +83,12 @@ export default {
|
||||||
})
|
})
|
||||||
const { statusCode, body } = await this._requestObj_listDetail.promise
|
const { statusCode, body } = await this._requestObj_listDetail.promise
|
||||||
if (statusCode !== 200 || body.code !== this.successCode) return this.getListDetail(id, page, ++tryNum)
|
if (statusCode !== 200 || body.code !== this.successCode) return this.getListDetail(id, page, ++tryNum)
|
||||||
console.log(body)
|
let limit = 1000
|
||||||
|
let rangeStart = (page - 1) * limit
|
||||||
|
// console.log(body)
|
||||||
let musicDetail
|
let musicDetail
|
||||||
try {
|
try {
|
||||||
musicDetail = await musicDetailApi.getList(body.playlist.trackIds.map(trackId => trackId.id))
|
musicDetail = await musicDetailApi.getList(body.playlist.trackIds.slice(rangeStart, limit * page).map(trackId => trackId.id))
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
if (err.message == 'try max num') {
|
if (err.message == 'try max num') {
|
||||||
|
@ -95,12 +97,12 @@ export default {
|
||||||
return this.getListDetail(id, page, ++tryNum)
|
return this.getListDetail(id, page, ++tryNum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(musicDetail)
|
// console.log(musicDetail)
|
||||||
return {
|
return {
|
||||||
list: musicDetail.list,
|
list: musicDetail.list,
|
||||||
page,
|
page,
|
||||||
limit: this.limit_song,
|
limit,
|
||||||
total: musicDetail.list.length,
|
total: body.playlist.trackIds.length,
|
||||||
source: 'wy',
|
source: 'wy',
|
||||||
info: {
|
info: {
|
||||||
play_count: this.formatPlayCount(body.playlist.playCount),
|
play_count: this.formatPlayCount(body.playlist.playCount),
|
||||||
|
|
Loading…
Reference in New Issue