add artist images back
This commit is contained in:
parent
76f640a088
commit
a2f82d65d7
4 changed files with 51 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
|||
<script type="text/x-template" id="artist-chip">
|
||||
<div class="artist-chip" @click.self="route">
|
||||
<div class="artist-chip__image">
|
||||
<mediaitem-artwork v-if="artist.id != null" :url="artist.attributes.artwork.url" :size="32"></mediaitem-artwork>
|
||||
<mediaitem-artwork v-if="artist.id != null" :url="artistimage" :size="32"></mediaitem-artwork>
|
||||
</div>
|
||||
<div class="artist-chip__name">
|
||||
<span>{{ item.attributes.name }}</span>
|
||||
|
@ -16,24 +16,30 @@
|
|||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
required: true
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
artist: {
|
||||
id: null
|
||||
}
|
||||
},
|
||||
artistimage : ''
|
||||
}
|
||||
},
|
||||
template: '#artist-chip',
|
||||
async mounted() {
|
||||
let artistId = this.item.id
|
||||
let artistId = this.item.id
|
||||
|
||||
if(typeof this.item.relationships.catalog == "object") {
|
||||
artistId = this.item.relationships.catalog.data[0].id
|
||||
}
|
||||
app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/artists/${artistId}`).then(response => {
|
||||
app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/artists/${artistId}`).then(async (response) => {
|
||||
this.artist = response.data.data[0];
|
||||
if (this.artistimage == '' && artistId != null){
|
||||
this.artistimage = (await this.$root.loadArtistImage(artistId) ?? '').replace('300x300','50x50')
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</div>
|
||||
<div class="artwork" @click='app.routeView(item)'>
|
||||
<mediaitem-artwork
|
||||
:url="getArtworkUrl()"
|
||||
:url="mainimageurl"
|
||||
:video="(item.attributes != null && item.attributes.editorialVideo != null) ? (item.attributes.editorialVideo.motionDetailSquare ? item.attributes.editorialVideo.motionDetailSquare.video : (item.attributes.editorialVideo.motionSquareVideo1x1 ? item.attributes.editorialVideo.motionSquareVideo1x1.video : '')) : '' "
|
||||
:size="size"
|
||||
shadow="subtle"
|
||||
|
@ -77,7 +77,8 @@
|
|||
app: this.$root,
|
||||
badges: this.$root.socialBadges.badgeMap,
|
||||
itemBadges: [],
|
||||
unavailable: false
|
||||
unavailable: false,
|
||||
mainimageurl: '',
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
|
@ -91,6 +92,7 @@
|
|||
this.unavailable = true
|
||||
}
|
||||
}
|
||||
this.getMainImage()
|
||||
},
|
||||
methods: {
|
||||
getBgColor() {
|
||||
|
@ -205,7 +207,10 @@
|
|||
);
|
||||
},
|
||||
getArtworkUrl(size = -1, includeUrl = false) {
|
||||
let artwork = this.item.attributes.artwork ? this.item.attributes.artwork.url : ''
|
||||
let artwork = this.item.attributes?.artwork ? this.item.attributes.artwork?.url : ''
|
||||
// if (artwork == '' && this.item.type == "artists" && this.item.id != null) {
|
||||
// artwork = (await app.loadArtistImage(this.item.id)).toString();
|
||||
// }
|
||||
if(size != -1) {
|
||||
artwork = artwork.replace('{w}', size).replace('{h}', size).replace('{f}', "webp").replace('{c}', ((size === 900) ? "sr" : "cc"))
|
||||
}
|
||||
|
@ -220,6 +225,12 @@
|
|||
return `url("${artwork}")`
|
||||
}
|
||||
},
|
||||
async getMainImage(){
|
||||
this.mainimageurl = this.getArtworkUrl()
|
||||
if (this.mainimageurl == '' && this.item.id != null && this.item.type == "artists") {
|
||||
this.mainimageurl = await this.app.loadArtistImage(this.item.id)
|
||||
}
|
||||
},
|
||||
getClasses() {
|
||||
let type = this.item.type
|
||||
if (this.kind != "") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue