* Update playlist page thumbnail to start playing first video on click (#1361)
This commit is contained in:
parent
78b6adeb5e
commit
825bec1a81
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
.playlistThumbnail img {
|
.playlistThumbnail img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.playlistChannel {
|
.playlistChannel {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { mapActions } from 'vuex'
|
||||||
import FtListDropdown from '../ft-list-dropdown/ft-list-dropdown.vue'
|
import FtListDropdown from '../ft-list-dropdown/ft-list-dropdown.vue'
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
name: 'FtElementList',
|
name: 'PlaylistInfo',
|
||||||
components: {
|
components: {
|
||||||
'ft-list-dropdown': FtListDropdown
|
'ft-list-dropdown': FtListDropdown
|
||||||
},
|
},
|
||||||
|
@ -16,7 +16,7 @@ export default Vue.extend({
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
id: '',
|
id: '',
|
||||||
randomVideoId: '',
|
firstVideoId: '',
|
||||||
title: '',
|
title: '',
|
||||||
channelThumbnail: '',
|
channelThumbnail: '',
|
||||||
channelName: '',
|
channelName: '',
|
||||||
|
@ -59,20 +59,20 @@ export default Vue.extend({
|
||||||
thumbnail: function () {
|
thumbnail: function () {
|
||||||
switch (this.thumbnailPreference) {
|
switch (this.thumbnailPreference) {
|
||||||
case 'start':
|
case 'start':
|
||||||
return `https://i.ytimg.com/vi/${this.randomVideoId}/mq1.jpg`
|
return `https://i.ytimg.com/vi/${this.firstVideoId}/mq1.jpg`
|
||||||
case 'middle':
|
case 'middle':
|
||||||
return `https://i.ytimg.com/vi/${this.randomVideoId}/mq2.jpg`
|
return `https://i.ytimg.com/vi/${this.firstVideoId}/mq2.jpg`
|
||||||
case 'end':
|
case 'end':
|
||||||
return `https://i.ytimg.com/vi/${this.randomVideoId}/mq3.jpg`
|
return `https://i.ytimg.com/vi/${this.firstVideoId}/mq3.jpg`
|
||||||
default:
|
default:
|
||||||
return `https://i.ytimg.com/vi/${this.randomVideoId}/mqdefault.jpg`
|
return `https://i.ytimg.com/vi/${this.firstVideoId}/mqdefault.jpg`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
console.log(this.data)
|
console.log(this.data)
|
||||||
this.id = this.data.id
|
this.id = this.data.id
|
||||||
this.randomVideoId = this.data.randomVideoId
|
this.firstVideoId = this.data.firstVideoId
|
||||||
this.title = this.data.title
|
this.title = this.data.title
|
||||||
this.channelName = this.data.channelName
|
this.channelName = this.data.channelName
|
||||||
this.channelThumbnail = this.data.channelThumbnail
|
this.channelThumbnail = this.data.channelThumbnail
|
||||||
|
@ -113,6 +113,19 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
playFirstVideo() {
|
||||||
|
const playlistInfo = {
|
||||||
|
playlistId: this.id
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$router.push(
|
||||||
|
{
|
||||||
|
path: `/watch/${this.firstVideoId}`,
|
||||||
|
query: playlistInfo
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
goToChannel: function () {
|
goToChannel: function () {
|
||||||
this.$router.push({ path: `/channel/${this.channelId}` })
|
this.$router.push({ path: `/channel/${this.channelId}` })
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
:src="thumbnail"
|
:src="thumbnail"
|
||||||
|
@click="playFirstVideo"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<h2>
|
<h2>
|
||||||
|
|
|
@ -67,13 +67,11 @@ export default Vue.extend({
|
||||||
console.log('done')
|
console.log('done')
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|
||||||
const randomVideoIndex = Math.floor((Math.random() * result.items.length))
|
|
||||||
|
|
||||||
this.infoData = {
|
this.infoData = {
|
||||||
id: result.id,
|
id: result.id,
|
||||||
title: result.title,
|
title: result.title,
|
||||||
description: result.description ? result.description : '',
|
description: result.description ? result.description : '',
|
||||||
randomVideoId: result.items[randomVideoIndex].id,
|
firstVideoId: result.items[0].id,
|
||||||
viewCount: result.views,
|
viewCount: result.views,
|
||||||
videoCount: result.estimatedItemCount,
|
videoCount: result.estimatedItemCount,
|
||||||
lastUpdated: result.lastUpdated ? result.lastUpdated : '',
|
lastUpdated: result.lastUpdated ? result.lastUpdated : '',
|
||||||
|
@ -125,13 +123,11 @@ export default Vue.extend({
|
||||||
console.log('done')
|
console.log('done')
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|
||||||
const randomVideoIndex = Math.floor((Math.random() * result.videos.length) + 1)
|
|
||||||
|
|
||||||
this.infoData = {
|
this.infoData = {
|
||||||
id: result.playlistId,
|
id: result.playlistId,
|
||||||
title: result.title,
|
title: result.title,
|
||||||
description: result.description,
|
description: result.description,
|
||||||
randomVideoId: result.videos[randomVideoIndex].videoId,
|
firstVideoId: result.videos[0].videoId,
|
||||||
viewCount: result.viewCount,
|
viewCount: result.viewCount,
|
||||||
videoCount: result.videoCount,
|
videoCount: result.videoCount,
|
||||||
channelName: result.author,
|
channelName: result.author,
|
||||||
|
|
Loading…
Reference in New Issue