diff --git a/src/pages/home/Music.vue b/src/pages/home/Music.vue index 63a54a3..3c83c87 100644 --- a/src/pages/home/Music.vue +++ b/src/pages/home/Music.vue @@ -4,7 +4,7 @@
- MT创作的原声 + {{ music.name }}
@@ -24,15 +24,15 @@ @pulldown="loadData">
- +
-
MT创作的原声
+
{{ music.name }}
-
NT
-
>5585 人使用
+
{{ music.author }}
+
>{{ $likeNum(music.use_count) }} 人使用
@@ -2479,7 +2479,18 @@ export default { "status": 1 } } - ] + ], + + music: { + name: '发如雪', + mp3: 'https://m3.8js.net:99/2014/211204142150965.mp3', + cover: require('../../assets/img/music-cover/7.png'), + author: '周杰伦', + duration: 60, + use_count: 37441000, + is_collect: false, + is_play: false, + } } }, watch: { @@ -2499,6 +2510,9 @@ export default { } }, created() { + if (this.$route.query.name) { + this.music = this.$route.query + } this.videos = this.videos.concat(this.videos2).concat(this.videos3) }, computed: {}, @@ -2513,12 +2527,11 @@ export default { this.loading = false }, togglePlay() { - let src = 'https://m3.8js.net:99/2014/211204142150965.mp3' this.isPlay = !this.isPlay if (this.isPlay) { - this.audio.pause() - this.audio.src = src - this.audio.currentTime = 0 + if (!this.audio.src) { + this.audio.src = this.music.mp3 + } this.audio.play(); this.audio.addEventListener('ended', () => this.isPlay = false) } else { @@ -2532,7 +2545,6 @@ export default { }, stopPlay() { this.audio.pause() - this.audio.currentTime = 0 this.audio.removeEventListener('ended', null) } }, @@ -2629,6 +2641,7 @@ export default { .cover { width: 12rem; + object-fit: cover; height: 100%; border-radius: .3rem; } diff --git a/src/pages/home/MusicRankList.vue b/src/pages/home/MusicRankList.vue index 6ce5fdc..4a09e30 100644 --- a/src/pages/home/MusicRankList.vue +++ b/src/pages/home/MusicRankList.vue @@ -526,6 +526,7 @@ export default { border-radius: .2rem; @width: 6rem; width: @width; + object-fit: cover; height: @width; } } diff --git a/src/pages/me/collect/MusicCollect.vue b/src/pages/me/collect/MusicCollect.vue index a77ea37..b33d19b 100644 --- a/src/pages/me/collect/MusicCollect.vue +++ b/src/pages/me/collect/MusicCollect.vue @@ -23,11 +23,12 @@
- +
- + +
@@ -46,7 +47,7 @@
- 使用 + 使用
@@ -61,6 +62,7 @@ export default { props: {}, data() { return { + loading: false, list: [], audio: new Audio(), currentItem: null, @@ -85,7 +87,9 @@ export default { }, methods: { async getData() { + this.loading = true let res = await this.$api.videos.collect() + this.loading = false if (res.code === this.SUCCESS) { this.list = res.data.music.list } @@ -172,6 +176,7 @@ export default { border-radius: .2rem; @width: 6rem; width: @width; + object-fit: cover; height: @width; } } @@ -260,6 +265,7 @@ export default { .cover { border-radius: .2rem; + object-fit: cover; @width: 5rem; width: @width; height: @width;