first commit
This commit is contained in:
84
dist/application/assets/js/page/PlayVideo.js
vendored
Normal file
84
dist/application/assets/js/page/PlayVideo.js
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
const { ipcRenderer } = require('electron');
|
||||
|
||||
class PlayVideo {
|
||||
constructor() {
|
||||
this.isShowMenu = false
|
||||
this.downVideo()
|
||||
this.initSwiper()
|
||||
this.ShowComment()
|
||||
this.ShowCommentList()
|
||||
this.SwiperIndex = 0;
|
||||
}
|
||||
|
||||
initSwiper() {
|
||||
let self = this;
|
||||
new Swiper ('.swiper-container', {
|
||||
direction: 'horizontal', // 垂直切换选项
|
||||
loop: false, // 循环模式选项
|
||||
// 如果需要分页器
|
||||
pagination: {
|
||||
el: '.swiper-pagination',
|
||||
},
|
||||
|
||||
// 如果需要前进后退按钮
|
||||
navigation: {
|
||||
nextEl: '.swiper-button-next',
|
||||
prevEl: '.swiper-button-prev',
|
||||
},
|
||||
on: {
|
||||
slideChange: function () {
|
||||
self.SwiperIndex = this.realIndex;
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
downVideo() {
|
||||
let self = this;
|
||||
$(".down_video").click(function () {
|
||||
// 当前播放的是图片
|
||||
if ($("#my-video").length == 0) {
|
||||
let allImg = $(".swiper-wrapper .swiper-slide img").eq(self.SwiperIndex)
|
||||
ipcRenderer.send('SaveFile', {
|
||||
url: allImg.attr("src")
|
||||
})
|
||||
// 当前播放的是视频
|
||||
} else {
|
||||
console.log("下载视频")
|
||||
ipcRenderer.send('SaveFile', {
|
||||
url: $("#my-video").attr("src")
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 展开评论弹窗
|
||||
* @constructor
|
||||
*/
|
||||
ShowComment() {
|
||||
$(".down_comment").click(() => {
|
||||
if (this.isShowMenu) {
|
||||
$(".comment_list").animate({ right: '-256px'})
|
||||
this.isShowMenu = false
|
||||
} else {
|
||||
$(".comment_list").animate({ right: 0})
|
||||
this.isShowMenu = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看更多评论
|
||||
* @constructor
|
||||
*/
|
||||
ShowCommentList() {
|
||||
$(".view_other").click(function () {
|
||||
$(this).next().toggle({
|
||||
'display': 'block'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
new PlayVideo();
|
||||
Reference in New Issue
Block a user