2017-10-02 23:01:37 +00:00
|
|
|
import { secondsToHis } from '@/utils'
|
|
|
|
import config from '@/config'
|
2017-04-23 16:01:02 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
computed: {
|
|
|
|
length () {
|
|
|
|
return this.artist.songs.reduce((acc, song) => {
|
|
|
|
return acc + song.length
|
|
|
|
}, 0)
|
|
|
|
},
|
|
|
|
|
|
|
|
fmtLength () {
|
|
|
|
return secondsToHis(this.length)
|
|
|
|
},
|
|
|
|
|
|
|
|
image () {
|
|
|
|
if (!this.artist.image) {
|
|
|
|
this.artist.image = config.unknownCover
|
|
|
|
|
|
|
|
this.artist.albums.every(album => {
|
|
|
|
// If there's a "real" cover, use it.
|
|
|
|
if (album.image !== config.unknownCover) {
|
|
|
|
this.artist.image = album.cover
|
|
|
|
// I want to break free.
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.artist.image
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|