fix: bugs

This commit is contained in:
qier222 2021-01-05 22:21:01 +08:00
parent 15ac2b5815
commit db14c9283f
11 changed files with 64 additions and 25 deletions

View file

@ -6,11 +6,7 @@
:key="item.id"
:class="{ artist: type === 'artist' }"
>
<Cover
:imageUrl="item.img1v1Url || item.picUrl || item.coverImgUrl"
:type="type"
:id="item.id"
/>
<Cover :imageUrl="getImageUrl(item)" :type="type" :id="item.id" />
<div class="text">
<div class="info" v-if="showPlayCount">
<span class="play-count"
@ -86,8 +82,18 @@ export default {
return this.type === "album" && item.mark === 1056768;
},
getTitleLink(item) {
let type = this.type === "chart" ? "playlist" : this.type;
return `/${type}/${item.id}`;
return `/${this.type}/${item.id}`;
},
getImageUrl(item) {
if (item.img1v1Url) {
let img1v1ID = item.img1v1Url.split("/");
img1v1ID = img1v1ID[img1v1ID.length - 1];
if (img1v1ID === "5639395138885805.jpg") {
// img1v1Url 😅😅😅
return "https://p2.music.126.net/VnZiScyynLG7atLIZ2YPkw==/18686200114669622.jpg?param=512x512";
}
}
return item.img1v1Url || item.picUrl || item.coverImgUrl;
},
},
};

View file

@ -28,9 +28,10 @@
</ContextMenu>
<div :style="listStyles">
<TrackListItem
v-for="track in tracks"
v-for="(track, index) in tracks"
:track="track"
:key="track.id"
:key="itemKey === 'id' ? track.id : `${track.id}${index}`"
:highlightPlayingTrack="highlightPlayingTrack"
@dblclick.native="playThisList(track.id)"
@click.right.native="openMenu($event, track)"
/>
@ -81,6 +82,14 @@ export default {
type: Number,
default: 4,
},
highlightPlayingTrack: {
type: Boolean,
default: true,
},
itemKey: {
type: String,
default: "id",
},
},
data() {
return {

View file

@ -8,7 +8,7 @@
@mouseleave="hover = false"
>
<img
:src="imgUrl | resizeImage(224)"
:src="imgUrl"
v-if="!isAlbum"
@click="goToAlbum"
:class="{ hover: focus }"
@ -89,6 +89,10 @@ export default {
components: { ArtistsInLine, ExplicitSymbol },
props: {
track: Object,
highlightPlayingTrack: {
type: Boolean,
default: true,
},
},
data() {
return { hover: false, trackStyle: {} };
@ -96,9 +100,11 @@ export default {
computed: {
...mapState(["settings"]),
imgUrl() {
if (this.track.al !== undefined) return this.track.al.picUrl;
if (this.track.album !== undefined) return this.track.album.picUrl;
return "";
let image =
this.track?.al?.picUrl ??
this.track?.album?.picUrl ??
"https://p2.music.126.net/UeTuwE7pvjBpypWLudqukA==/3132508627578625.jpg";
return image + "?param=224y224";
},
artists() {
if (this.track.ar !== undefined) return this.track.ar;
@ -127,7 +133,8 @@ export default {
let trackClass = [this.type];
if (!this.track.playable && this.settings.showUnavailableSongInGreyStyle)
trackClass.push("disable");
if (this.isPlaying) trackClass.push("playing");
if (this.isPlaying && this.highlightPlayingTrack)
trackClass.push("playing");
if (this.focus) trackClass.push("focus");
return trackClass;
},