优化音乐收藏页面
This commit is contained in:
parent
a5bf5939ca
commit
8cd7d857f4
@ -4,7 +4,7 @@
|
|||||||
<back mode="light" @click="$back"/>
|
<back mode="light" @click="$back"/>
|
||||||
<transition name="fade">
|
<transition name="fade">
|
||||||
<div class="center" v-if="isFixed">
|
<div class="center" v-if="isFixed">
|
||||||
<span class="f16">MT创作的原声</span>
|
<span class="f16">{{ music.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
@ -24,15 +24,15 @@
|
|||||||
@pulldown="loadData">
|
@pulldown="loadData">
|
||||||
<div class="desc">
|
<div class="desc">
|
||||||
<div class="cover-wrapper" @click="togglePlay()">
|
<div class="cover-wrapper" @click="togglePlay()">
|
||||||
<img class="cover" src="../../assets/img/poster/src1-bg.png" alt="">
|
<img class="cover" :src="$imgPreview(music.cover)" alt="">
|
||||||
<img v-if="!isPlay" src="../../assets/img/icon/play-white.png" alt="" class="play">
|
<img v-if="!isPlay" src="../../assets/img/icon/play-white.png" alt="" class="play">
|
||||||
<img v-if="isPlay" src="../../assets/img/icon/pause-white.png" alt="" class="play">
|
<img v-if="isPlay" src="../../assets/img/icon/pause-white.png" alt="" class="play">
|
||||||
</div>
|
</div>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<div class="name">MT创作的原声</div>
|
<div class="name">{{ music.name }}</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="user">NT</div>
|
<div class="user">{{ music.author }}</div>
|
||||||
<div class="peoples">>5585 人使用</div>
|
<div class="peoples">>{{ $likeNum(music.use_count) }} 人使用</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="collection" @click.stop="toggleCollect()">
|
<div class="collection" @click.stop="toggleCollect()">
|
||||||
<img v-if="isCollect" src="../../assets/img/icon/star-yellow.png">
|
<img v-if="isCollect" src="../../assets/img/icon/star-yellow.png">
|
||||||
@ -2479,7 +2479,18 @@ export default {
|
|||||||
"status": 1
|
"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: {
|
watch: {
|
||||||
@ -2499,6 +2510,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
if (this.$route.query.name) {
|
||||||
|
this.music = this.$route.query
|
||||||
|
}
|
||||||
this.videos = this.videos.concat(this.videos2).concat(this.videos3)
|
this.videos = this.videos.concat(this.videos2).concat(this.videos3)
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
@ -2513,12 +2527,11 @@ export default {
|
|||||||
this.loading = false
|
this.loading = false
|
||||||
},
|
},
|
||||||
togglePlay() {
|
togglePlay() {
|
||||||
let src = 'https://m3.8js.net:99/2014/211204142150965.mp3'
|
|
||||||
this.isPlay = !this.isPlay
|
this.isPlay = !this.isPlay
|
||||||
if (this.isPlay) {
|
if (this.isPlay) {
|
||||||
this.audio.pause()
|
if (!this.audio.src) {
|
||||||
this.audio.src = src
|
this.audio.src = this.music.mp3
|
||||||
this.audio.currentTime = 0
|
}
|
||||||
this.audio.play();
|
this.audio.play();
|
||||||
this.audio.addEventListener('ended', () => this.isPlay = false)
|
this.audio.addEventListener('ended', () => this.isPlay = false)
|
||||||
} else {
|
} else {
|
||||||
@ -2532,7 +2545,6 @@ export default {
|
|||||||
},
|
},
|
||||||
stopPlay() {
|
stopPlay() {
|
||||||
this.audio.pause()
|
this.audio.pause()
|
||||||
this.audio.currentTime = 0
|
|
||||||
this.audio.removeEventListener('ended', null)
|
this.audio.removeEventListener('ended', null)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -2629,6 +2641,7 @@ export default {
|
|||||||
|
|
||||||
.cover {
|
.cover {
|
||||||
width: 12rem;
|
width: 12rem;
|
||||||
|
object-fit: cover;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border-radius: .3rem;
|
border-radius: .3rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -526,6 +526,7 @@ export default {
|
|||||||
border-radius: .2rem;
|
border-radius: .2rem;
|
||||||
@width: 6rem;
|
@width: 6rem;
|
||||||
width: @width;
|
width: @width;
|
||||||
|
object-fit: cover;
|
||||||
height: @width;
|
height: @width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,11 +23,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="option">
|
<div class="option">
|
||||||
<img src="@/assets/img/icon/menu2-white.png" alt="" @click.stop="$nav('/home/music')">
|
<img src="@/assets/img/icon/menu2-white.png" alt="" @click.stop="$nav('/home/music', item)">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<no-more class="mb7r"/>
|
<Loading v-if="loading" :is-full-screen="false"/>
|
||||||
|
<no-more v-else class="mb7r"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="float-play-music" v-if="currentItem">
|
<div class="float-play-music" v-if="currentItem">
|
||||||
<div class="process" :style="{width : process + 'px'}"></div>
|
<div class="process" :style="{width : process + 'px'}"></div>
|
||||||
@ -46,7 +47,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="option">
|
<div class="option">
|
||||||
<b-button type="primary" size="small">使用</b-button>
|
<b-button type="primary" size="small" @click="$no">使用</b-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -61,6 +62,7 @@ export default {
|
|||||||
props: {},
|
props: {},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
loading: false,
|
||||||
list: [],
|
list: [],
|
||||||
audio: new Audio(),
|
audio: new Audio(),
|
||||||
currentItem: null,
|
currentItem: null,
|
||||||
@ -85,7 +87,9 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getData() {
|
async getData() {
|
||||||
|
this.loading = true
|
||||||
let res = await this.$api.videos.collect()
|
let res = await this.$api.videos.collect()
|
||||||
|
this.loading = false
|
||||||
if (res.code === this.SUCCESS) {
|
if (res.code === this.SUCCESS) {
|
||||||
this.list = res.data.music.list
|
this.list = res.data.music.list
|
||||||
}
|
}
|
||||||
@ -172,6 +176,7 @@ export default {
|
|||||||
border-radius: .2rem;
|
border-radius: .2rem;
|
||||||
@width: 6rem;
|
@width: 6rem;
|
||||||
width: @width;
|
width: @width;
|
||||||
|
object-fit: cover;
|
||||||
height: @width;
|
height: @width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,6 +265,7 @@ export default {
|
|||||||
|
|
||||||
.cover {
|
.cover {
|
||||||
border-radius: .2rem;
|
border-radius: .2rem;
|
||||||
|
object-fit: cover;
|
||||||
@width: 5rem;
|
@width: 5rem;
|
||||||
width: @width;
|
width: @width;
|
||||||
height: @width;
|
height: @width;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user