修复http post请求封装的bug
parent
a2f7547cdb
commit
507d495f3f
|
@ -72,7 +72,6 @@ const mutations = {
|
|||
state.list.limit = result.limit
|
||||
state.list.page = result.page
|
||||
state.list.key = key
|
||||
console.log(result)
|
||||
},
|
||||
setListDetail(state, { result, key }) {
|
||||
state.listDetail.list = result.list
|
||||
|
|
|
@ -48,8 +48,14 @@ export default {
|
|||
return `http://www2.kugou.kugou.com/yueku/v9/special/single/${id}-5-9999.html`
|
||||
},
|
||||
|
||||
getTagInfo(tagId) {
|
||||
|
||||
/**
|
||||
* 格式化播放数量
|
||||
* @param {*} num
|
||||
*/
|
||||
formatPlayCount(num) {
|
||||
if (num > 100000000) return parseInt(num / 10000000) / 10 + '亿'
|
||||
if (num > 10000) return parseInt(num / 1000) / 10 + '万'
|
||||
return num
|
||||
},
|
||||
filterInfoHotTag(rawData) {
|
||||
const result = []
|
||||
|
@ -112,19 +118,18 @@ export default {
|
|||
}
|
||||
)
|
||||
return this._requestObj_listRecommend.promise.then(({ body }) => {
|
||||
// if (body.status !== 1) return this.getSongListRecommend()
|
||||
if (body.status !== 1) return []
|
||||
return this.filterList(body.data)
|
||||
if (body.status !== 1) return this.getSongListRecommend()
|
||||
return this.filterList(body.data.special_list)
|
||||
})
|
||||
},
|
||||
filterList(rawData) {
|
||||
return rawData.map(item => ({
|
||||
play_count: item.total_play_count,
|
||||
play_count: item.total_play_count || this.formatPlayCount(item.play_count),
|
||||
id: item.specialid,
|
||||
author: item.nickname,
|
||||
name: item.specialname,
|
||||
time: item.publish_time,
|
||||
img: item.img,
|
||||
time: item.publish_time || item.publishtime,
|
||||
img: item.img || item.imgurl,
|
||||
grade: item.grade,
|
||||
desc: item.intro,
|
||||
}))
|
||||
|
@ -227,8 +232,8 @@ export default {
|
|||
)
|
||||
if (!tagId) tasks.push(this.getSongListRecommend()) // 如果是所有类别,则顺便获取推荐列表
|
||||
return Promise.all(tasks).then(([list, info, recommendList]) => {
|
||||
console.log(recommendList)
|
||||
if (recommendList) list.unshift(...recommendList)
|
||||
console.log(info)
|
||||
return {
|
||||
list,
|
||||
...info,
|
||||
|
|
|
@ -229,7 +229,9 @@ const fatchData = (url, method, options, callback) => {
|
|||
method,
|
||||
headers: Object.assign({}, headers, options.headers || {}),
|
||||
Origin: options.origin,
|
||||
data: options.data,
|
||||
body: options.body,
|
||||
form: options.form,
|
||||
formData: options.formData,
|
||||
timeout: options.timeout || 10000,
|
||||
json: options.format === undefined || options.format === 'json',
|
||||
}, (err, resp, body) => {
|
||||
|
|
|
@ -41,7 +41,6 @@ export default {
|
|||
watch: {
|
||||
sortId(n, o) {
|
||||
this.setSongList({ sortId: n })
|
||||
console.log(n)
|
||||
if (o === undefined && this.listPage !== 1) return
|
||||
this.getList(1).then(() => {
|
||||
this.listPage = this.listData.listPage
|
||||
|
|
Loading…
Reference in New Issue