😅 解决收藏夹点击播放,没有历史记录的问题

This commit is contained in:
hunlongyu
2020-05-29 11:52:09 +08:00
parent 010b488340
commit 7aee9b9fbe
5 changed files with 91 additions and 66 deletions

View File

@@ -29,18 +29,20 @@
3. 新增历史播放记录, 并记录播放进度
4. 新增分享功能. 一键分享海报图片
5. 新增精简模式. 支持修改透明度
6. 全新布局配色
7. 新增多语言
8. 下载功能
9. 更详细的视频分类
10. 收藏夹同步更新视频追剧
11. 后台自动更
6. 收藏夹同步更新视频追剧
7. 支持演员名称搜索
8. 更详细的视频分类
9. 后台自动更新
10. 全新布局配色
11.增多语言
12. 全局快捷键
13. 支持演员名称搜索
13. 下载功能
14. ...
觉得软件不错的, 点击右上角 star 收藏关注一波呀~
> Tips: 资源加载不出来时, 点击列表下方链接, 浏览器打开一下网站. 原理是需要通过网站的人机检测.
#### 全局快捷键:
| 快捷键 | 说明 | 主界面 | 小窗口 |

View File

@@ -1,6 +1,6 @@
{
"name": "zy",
"version": "1.0.11",
"version": "1.0.12",
"private": true,
"author": {
"name": "Hunlongyu",

View File

@@ -69,7 +69,7 @@
</div>
<div class="tFooter">
<span class="tFooter-span">今日更新: {{ tb.update }} </span>
<span class="tFooter-span btn" @click="goWebsite">前往该资源网</span>
<span class="tFooter-span btn" @click="goWebsite">加载不出来,点这里</span>
<el-pagination small :page-size="tb.size" :total="tb.total" :current-page="tb.page" @current-change="tbPageChange" layout="total, prev, pager, next, jumper"></el-pagination>
</div>
</div>

View File

@@ -210,44 +210,48 @@ export default {
this.xg.pause()
}
this.changeVideo()
tools.detail_get(this.video.site, this.video.detail).then(res => {
this.name = this.video.name
this.right.listData = res.m3u8_urls
if (res.m3u8_urls.length > 1) {
const m3 = res.m3u8_urls
history.find({ detail: this.video.detail }).then(item => {
let index = 1
let time = 0
if (item) {
index = item.index
if (this.video.index === index) {
time = item.currentTime
}
}
tools.detail_get(this.video.site, this.video.detail).then(res => {
this.name = this.video.name
this.right.listData = res.m3u8_urls
const m = res.m3u8_urls
const arr = []
for (const i of m3) {
for (const i of m) {
arr.push(i.split('$')[1])
}
this.length = arr.length
this.xg.src = arr[this.video.index]
this.showNext = true
} else {
const link = res.m3u8_urls[this.video.index]
const src = link.split('$')[1]
this.length = 1
this.xg.src = src
this.showNext = false
}
const currentTime = this.video.currentTime
if (currentTime !== '') {
this.xg.play()
this.xg.once('playing', () => {
this.xg.currentTime = currentTime
})
} else {
this.xg.play()
}
this.xg.once('play', () => {
this.mask = false
})
this.onPlayVideo()
this.xg.once('ended', () => {
if (res.m3u8_urls.length > 1 && (res.m3u8_urls.length - 1 > this.video.index)) {
this.video.currentTime = 0
this.video.index++
this.xg.src = arr[index]
this.showNext = this.length > 1
const currentTime = time
if (currentTime !== 0) {
this.xg.play()
this.xg.once('playing', () => {
this.xg.currentTime = currentTime
})
} else {
this.xg.play()
}
this.xg.off('ended')
this.xg.once('play', () => {
this.mask = false
})
this.onPlayVideo()
this.xg.once('ended', () => {
if (res.m3u8_urls.length > 1 && (res.m3u8_urls.length - 1 > this.video.index)) {
this.video.currentTime = 0
this.video.index++
}
this.xg.off('ended')
})
})
})
},
@@ -296,6 +300,14 @@ export default {
history.update(res.id, h)
}
})
video.find({ detail: d }).then(res => {
if (res) {
const h = { ...this.video }
delete h.id
delete h.currentTime
video.update(res.id, h)
}
})
}, 10000)
},
closeEvent () {

View File

@@ -1,32 +1,43 @@
import setting from '../dexie/setting'
const os = require('os')
const macadress = require('macaddress')
const macaddress = require('macaddress')
const AV = require('leancloud-storage')
setting.find().then(res => {
const cloud = res.cloud
if (!cloud) {
macadress.one((err, mac) => {
if (err) {
return false
}
const system = os.hostname() + ' ' + os.type() + ' ' + os.arch()
AV.init({
appId: 'X6TRIcMjgOG7EJ0t1l5r9In1-gzGzoHsz',
appKey: 'JmkGF9UqkWGQNYDcJ2g1QV1b',
serverURL: 'https://x6tricmj.lc-cn-n1-shared.com'
})
macaddress.one((err, mac) => {
if (err) {
return false
}
AV.init({
appId: 'X6TRIcMjgOG7EJ0t1l5r9In1-gzGzoHsz',
appKey: 'JmkGF9UqkWGQNYDcJ2g1QV1b',
serverURL: 'https://x6tricmj.lc-cn-n1-shared.com'
})
const system = os.hostname() + ' ' + os.type() + ' ' + os.arch()
const query = new AV.Query('ZYPlayer')
query.equalTo('os', system)
query.equalTo('mac', mac)
query.find().then(res => {
// 存储新用户数据
if (res.length === 0) {
const ZYPlayer = AV.Object.extend('ZYPlayer')
const zyPlayer = new ZYPlayer()
zyPlayer.set('os', system)
zyPlayer.set('mac', mac)
zyPlayer.save().then(e => {
const id = e.id
res.cloud = true
res.cloudKey = id
setting.update(res)
})
})
}
zyPlayer.save()
return false
}
// 统计启动次数
if (res.length === 1) {
const id = res[0].id
const times = AV.Object.createWithoutData('ZYPlayer', id)
times.increment('times', 1)
times.save()
return false
}
// 清除冗余数据
if (res.length > 1) {
const arr = res
arr.shift()
AV.Object.destroyAll(arr)
}
})
})