This commit is contained in:
Folltoshe 2023-04-27 22:23:29 +08:00
parent 1e94207bf0
commit 25ce6b7c04
5 changed files with 15 additions and 20 deletions

View File

@ -62,7 +62,7 @@ export const setSelectListInfo = (info: ListInfoItem) => {
selectListInfo.id = info.id
selectListInfo.img = info.img
selectListInfo.name = info.name
selectListInfo.play_count = info.play_count
selectListInfo.playCountInfo = info.playCountInfo
selectListInfo.source = info.source
}
export const clearListDetail = () => {

View File

@ -35,10 +35,15 @@ export declare interface TagInfo<Source extends LX.OnlineSource = LX.OnlineSourc
type Tags = Partial<Record<LX.OnlineSource, TagInfo>>
interface PlayCountInfo {
count: number,
language: string
}
export const tags = shallowReactive<Tags>({})
export declare interface ListInfoItem {
playCountInfo: { count: number, language: string }
playCountInfo: PlayCountInfo
id: string
author: string
name: string
@ -75,7 +80,7 @@ export declare interface ListDetailInfo {
img?: string
desc?: string
author?: string
play_count?: string
playCountInfo?: PlayCountInfo
}
noItemLabel: string
}

View File

@ -1,5 +1,5 @@
import { httpFetch } from '../../request'
import { formatPlayTime, toMD5 } from '../../index'
import { formatPlayTime, toMD5, formatPlayCount } from '../../index'
import CryptoJS from 'crypto-js'
export default {
@ -161,19 +161,9 @@ export default {
})
},
/**
* 格式化播放数量
* @param {*} num
*/
formatPlayCount(num) {
if (num > 100000000) return parseInt(num / 10000000) / 10 + '亿'
if (num > 10000) return parseInt(num / 1000) / 10 + '万'
return num
},
filterList(rawData) {
return rawData.map(item => ({
play_count: this.formatPlayCount(item.listen_num),
playCountInfo: formatPlayCount(item.listen_num),
id: item.list_id,
author: item.username,
name: item.title,
@ -206,7 +196,7 @@ export default {
img: body.result.info.list_pic,
desc: body.result.info.list_desc,
author: body.result.info.userinfo.username,
play_count: this.formatPlayCount(body.result.listen_num),
playCountInfo: formatPlayCount(body.result.listen_num),
},
}
})

View File

@ -29,7 +29,7 @@ export default {
image: albumInfo.sizable_cover.replace('{size}', 240),
desc: albumInfo.intro,
authorName: albumInfo.author_name,
// play_count: this.formatPlayCount(info.count),
// playCountInfo: this.formatPlayCount(info.count),
}
},
/**
@ -56,7 +56,7 @@ export default {
img: info.image,
desc: info.desc,
author: info.authorName,
// play_count: this.formatPlayCount(info.count),
// playCountInfo: this.formatPlayCount(info.count),
},
}
},

View File

@ -96,7 +96,7 @@ export default {
img: body.img || body.hts_img,
desc: decodeName(body.info),
author: decodeName(body.artist),
// play_count: this.formatPlayCount(body.playnum),
// playCountInfo: this.formatPlayCount(body.playnum),
},
}
})
@ -122,7 +122,7 @@ export default {
// // img: data.pic,
// // desc: data.albuminfo,
// // author: data.artist,
// // play_count: this.formatPlayCount(data.playCnt),
// // playCountInfo: this.formatPlayCount(data.playCnt),
// // },
// // }
// })