Skip to content

Commit

Permalink
视频播放提示增加名字
Browse files Browse the repository at this point in the history
  • Loading branch information
Sillywa committed Apr 22, 2020
1 parent 6b4fd2c commit 4bff720
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
20 changes: 13 additions & 7 deletions src/components/Dplayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@
hotkey: true,
preload: 'auto',
volume: 0.7
}
},
name: ""
}
},
methods: {
play(url) {
console.log("现在播放:",url)
play(video) {
console.log("现在播放:",video.playurl)
this.name = video.name
this.closeNotice()
this.dp = new DPlayer({
container: this.$refs.dplayer,
...this.options,
video: {
url: url,
url: video.url,
}
});
this.$Notice.info({
Expand All @@ -46,6 +48,7 @@
render: h => {
return h('span', [
'正在播放视频',
h('strong', this.name),
h('p',{
style: "paddingTop:10px"
},'点击右上角可关闭')
Expand All @@ -62,15 +65,19 @@
});
this.dp.play()
},
switch(url) {
switch(video) {
this.name = video.name
this.dp.switchVideo({
url: url
url: video.playurl
})
this.dp.play()
},
close() {
this.closeNotice()
this.dp.pause()
//this.dp.destroy()
this.$emit("closeVideo")
},
closeNotice() {
Expand Down Expand Up @@ -127,7 +134,6 @@
@media (min-width: 769px) {
.dplayer {
width: 600px;
}
}
</style>
24 changes: 7 additions & 17 deletions src/views/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -282,20 +282,6 @@ export default {
})
},
nextFile(index) {
// if(this.files.children[index].download_url) {
// // // 有下载链接直接下载
// console.log("下载",this.files.children[index].download_url)
// window.open(this.files.children[index].download_url, "_blank")
// } else {
// if(this.path.length == 1) {
// this.hash = this.hash + this.files.children[index].name
// } else {
// this.hash = this.hash + '/' + this.files.children[index].name
// }
// window.location.hash = this.hash
// }
if(this.path.length == 1) {
this.hash = this.hash + this.files.children[index].name
} else {
Expand Down Expand Up @@ -347,11 +333,15 @@ export default {
},
playVideo(playurl,index) {
// 如果没有正在播放的视频
let video = {
playurl: playurl,
name: this.files.children[index].name
}
if(!this.video.show) {
this.video.index = index
this.video.show = true
this.video.hash = this.hash
this.$refs.mydplayer.play(playurl)
this.$refs.mydplayer.play(video)
} else {
//如果有正在播放的视频,判断当前文件夹是否为正在播放的视频的文件夹
if(this.video.hash == this.hash) {
Expand All @@ -363,13 +353,13 @@ export default {
} else {
// 点击的是不同的视频,switch
this.video.index = index
this.$refs.mydplayer.switch(playurl)
this.$refs.mydplayer.switch(video)
}
} else {
// 不是正在播放的文件夹,switchVideo
this.video.index = index
this.$refs.mydplayer.switch(playurl)
this.$refs.mydplayer.switch(video)
this.video.hash = this.hash
}
Expand Down

0 comments on commit 4bff720

Please sign in to comment.