mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 13:48:02 +00:00
fix: bugs
This commit is contained in:
parent
872fd73b05
commit
4f4f2b09e3
9 changed files with 85 additions and 29 deletions
|
|
@ -100,6 +100,7 @@ img {
|
|||
border-radius: 0.75em;
|
||||
width: 100%;
|
||||
user-select: none;
|
||||
aspect-ratio: 1 / 1;
|
||||
}
|
||||
|
||||
.cover-hover {
|
||||
|
|
@ -156,6 +157,7 @@ img {
|
|||
z-index: -1;
|
||||
background-size: cover;
|
||||
border-radius: 0.75em;
|
||||
aspect-ratio: 1 / 1;
|
||||
}
|
||||
|
||||
.fade-enter-active,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
:imageUrl="getImageUrl(item)"
|
||||
:type="type"
|
||||
:id="item.id"
|
||||
:playButtonSize="type === 'artist' ? 26 : 22"
|
||||
:playButtonSize="type === 'artist' ? 26 : playButtonSize"
|
||||
/>
|
||||
<div class="text">
|
||||
<div class="info" v-if="showPlayCount">
|
||||
|
|
@ -55,6 +55,7 @@ export default {
|
|||
showPlayCount: { type: Boolean, default: false },
|
||||
columnNumber: { type: Number, default: 5 },
|
||||
gap: { type: String, default: "44px 24px" },
|
||||
playButtonSize: { type: Number, default: 22 },
|
||||
},
|
||||
computed: {
|
||||
rowStyles() {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,16 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { mapMutations, mapState } from "vuex";
|
||||
import { mapMutations, mapState, mapActions } from "vuex";
|
||||
import { dailyRecommendTracks } from "@/api/playlist";
|
||||
import { isAccountLoggedIn } from "@/utils/auth";
|
||||
import { sample } from "lodash";
|
||||
|
||||
const defaultCovers = [
|
||||
"https://p2.music.126.net/0-Ybpa8FrDfRgKYCTJD8Xg==/109951164796696795.jpg",
|
||||
"https://p2.music.126.net/QxJA2mr4hhb9DZyucIOIQw==/109951165422200291.jpg",
|
||||
"https://p1.music.126.net/AhYP9TET8l-VSGOpWAKZXw==/109951165134386387.jpg",
|
||||
];
|
||||
|
||||
export default {
|
||||
name: "DailyTracksCard",
|
||||
|
|
@ -31,26 +39,33 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
...mapState(["dailyTracks"]),
|
||||
coverUrl() {
|
||||
return this.dailyTracks[0]?.al.picUrl || sample(defaultCovers);
|
||||
},
|
||||
cardStyles() {
|
||||
return {
|
||||
background:
|
||||
this.dailyTracks.length !== 0
|
||||
? `no-repeat url("${this.dailyTracks[0].al.picUrl}?param=1024y1024") center/cover`
|
||||
: "",
|
||||
background: `no-repeat url("${this.coverUrl}?param=1024y1024") center/cover`,
|
||||
};
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapActions(["showToast"]),
|
||||
...mapMutations(["updateDailyTracks"]),
|
||||
loadDailyTracks() {
|
||||
dailyRecommendTracks().then((result) => {
|
||||
this.updateDailyTracks(result.data.dailySongs);
|
||||
});
|
||||
dailyRecommendTracks()
|
||||
.then((result) => {
|
||||
this.updateDailyTracks(result.data.dailySongs);
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
goToDailyTracks() {
|
||||
this.$router.push({ name: "dailySongs" });
|
||||
},
|
||||
playDailyTracks() {
|
||||
if (!isAccountLoggedIn()) {
|
||||
this.showToast("此操作需要登录网易云账号");
|
||||
return;
|
||||
}
|
||||
let trackIDs = this.dailyTracks.map((t) => t.id);
|
||||
this.$store.state.player.replacePlaylist(
|
||||
trackIDs,
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ export default {
|
|||
return isLooseLoggedIn();
|
||||
},
|
||||
avatarUrl() {
|
||||
return this.data.user.avatarUrl
|
||||
? `${this.data.user.avatarUrl}?param=512y512`
|
||||
return this.data?.user?.avatarUrl && this.isLooseLoggedIn
|
||||
? `${this.data?.user?.avatarUrl}?param=512y512`
|
||||
: "http://s4.music.126.net/style/web2/img/default/default_avatar.jpg?param=60y60";
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue