Compare commits
122 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a03388d6b | ||
|
|
ef704a9d45 | ||
|
|
946978fa86 | ||
|
|
70b03e67fb | ||
|
|
1ee7c6f032 | ||
|
|
f2f58fb888 | ||
|
|
5286568801 | ||
|
|
2a9f8ed0dc | ||
|
|
eb3d064cb5 | ||
|
|
a0ec282cc2 | ||
|
|
ea61dca27b | ||
|
|
fd0be9e96b | ||
|
|
775247e28b | ||
|
|
ded5c39790 | ||
|
|
16e44d71bd | ||
|
|
ae0858319f | ||
|
|
3c6733648b | ||
|
|
06bd915964 | ||
|
|
dfcd786f53 | ||
|
|
d0f6282b81 | ||
|
|
ab3a6e1fd2 | ||
|
|
0cb540d3e5 | ||
|
|
1d0123d69f | ||
|
|
6dbcb8e621 | ||
|
|
b1a6d58974 | ||
|
|
bb45006ff7 | ||
|
|
e9f81faf70 | ||
|
|
b864c6ca15 | ||
|
|
9f98231eed | ||
|
|
3bcf5b1618 | ||
|
|
d7a6245f8a | ||
|
|
2abf2aeda7 | ||
|
|
c3129c7cee | ||
|
|
3b0ec94d2b | ||
|
|
9902d98342 | ||
|
|
b5f5baeb8f | ||
|
|
f396d5ea05 | ||
|
|
e616aa5e2a | ||
|
|
f041093fe9 | ||
|
|
e66c056283 | ||
|
|
d33bbcff06 | ||
|
|
992c2f152f | ||
|
|
118bc5058c | ||
|
|
19c11f2694 | ||
|
|
0a812ff6c4 | ||
|
|
1e6a98df88 | ||
|
|
b1b4e61244 | ||
|
|
2a05b2abdb | ||
|
|
74beb47ad5 | ||
|
|
325a7f3b0d | ||
|
|
9b5b5a1334 | ||
|
|
74dee7a892 | ||
|
|
d07436d876 | ||
|
|
e283152a89 | ||
|
|
bdeeccedb9 | ||
|
|
5931266770 | ||
|
|
bbeb75631d | ||
|
|
c0f4940289 | ||
|
|
db1b81243a | ||
|
|
97b6a8259f | ||
|
|
4c92ff9e70 | ||
|
|
b8dc7f4526 | ||
|
|
0d6e0d6e9f | ||
|
|
1a5bac68ad | ||
|
|
83e302aeb7 | ||
|
|
2196eaa68c | ||
|
|
40aae02af6 | ||
|
|
f078df6f8e | ||
|
|
ee44bfe0a8 | ||
|
|
9d9a808226 | ||
|
|
d78784c0d9 | ||
|
|
1ead8a5594 | ||
|
|
b63c8f4daf | ||
|
|
011400f714 | ||
|
|
1d725579de | ||
|
|
93749c3841 | ||
|
|
4b0c67b8fa | ||
|
|
165040872c | ||
|
|
27773be1c7 | ||
|
|
fadb50a28b | ||
|
|
518a9c3492 | ||
|
|
d5eb4dc49f | ||
|
|
e76bee574f | ||
|
|
b7779a3e6f | ||
|
|
4cb5b48985 | ||
|
|
b2128113ba | ||
|
|
58d0ae6da1 | ||
|
|
2bd821f59d | ||
|
|
8d002225fd | ||
|
|
0243c2f0fe | ||
|
|
b8edd7f440 | ||
|
|
4683aecf7b | ||
|
|
16d38ba2b4 | ||
|
|
fe7fe06d48 | ||
|
|
c1220ef752 | ||
|
|
f0c221a863 | ||
|
|
1df6726a3b | ||
|
|
1a9e939f9c | ||
|
|
39cb188604 | ||
|
|
aba4d12302 | ||
|
|
17c77fd48a | ||
|
|
1cfc12ec19 | ||
|
|
b0aa1dc28a | ||
|
|
0c12b394a7 | ||
|
|
9e468bc82e | ||
|
|
973a15b593 | ||
|
|
253c1e7723 | ||
|
|
7b44051190 | ||
|
|
a25ac77ebc | ||
|
|
d187167fbe | ||
|
|
b34347cf43 | ||
|
|
829d9447a4 | ||
|
|
39067c6a35 | ||
|
|
6dbb64a4f2 | ||
|
|
f8041290d2 | ||
|
|
f772ac2e9d | ||
|
|
ef485ef64a | ||
|
|
b164d5e83e | ||
|
|
8a5800df93 | ||
|
|
8cd2b920c8 | ||
|
|
5b4cb43aa5 | ||
|
|
de1472e668 |
20
README.md
@@ -46,6 +46,17 @@
|
||||
- 🍉 [蓝奏云 -- 快速下载](https://www.lanzoux.com/b04s6a3re) 密码:95px
|
||||
- 🍒 适用于32位操作系统的x86软件,在蓝奏云网盘里, 后缀名: ZY Player * 32位.exe
|
||||
|
||||
### 🎠 平台
|
||||
|
||||
| 平台 | 链接 |
|
||||
| :------------------------------------ | :---------------------------------------------------------- |
|
||||
| 🖥️ 电脑端 ( Windows & Mac & Linux ) | [ZY Player](https://github.com/Hunlongyu/ZY-Player) |
|
||||
| 📱 手机端 ( Android & IOS ) | [ZY Player APP](https://github.com/Hunlongyu/ZY-Player-APP) |
|
||||
| 📺 电视端 ( Android & Mac ) ( 进行中 ) | [ZY Player TV](https://github.com/cuiocean/ZY-Player-TV) |
|
||||
| 🌐 浏览器 ( Web ) | [ZY Player Web](https://github.com/Hunlongyu/ZY-Player-Web) |
|
||||
|
||||
|
||||
|
||||
### 🚀 快捷键
|
||||
|
||||
播放窗口 和 Mini窗口
|
||||
@@ -81,7 +92,8 @@
|
||||
|
||||
### 🍭 开发者
|
||||
|
||||
| [Hunlongyu](https://github.com/Hunlongyu) | [cuiocean](https://github.com/cuiocean) |
|
||||
| :----------------------------------------------------------: | :----------------------------------------------------------: |
|
||||
| <img width="120" src="https://avatars2.githubusercontent.com/u/15273630?s=460&u=48cf3299e2a842c0252233d8be42ef4c5d792138&v=4"/> | <img width="120" src="https://avatars0.githubusercontent.com/u/5760235?s=460&u=9d969dd8d83f069ce7ebd60516770c93ac07a330&v=4" /> |
|
||||
| 💻 🎨 🐛 | 💻 🐛 |
|
||||
| [Hunlongyu](https://github.com/Hunlongyu) | [cuiocean](https://github.com/cuiocean) | [buvta](https://github.com/buvta) |
|
||||
| :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: |
|
||||
| <img width="120" src="https://avatars2.githubusercontent.com/u/15273630?s=460&u=48cf3299e2a842c0252233d8be42ef4c5d792138&v=4"/> | <img width="120" src="https://avatars0.githubusercontent.com/u/5760235?s=460&u=9d969dd8d83f069ce7ebd60516770c93ac07a330&v=4" /> | <img width="120" src="https://avatars3.githubusercontent.com/u/12312540?s=400&v=4" /> |
|
||||
| 💻 🎨 🐛 | 💻 🐛 | 💻 🐛 |
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 166 KiB |
|
Before Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 224 KiB |
BIN
docs/assets/img/gallery/01.png
Normal file
|
After Width: | Height: | Size: 944 KiB |
BIN
docs/assets/img/gallery/02.png
Normal file
|
After Width: | Height: | Size: 927 KiB |
BIN
docs/assets/img/gallery/03.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
docs/assets/img/gallery/04.png
Normal file
|
After Width: | Height: | Size: 691 KiB |
BIN
docs/assets/img/gallery/05.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
docs/assets/img/gallery/06.png
Normal file
|
After Width: | Height: | Size: 152 KiB |
BIN
docs/assets/img/gallery/07.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
docs/assets/img/gallery/08.png
Normal file
|
After Width: | Height: | Size: 206 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 1.1 MiB |
@@ -89,7 +89,7 @@
|
||||
|
||||
<div class="section-title">
|
||||
<h2>软件特色</h2>
|
||||
<p>经过三个大版本更迭, 软件功能丰富, 操作简单.</p>
|
||||
<p>软件功能丰富, 操作简单.</p>
|
||||
</div>
|
||||
|
||||
<div class="row no-gutters">
|
||||
@@ -99,7 +99,7 @@
|
||||
<div class="col-md-6 icon-box" data-aos="fade-up">
|
||||
<i class="bx bx-receipt"></i>
|
||||
<h4>浏览</h4>
|
||||
<p>浏览全网热门视频, 支持切换视频源. 详细的电影分类.支持搜索电影名和演员名称. </p>
|
||||
<p>浏览全网热门视频, 支持切换视频源. 详细的电影分类. </p>
|
||||
</div>
|
||||
<div class="col-md-6 icon-box" data-aos="fade-up" data-aos-delay="100">
|
||||
<i class="icofont-play-alt-3"></i>
|
||||
@@ -124,7 +124,7 @@
|
||||
<div class="col-md-6 icon-box" data-aos="fade-up" data-aos-delay="500">
|
||||
<i class="icofont-cubes"></i>
|
||||
<h4>其他</h4>
|
||||
<p>多主题, 多语言, 自动更新</p>
|
||||
<p>多主题, 自动更新</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -146,14 +146,14 @@
|
||||
</div>
|
||||
|
||||
<div class="owl-carousel gallery-carousel" data-aos="fade-up">
|
||||
<a href="assets/img/gallery/001.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/001.png" alt=""></a>
|
||||
<a href="assets/img/gallery/002.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/002.png" alt=""></a>
|
||||
<a href="assets/img/gallery/003.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/003.png" alt=""></a>
|
||||
<a href="assets/img/gallery/004.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/004.png" alt=""></a>
|
||||
<a href="assets/img/gallery/005.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/005.png" alt=""></a>
|
||||
<a href="assets/img/gallery/006.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/006.png" alt=""></a>
|
||||
<a href="assets/img/gallery/007.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/007.png" alt=""></a>
|
||||
<a href="assets/img/gallery/008.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/008.png" alt=""></a>
|
||||
<a href="assets/img/gallery/01.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/01.png" alt=""></a>
|
||||
<a href="assets/img/gallery/02.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/02.png" alt=""></a>
|
||||
<a href="assets/img/gallery/03.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/03.png" alt=""></a>
|
||||
<a href="assets/img/gallery/04.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/04.png" alt=""></a>
|
||||
<a href="assets/img/gallery/05.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/05.png" alt=""></a>
|
||||
<a href="assets/img/gallery/06.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/06.png" alt=""></a>
|
||||
<a href="assets/img/gallery/07.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/07.png" alt=""></a>
|
||||
<a href="assets/img/gallery/08.png" class="venobox" data-gall="gallery-carousel"><img src="assets/img/gallery/08.png" alt=""></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -193,7 +193,7 @@
|
||||
<i class="bx bx-help-circle icon-help"></i> <a data-toggle="collapse" href="#accordion-list-3" class="collapsed">跨平台<i class="bx bx-chevron-down icon-show"></i><i class="bx bx-chevron-up icon-close"></i></a>
|
||||
<div id="accordion-list-3" class="collapse" data-parent=".accordion-list">
|
||||
<p>
|
||||
目前支持 Windows, Mac, Linux 桌面系统. 暂不支持手机端或者电视端. 未来会考虑实现全平台.
|
||||
目前支持 Windows, Mac, Linux, Android, IOS, TV, Web 全平台.
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
14
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zy",
|
||||
"version": "2.6.7",
|
||||
"version": "2.7.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
@@ -17,16 +17,14 @@
|
||||
},
|
||||
"main": "background.js",
|
||||
"dependencies": {
|
||||
"@imjs/electron-differential-updater": "^5.1.3",
|
||||
"axios": "^0.21.0",
|
||||
"cheerio": "^1.0.0-rc.3",
|
||||
"core-js": "^3.7.0",
|
||||
"cors": "^2.8.5",
|
||||
"core-js": "^3.8.0",
|
||||
"dexie": "^3.0.3",
|
||||
"electron-localshortcut": "^3.2.1",
|
||||
"electron-proxy-agent": "^1.2.0",
|
||||
"electron-updater": "^4.3.5",
|
||||
"element-ui": "^2.14.1",
|
||||
"express": "^4.17.1",
|
||||
"fast-xml-parser": "^3.17.4",
|
||||
"html2canvas": "^1.0.0-rc.7",
|
||||
"iptv-playlist-parser": "^0.5.0",
|
||||
@@ -46,8 +44,8 @@
|
||||
"vue-infinite-loading": "^2.4.5",
|
||||
"vue-waterfall-plugin": "^1.1.0",
|
||||
"vuedraggable": "^2.24.3",
|
||||
"vuex": "^3.5.1",
|
||||
"xgplayer": "^2.13.1",
|
||||
"vuex": "^3.6.0",
|
||||
"xgplayer": "^2.13.2",
|
||||
"xgplayer-hls.js": "^2.2.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -58,7 +56,7 @@
|
||||
"@vue/eslint-config-standard": "^5.1.2",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-plugin-component": "^1.1.1",
|
||||
"electron": "^11.0.2",
|
||||
"electron": "^11.0.3",
|
||||
"electron-devtools-installer": "^3.1.1",
|
||||
"eslint": "^7.14.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
border-radius: 5px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.listpage-header{
|
||||
.listpage-header, .toolbar{
|
||||
height: 60px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
@@ -175,7 +175,39 @@
|
||||
font-size: 1rem;
|
||||
border: none;
|
||||
}
|
||||
.el-select-dropdown__item.selected.hover{ //是上游的bug吗?临时性修补
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.el-select-dropdown__wrap{
|
||||
max-height: 574px
|
||||
}
|
||||
}
|
||||
> span{
|
||||
.el-input-number{
|
||||
width:120px;
|
||||
.el-input{
|
||||
width: 100px;
|
||||
}
|
||||
.el-input__inner{
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
width: 88px;
|
||||
}
|
||||
.el-input-number__increase, .el-input-number__decrease {
|
||||
background-color: inherit;
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.el-divider{
|
||||
.el-divider--horizontal{
|
||||
margin: 12px 0;
|
||||
}
|
||||
}
|
||||
.toolbar{
|
||||
z-index: 5;
|
||||
}
|
||||
.listpage-body{
|
||||
height: calc(100% - 60px);
|
||||
|
||||
@@ -139,6 +139,12 @@
|
||||
.play{
|
||||
background-color: var(--d-bgc-1);
|
||||
box-shadow: var(--d-bsc);
|
||||
.el-switch__label {
|
||||
color: var(--d-fc-2)
|
||||
}
|
||||
.el-switch__label.is-active {
|
||||
color: #409EFF
|
||||
}
|
||||
.el-input{
|
||||
input{
|
||||
background-color: var(--d-bgc-1);
|
||||
@@ -319,13 +325,32 @@
|
||||
// Page of list using table and picture
|
||||
.listpage{
|
||||
color: var(--d-fc-2);
|
||||
.listpage-header{
|
||||
.listpage-header-divider{
|
||||
background-color: var(--d-bgc-1);
|
||||
.el-divider__text {
|
||||
background-color: var(--d-bgc-2);
|
||||
}
|
||||
.el-button{
|
||||
background-color: var(--d-bgc-2);
|
||||
color: var(--d-fc-2);
|
||||
&:hover{
|
||||
color: var(--d-fc-3)
|
||||
}
|
||||
}
|
||||
}
|
||||
.listpage-header, .toolbar{
|
||||
border-bottom-color: var(--d-c-3);
|
||||
.btn{
|
||||
&:hover{
|
||||
color: var(--d-fc-3)
|
||||
}
|
||||
}
|
||||
.el-switch__label {
|
||||
color: var(--d-fc-2)
|
||||
}
|
||||
.el-switch__label.is-active {
|
||||
color: #409EFF
|
||||
}
|
||||
.el-button{
|
||||
background-color: var(--d-bgc-2);
|
||||
color: var(--d-fc-2);
|
||||
|
||||
@@ -319,7 +319,20 @@
|
||||
// Page of list using table and picture
|
||||
.listpage{
|
||||
color: var(--g-fc-2);
|
||||
.listpage-header{
|
||||
.listpage-header-divider{
|
||||
background-color: var(--g-bgc-1);
|
||||
.el-divider__text {
|
||||
background-color: var(--g-bgc-2);
|
||||
}
|
||||
.el-button{
|
||||
background-color: var(--g-bgc-2);
|
||||
color: var(--g-fc-2);
|
||||
&:hover{
|
||||
color: var(--g-fc-3)
|
||||
}
|
||||
}
|
||||
}
|
||||
.listpage-header, .toolbar{
|
||||
border-bottom-color: var(--g-c-3);
|
||||
.btn{
|
||||
&:hover{
|
||||
|
||||
@@ -319,7 +319,20 @@
|
||||
// Page of list using table and picture
|
||||
.listpage{
|
||||
color: var(--l-fc-2);
|
||||
.listpage-header{
|
||||
.listpage-header-divider{
|
||||
background-color: var(--l-bgc-1);
|
||||
.el-divider__text {
|
||||
background-color: var(--l-bgc-2);
|
||||
}
|
||||
.el-button{
|
||||
background-color: var(--l-bgc-2);
|
||||
color: var(--l-fc-2);
|
||||
&:hover{
|
||||
color: var(--l-fc-3)
|
||||
}
|
||||
}
|
||||
}
|
||||
.listpage-header, .toolbar{
|
||||
border-bottom-color: var(--l-c-3);
|
||||
.btn{
|
||||
&:hover{
|
||||
|
||||
@@ -319,7 +319,20 @@
|
||||
// Page of list using table and picture
|
||||
.listpage{
|
||||
color: var(--p-fc-2);
|
||||
.listpage-header{
|
||||
.listpage-header-divider{
|
||||
background-color: var(--p-bgc-1);
|
||||
.el-divider__text {
|
||||
background-color: var(--p-bgc-2);
|
||||
}
|
||||
.el-button{
|
||||
background-color: var(--p-bgc-2);
|
||||
color: var(--p-fc-2);
|
||||
&:hover{
|
||||
color: var(--p-fc-3)
|
||||
}
|
||||
}
|
||||
}
|
||||
.listpage-header, .toolbar{
|
||||
border-bottom-color: var(--p-c-3);
|
||||
.btn{
|
||||
&:hover{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
import './lib/site/server'
|
||||
import { app, protocol, BrowserWindow, globalShortcut } from 'electron'
|
||||
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
|
||||
import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
|
||||
@@ -8,7 +7,7 @@ import { initUpdater } from './lib/update/update'
|
||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||
|
||||
app.commandLine.appendSwitch('disable-features', 'OutOfBlinkCors') // 允许跨域
|
||||
// app.commandLine.appendSwitch('--ignore-certificate-errors', 'true') // 忽略证书相关错误
|
||||
app.commandLine.appendSwitch('--ignore-certificate-errors', 'true') // 忽略证书相关错误
|
||||
|
||||
let win
|
||||
|
||||
@@ -23,7 +22,8 @@ function createWindow () {
|
||||
webPreferences: {
|
||||
webSecurity: false,
|
||||
enableRemoteModule: true,
|
||||
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION
|
||||
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
|
||||
allowRunningInsecureContent: false
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -211,30 +211,29 @@ export default {
|
||||
}
|
||||
},
|
||||
downloadEvent () {
|
||||
zy.download(this.detail.key, this.info.id).then(res => {
|
||||
if (res && res.dl && res.dl.dd) {
|
||||
const text = res.dl.dd._t
|
||||
if (text) {
|
||||
const list = text.split('#')
|
||||
let downloadUrl = res.name + '\n'
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『MP4』格式的链接已复制, 快去下载吧!')
|
||||
} else {
|
||||
this.$message.warning('没有查询到下载链接.')
|
||||
}
|
||||
} else {
|
||||
const list = [...this.m3u8List]
|
||||
let downloadUrl = this.detail.info.name + '\n'
|
||||
const key = this.detail.key
|
||||
const id = this.info.id
|
||||
zy.download(key, id).then(res => {
|
||||
if (res && res.m3u8List) {
|
||||
const list = res.m3u8List.split('#')
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
|
||||
this.$message.success('『MP4』格式的链接已复制, 快去下载吧!')
|
||||
} else {
|
||||
zy.detail(key, id).then(res => {
|
||||
const list = [...res.m3u8List]
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -4,16 +4,16 @@
|
||||
<el-switch v-model="enableBatchEdit" active-text="批处理分组">></el-switch>
|
||||
<el-checkbox v-model="setting.excludeR18Films" @change="excludeR18FilmsChangeEvent">屏蔽福利片</el-checkbox>
|
||||
<el-button @click="addSite" icon="el-icon-document-add">新增</el-button>
|
||||
<el-button @click="exportSites" icon="el-icon-upload2" >导出</el-button>
|
||||
<el-button @click="importSites" icon="el-icon-download">导入</el-button>
|
||||
<el-button @click="checkAllSite" icon="el-icon-refresh" :loading="checkAllSitesLoading">检测{{ this.checkAllSitesLoading ? this.checkProgress + '/' + this.sites.length : '' }}</el-button>
|
||||
<el-button @click="exportSites" icon="el-icon-upload2" title="导出全部,自动添加扩展名">导出</el-button>
|
||||
<el-button @click="importSites" icon="el-icon-download" title="支持同时导入多个文件">导入</el-button>
|
||||
<el-button @click="checkAllSite" icon="el-icon-refresh" :loading="checkAllSitesLoading" title="可在后台运行">检测{{ this.checkAllSitesLoading ? this.checkProgress + '/' + this.sites.length : '' }}</el-button>
|
||||
<el-button @click="resetSitesEvent" icon="el-icon-refresh-left">重置</el-button>
|
||||
</div>
|
||||
<div class="listpage-header" v-show="enableBatchEdit">
|
||||
<el-switch v-model="enableBatchEdit" active-text="批处理分组"></el-switch>
|
||||
<el-input placeholder="新组名" v-model="batchGroupName"></el-input>
|
||||
<el-switch v-model="batchIsActive" active-text="启用"></el-switch>
|
||||
<el-button type="primary" icon="el-icon-edit" @click.stop="saveBatchEdit">保存</el-button>
|
||||
<el-button type="primary" icon="el-icon-edit" @click.stop="saveBatchEdit" title="输入框组名为空时仅保存开关状态">保存分组与开关状态</el-button>
|
||||
<el-button @click="removeSelectedSites" icon="el-icon-delete-solid">删除</el-button>
|
||||
</div>
|
||||
<div class="listpage-body" id="sites-body">
|
||||
@@ -186,6 +186,17 @@ export default {
|
||||
this.$message.info('正在检测, 请勿操作.')
|
||||
this.enableBatchEdit = false
|
||||
}
|
||||
if (this.enableBatchEdit) {
|
||||
if (this.setting.shiftTooltipLimitTimes === undefined) this.setting.shiftTooltipLimitTimes = 5
|
||||
if (this.setting.shiftTooltipLimitTimes) {
|
||||
this.$message.info('多选时支持shift快捷键')
|
||||
this.setting.shiftTooltipLimitTimes--
|
||||
setting.find().then(res => {
|
||||
res.shiftTooltipLimitTimes = this.setting.shiftTooltipLimitTimes
|
||||
setting.update(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -342,13 +353,12 @@ export default {
|
||||
const str = JSON.stringify(arr, null, 2)
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'JSON file', extensions: ['json'] },
|
||||
{ name: 'Normal text file', extensions: ['txt'] },
|
||||
{ name: 'All types', extensions: ['*'] }
|
||||
{ name: 'JSON file', extensions: ['json'] }
|
||||
]
|
||||
}
|
||||
remote.dialog.showSaveDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
if (!result.filePath.endsWith('.json')) result.filePath += '.json'
|
||||
fs.writeFileSync(result.filePath, str)
|
||||
this.$message.success('已保存成功')
|
||||
}
|
||||
@@ -363,9 +373,7 @@ export default {
|
||||
}
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'JSON file', extensions: ['json'] },
|
||||
{ name: 'Normal text file', extensions: ['txt'] },
|
||||
{ name: 'All types', extensions: ['*'] }
|
||||
{ name: 'JSON file', extensions: ['json'] }
|
||||
],
|
||||
properties: ['openFile', 'multiSelections']
|
||||
}
|
||||
@@ -462,6 +470,7 @@ export default {
|
||||
})
|
||||
},
|
||||
async checkAllSite () {
|
||||
if (this.checkAllSitesLoading) return
|
||||
this.checkAllSitesLoading = true
|
||||
this.stopFlag = false
|
||||
this.checkProgress = 0
|
||||
@@ -471,6 +480,7 @@ export default {
|
||||
await Promise.all(other.map(site => this.checkSingleSite(site))).then(res => {
|
||||
this.checkAllSitesLoading = false
|
||||
this.getSites()
|
||||
if (!this.stopFlag) this.$message.success('视频点播源站批量检测已完成!')
|
||||
})
|
||||
},
|
||||
async checkSingleSite (row) {
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
:value="item.name">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-switch v-model="searchViewMode" active-text="海报" active-value="picture" inactive-text="列表" inactive-value="table" @change="updateSearchViewMode"
|
||||
v-if="show.find"></el-switch>
|
||||
<el-select v-model="selectedClassName" size="small" placeholder="类型" :popper-append-to-body="false" popper-class="popper" @change="classClick" v-show="show.class">
|
||||
<el-select v-model="selectedClassName" size="small" placeholder="类型" :popper-append-to-body="false" popper-class="popper" @change="classClick" v-if="classList && classList.length" v-show="!showFind">
|
||||
<el-option
|
||||
v-for="item in classList"
|
||||
:key="item.tid"
|
||||
@@ -19,6 +17,14 @@
|
||||
:value="item.name">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="selectedSearchClassNames" size="small" multiple placeholder="类型" :popper-append-to-body="false" popper-class="popper" v-if="searchClassList && searchClassList.length" v-show="showFind && showToolbar" @remove-tag="refreshFilteredList" @change="refreshFilteredList">
|
||||
<el-option
|
||||
v-for="(item, index) in searchClassList"
|
||||
:key='index'
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-autocomplete
|
||||
clearable
|
||||
size="small"
|
||||
@@ -44,12 +50,42 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
<!--方便触屏-->
|
||||
<el-button icon="el-icon-search" @click.stop="searchEvent" slot="append" />
|
||||
<el-button icon="el-icon-search" @click.stop="searchEvent" slot="append" v-if="!searchRunning"/>
|
||||
<el-button icon="el-icon-loading" @click.stop="stopSearchEvent" slot="append" v-if="searchRunning" title='点击可停止搜索'/>
|
||||
</el-autocomplete>
|
||||
</div>
|
||||
<div class="toolbar" v-show="showToolbar">
|
||||
<el-select v-model="selectedAreas" size="small" multiple placeholder="地区" popper-class="popper" :popper-append-to-body="false" @remove-tag="refreshFilteredList" @change="refreshFilteredList">
|
||||
<el-option
|
||||
v-for="item in areas"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="sortKeyword" size="small" placeholder="排序" popper-class="popper" :popper-append-to-body="false" @change="refreshFilteredList">
|
||||
<el-option
|
||||
v-for="item in sortKeywords"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<span>
|
||||
上映区间:
|
||||
<el-input-number size="small" v-model="selectedYears.start" :min=0 :max="new Date().getFullYear()" controls-position="right" step-strictly @change="refreshFilteredList"></el-input-number>
|
||||
至
|
||||
<el-input-number size="small" v-model="selectedYears.end" :min=0 :max="new Date().getFullYear()" controls-position="right" step-strictly @change="refreshFilteredList"></el-input-number>
|
||||
</span>
|
||||
</div>
|
||||
<el-divider class="listpage-header-divider" content-position="right">
|
||||
<el-button type="text" size="mini" @click="toggleViewMode">视图切换</el-button>
|
||||
<el-button type="text" size="mini" @click='() => { showToolbar = !showToolbar; if (!showToolbar) this.refreshFilteredList() }' title="收起工具栏会重置筛选排序">{{ showToolbar ? '隐藏工具栏' : '显示工具栏' }}</el-button>
|
||||
<el-button type="text" size="mini" @click="backTop">回到顶部</el-button>
|
||||
</el-divider>
|
||||
<div class="listpage-body" id="film-body" infinite-wrapper>
|
||||
<div class="show-picture" v-if="setting.view === 'picture' && !show.find">
|
||||
<Waterfall ref="filmWaterfall" :list="list" :gutter="20" :width="240"
|
||||
<div class="show-picture" v-if="setting.view === 'picture' && !showFind">
|
||||
<Waterfall ref="filmWaterfall" :list="filteredList" :gutter="20" :width="240"
|
||||
:breakpoints="{
|
||||
1200: { //当屏幕宽度小于等于1200
|
||||
rowPerView: 4,
|
||||
@@ -64,7 +100,7 @@
|
||||
animationEffect="fadeIn"
|
||||
backgroundColor="rgba(0, 0, 0, 0)">
|
||||
<template slot="item" slot-scope="props">
|
||||
<div class="card" v-show="!setting.excludeR18Films || !containsR18Keywords(props.data.type)">
|
||||
<div class="card">
|
||||
<div class="img">
|
||||
<img style="width: 100%" :src="props.data.pic" alt="" @load="$refs.filmWaterfall.refresh()" @click="detailEvent(site, props.data)">
|
||||
<div class="operate">
|
||||
@@ -87,10 +123,11 @@
|
||||
</Waterfall>
|
||||
<infinite-loading force-use-infinite-wrapper :identifier="infiniteId" @infinite="infiniteHandler"></infinite-loading>
|
||||
</div>
|
||||
<div class="show-table" v-if="setting.view === 'table' && !show.find">
|
||||
<div class="show-table" v-if="setting.view === 'table' && !showFind">
|
||||
<el-table
|
||||
size="mini"
|
||||
:data="list.filter(res => !setting.excludeR18Films || !containsR18Keywords(res.type))"
|
||||
:data="filteredList"
|
||||
ref="filmTable"
|
||||
height="100%"
|
||||
:empty-text="statusText"
|
||||
@row-click="(row) => detailEvent(site, row)"
|
||||
@@ -99,7 +136,7 @@
|
||||
prop="name"
|
||||
label="片名">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<el-table-column v-if="type.name === '最新'"
|
||||
prop="type"
|
||||
label="类型"
|
||||
width="100">
|
||||
@@ -120,16 +157,16 @@
|
||||
label="语言"
|
||||
width="100">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="note"
|
||||
label="备注"
|
||||
width="120">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<el-table-column v-if="showTableLastColumn"
|
||||
prop="last"
|
||||
label="最近更新"
|
||||
:formatter="dateFormat"
|
||||
align="left">
|
||||
align="left"
|
||||
width="120">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="note"
|
||||
label="备注">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
@@ -152,10 +189,10 @@
|
||||
</infinite-loading>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="show-table" v-show="searchViewMode=== 'table' && show.find">
|
||||
<div class="show-table" v-if="setting.searchViewMode === 'table' && showFind">
|
||||
<el-table size="mini"
|
||||
ref="searchResultTable"
|
||||
:data="searchContents.filter(res => !setting.excludeR18Films || (res.type !== undefined && !containsR18Keywords(res.type)))"
|
||||
:data="filteredSearchContents"
|
||||
height="100%"
|
||||
:empty-text="statusText"
|
||||
@filter-change="filterChange"
|
||||
@@ -181,36 +218,38 @@
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="type"
|
||||
:filters="getFilters('type')"
|
||||
:filter-method="(value, row, column) => { this.currentColumn = column; return value === row.type }"
|
||||
label="类型"
|
||||
width="90">
|
||||
width="100">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
sortable
|
||||
prop="year"
|
||||
label="上映"
|
||||
width="90">
|
||||
width="100">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="area"
|
||||
:filters="getFilters('area')"
|
||||
:filter-method="(value, row, column) => { this.currentColumn = column; return value === row.area }"
|
||||
label="地区"
|
||||
width="90">
|
||||
width="100">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:filters="getFilters('lang')"
|
||||
:filter-method="(value, row, column) => { this.currentColumn = column; return value === row.lang }"
|
||||
prop="lang"
|
||||
label="语言"
|
||||
width="70">
|
||||
width="100">
|
||||
</el-table-column>
|
||||
<el-table-column v-if="showTableLastColumn"
|
||||
prop="last"
|
||||
label="最近更新"
|
||||
:formatter="dateFormat"
|
||||
align="left"
|
||||
width="120">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
sortable
|
||||
prop="note"
|
||||
label="备注"
|
||||
width="120">
|
||||
label="备注">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
@@ -226,8 +265,8 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="show-picture" v-show="searchViewMode === 'picture' && show.find">
|
||||
<Waterfall ref="filmSearchWaterfall" :list="searchContents.filter(res => !setting.excludeR18Films || (res.type !== undefined && !containsR18Keywords(res.type)))" :gutter="20" :width="240"
|
||||
<div class="show-picture" v-if="setting.searchViewMode === 'picture' && showFind">
|
||||
<Waterfall ref="filmSearchWaterfall" :list="filteredSearchContents" :gutter="20" :width="240"
|
||||
:breakpoints="{
|
||||
1200: { //当屏幕宽度小于等于1200
|
||||
rowPerView: 4,
|
||||
@@ -277,24 +316,24 @@ import zy from '../lib/site/tools'
|
||||
import Waterfall from 'vue-waterfall-plugin'
|
||||
import InfiniteLoading from 'vue-infinite-loading'
|
||||
const { clipboard } = require('electron')
|
||||
const FILM_DATA_CACHE = {} // key = site.key, value = classList; key = site.key + '@' + type.tid, value = {list, pageCount}
|
||||
export default {
|
||||
name: 'film',
|
||||
data () {
|
||||
return {
|
||||
show: {
|
||||
body: false,
|
||||
site: false,
|
||||
class: false,
|
||||
classList: false,
|
||||
find: false
|
||||
},
|
||||
showFind: false,
|
||||
showToolbar: false,
|
||||
showTableLastColumn: false,
|
||||
sites: [],
|
||||
site: {},
|
||||
classList: [],
|
||||
searchClassList: [],
|
||||
type: {},
|
||||
selectedClassName: '最新',
|
||||
selectedSiteName: '',
|
||||
selectedClassName: '',
|
||||
selectedSearchClassNames: [],
|
||||
pagecount: 0,
|
||||
recordcount: 0,
|
||||
list: [],
|
||||
statusText: ' ',
|
||||
infiniteId: +new Date(),
|
||||
@@ -302,12 +341,21 @@ export default {
|
||||
searchList: [],
|
||||
searchTxt: '',
|
||||
searchContents: [],
|
||||
filteredSearchContents: [],
|
||||
currentColumn: '',
|
||||
searchGroup: '',
|
||||
searchGroups: [],
|
||||
// 福利片关键词
|
||||
r18KeyWords: ['伦理', '论理', '倫理', '福利', '激情', '理论', '写真', '情色', '美女', '街拍', '赤足', '性感', '里番'],
|
||||
searchViewMode: 'picture'
|
||||
filteredList: [],
|
||||
areas: [],
|
||||
selectedAreas: [],
|
||||
sortKeyword: '',
|
||||
sortKeywords: ['按片名', '按上映年份', '按更新时间'],
|
||||
selectedYears: { start: 0, end: new Date().getFullYear() },
|
||||
searchRunning: false,
|
||||
siteSearchCount: 0,
|
||||
infiniteHandlerCount: 0
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -357,6 +405,11 @@ export default {
|
||||
},
|
||||
filterSettings () {
|
||||
return this.$store.getters.getSetting.excludeR18Films // 需要监听的数据
|
||||
},
|
||||
searchSites () {
|
||||
if (this.searchGroup === '站内') return [this.site]
|
||||
if (this.searchGroup === '全站') return this.sites
|
||||
return this.sites.filter(site => site.group === this.searchGroup)
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
@@ -367,7 +420,11 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
view () {
|
||||
this.changeView()
|
||||
if (this.view === 'Film') {
|
||||
this.getAllSites()
|
||||
if (this.$refs.filmWaterfall) this.$refs.filmWaterfall.resize() // 瀑布插件resize和refresh功能相同,只是延时不同
|
||||
if (this.$refs.filmSearchWaterfall) this.$refs.filmSearchWaterfall.resize()
|
||||
}
|
||||
},
|
||||
searchTxt () {
|
||||
if (this.searchTxt === '清除历史记录...') {
|
||||
@@ -378,13 +435,99 @@ export default {
|
||||
},
|
||||
filterSettings () {
|
||||
this.siteClick(this.site.name)
|
||||
},
|
||||
list: {
|
||||
handler (list) {
|
||||
this.areas = [...new Set(list.map(ele => ele.area))].filter(x => x)
|
||||
this.refreshFilteredList()
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
siteSearchCount () {
|
||||
if (this.siteSearchCount === this.searchSites.length) this.searchRunning = false
|
||||
},
|
||||
searchContents: {
|
||||
handler (list) {
|
||||
this.areas = [...new Set(list.map(ele => ele.area))].filter(x => x)
|
||||
this.searchClassList = [...new Set(list.map(ele => ele.type))].filter(x => x)
|
||||
this.refreshFilteredList()
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
selectedAreas: {
|
||||
handler () {
|
||||
this.infiniteHandlerCount = 0
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
selectedYears: {
|
||||
handler () {
|
||||
this.infiniteHandlerCount = 0
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_VIDEO', 'SET_SHARE', 'SET_SETTING']),
|
||||
updateSearchViewMode () {
|
||||
backTop () {
|
||||
const viewMode = this.showFind ? this.setting.searchViewMode : this.setting.view
|
||||
if (viewMode === 'picture') {
|
||||
document.getElementById('film-body').scrollTop = 0
|
||||
} else {
|
||||
const table = this.showFind ? this.$refs.searchResultTable : this.$refs.filmTable
|
||||
table.bodyWrapper.scrollTop = 0
|
||||
}
|
||||
},
|
||||
refreshFilteredList () {
|
||||
if (!this.showToolbar) {
|
||||
this.sortKeyword = ''
|
||||
this.selectedAreas = []
|
||||
this.selectedSearchClassNames = []
|
||||
this.selectedYears.start = 0
|
||||
this.selectedYears.end = new Date().getFullYear()
|
||||
}
|
||||
let filteredData = this.showFind ? this.searchContents : this.list
|
||||
if (this.showFind) filteredData = filteredData.filter(x => (this.selectedSearchClassNames.length === 0) || this.selectedSearchClassNames.includes(x.type))
|
||||
filteredData = filteredData.filter(x => (this.selectedAreas.length === 0) || this.selectedAreas.includes(x.area))
|
||||
filteredData = filteredData.filter(res => !this.setting.excludeR18Films || !this.containsR18Keywords(res.type))
|
||||
filteredData = filteredData.filter(res => res.year >= this.selectedYears.start)
|
||||
filteredData = filteredData.filter(res => res.year <= this.selectedYears.end)
|
||||
if (!this.showFind) this.selectedClassName = this.type.name + ' ' + filteredData.length + '/' + this.recordcount
|
||||
switch (this.sortKeyword) {
|
||||
case '按上映年份':
|
||||
filteredData.sort(function (a, b) {
|
||||
return a.year - b.year
|
||||
})
|
||||
break
|
||||
case '按片名':
|
||||
filteredData.sort(function (a, b) {
|
||||
return a.name.localeCompare(b.name, 'zh')
|
||||
})
|
||||
break
|
||||
case '按更新时间':
|
||||
filteredData.sort(function (a, b) {
|
||||
return new Date(b.last) - new Date(a.last)
|
||||
})
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
if (this.showFind) {
|
||||
this.filteredSearchContents = filteredData
|
||||
} else {
|
||||
this.filteredList = filteredData
|
||||
}
|
||||
},
|
||||
toggleViewMode () {
|
||||
if (this.showFind) {
|
||||
this.setting.searchViewMode = this.setting.searchViewMode === 'picture' ? 'table' : 'picture'
|
||||
setTimeout(() => { if (this.$refs.filmSearchWaterfall) this.$refs.filmSearchWaterfall.refresh() }, 700)
|
||||
} else {
|
||||
this.setting.view = this.setting.view === 'picture' ? 'table' : 'picture'
|
||||
}
|
||||
setting.find().then(res => {
|
||||
res.searchViewMode = this.searchViewMode
|
||||
res.searchViewMode = this.setting.searchViewMode
|
||||
res.view = this.setting.view
|
||||
setting.update(res)
|
||||
})
|
||||
},
|
||||
@@ -399,9 +542,8 @@ export default {
|
||||
return date.split(/\s/)[0]
|
||||
},
|
||||
getFilters (column) {
|
||||
const searchContents = this.searchContents.filter(res => !this.setting.excludeR18Films || (res.type !== undefined && !this.containsR18Keywords(res.type)))
|
||||
if (column === 'siteName') return [...new Set(searchContents.map(row => row.site.name))].map(e => { return { text: e, value: e } }) // 有方法合并这两行吗?
|
||||
return [...new Set(searchContents.map(row => row[column]))].map(e => { return { text: e, value: e } })
|
||||
if (column === 'siteName') return [...new Set(this.filteredSearchContents.map(row => row.site.name))].map(e => { return { text: e, value: e } }) // 有方法合并这两行吗?
|
||||
return [...new Set(this.filteredSearchContents.map(row => row[column]))].map(e => { return { text: e, value: e } })
|
||||
},
|
||||
filterChange (filters) {
|
||||
// 一次只能一列
|
||||
@@ -409,7 +551,7 @@ export default {
|
||||
const otherColumns = this.$refs.searchResultTable.columns.filter(col => col.id !== this.currentColumn.id)
|
||||
otherColumns.forEach(col => { col.filterable = false })
|
||||
} else {
|
||||
const filterLabels = ['源站', '类型', '地区', '语言']
|
||||
const filterLabels = ['源站', '语言']
|
||||
const columns = this.$refs.searchResultTable.columns.filter(col => filterLabels.includes(col.label))
|
||||
columns.forEach(col => { col.filterable = true })
|
||||
}
|
||||
@@ -417,27 +559,49 @@ export default {
|
||||
siteClick (siteName) {
|
||||
this.list = []
|
||||
this.site = this.sites.find(x => x.name === siteName)
|
||||
if (this.searchTxt.length > 0 && this.searchGroup === '站内') {
|
||||
if (this.searchGroup === '站内' && this.searchTxt) {
|
||||
this.searchEvent()
|
||||
return
|
||||
} else {
|
||||
this.searchTxt = ''
|
||||
this.show.find = false
|
||||
this.classList = []
|
||||
this.type = {}
|
||||
}
|
||||
this.showFind = false
|
||||
this.classList = []
|
||||
if (FILM_DATA_CACHE[this.site.key]) {
|
||||
this.classList = FILM_DATA_CACHE[this.site.key].classList
|
||||
this.classClick(this.type.name)
|
||||
} else {
|
||||
this.getClass().then(res => {
|
||||
this.classClick(this.classList[0].name)
|
||||
this.classList = res
|
||||
// cache classList data
|
||||
FILM_DATA_CACHE[this.site.key] = {
|
||||
classList: this.classList
|
||||
}
|
||||
this.classClick(this.type.name)
|
||||
})
|
||||
}
|
||||
},
|
||||
classClick (className) {
|
||||
this.show.classList = false
|
||||
this.list = []
|
||||
this.type = this.classList.find(x => x.name === className)
|
||||
this.getPage().then(res => {
|
||||
if (res) {
|
||||
this.infiniteHandlerCount = 0
|
||||
if (!this.type) {
|
||||
this.type = this.classList[0]
|
||||
}
|
||||
if (this.type.name.endsWith('剧')) this.selectedAreas = []
|
||||
const cacheKey = this.site.key + '@' + this.type.tid
|
||||
if (FILM_DATA_CACHE[cacheKey]) {
|
||||
this.pagecount = FILM_DATA_CACHE[cacheKey].pagecount
|
||||
this.recordcount = FILM_DATA_CACHE[cacheKey].recordcount
|
||||
this.list = FILM_DATA_CACHE[cacheKey].list
|
||||
this.areas = FILM_DATA_CACHE[cacheKey].areas
|
||||
} else {
|
||||
zy.page(this.site.key, this.type.tid).then(res => {
|
||||
this.pagecount = res.pagecount
|
||||
this.recordcount = res.recordcount
|
||||
this.infiniteId += 1
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
getClass () {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -458,11 +622,7 @@ export default {
|
||||
}
|
||||
}
|
||||
})
|
||||
this.classList = allClass
|
||||
this.show.class = true
|
||||
this.pagecount = res.pagecount
|
||||
this.type = this.classList[0]
|
||||
resolve(true)
|
||||
resolve(allClass)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
@@ -475,53 +635,46 @@ export default {
|
||||
}
|
||||
return this.r18KeyWords.some(v => name.includes(v))
|
||||
},
|
||||
getPage () {
|
||||
return new Promise((resolve, reject) => {
|
||||
const key = this.site.key
|
||||
const type = this.type.tid
|
||||
zy.page(key, type).then(res => {
|
||||
this.pagecount = res.pagecount
|
||||
this.show.body = true
|
||||
resolve(true)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
infiniteHandler ($state) {
|
||||
const key = this.site.key
|
||||
const type = this.type.tid
|
||||
const typeTid = this.type.tid
|
||||
const page = this.pagecount
|
||||
this.statusText = ' '
|
||||
if (key === undefined || page < 1 || type === undefined) { // OK资源前几类硬是去不掉
|
||||
if (key === undefined || page < 1 || typeTid === undefined) {
|
||||
$state.complete()
|
||||
this.statusText = '暂无数据'
|
||||
return false
|
||||
}
|
||||
zy.list(key, page, type).then(res => {
|
||||
if (res) {
|
||||
this.pagecount -= 1
|
||||
const type = Object.prototype.toString.call(res)
|
||||
if (type === '[object Undefined]') {
|
||||
$state.complete()
|
||||
if (this.showToolbar && this.filteredList.length && this.filteredList.length < 10) {
|
||||
this.infiniteHandlerCount++
|
||||
}
|
||||
const interval = this.setting.view === 'picture' ? 1200 : 300
|
||||
setTimeout(() => {
|
||||
zy.list(key, page, typeTid).then(res => {
|
||||
if (res) {
|
||||
this.pagecount -= 1
|
||||
const type = Object.prototype.toString.call(res)
|
||||
if (type === '[object Undefined]') {
|
||||
$state.complete()
|
||||
}
|
||||
if (type === '[object Array]') {
|
||||
// zy.list 返回的是按时间从旧到新排列, 我门需要翻转为从新到旧
|
||||
this.list.push(...res.reverse())
|
||||
}
|
||||
if (type === '[object Object]') {
|
||||
this.list.push(res)
|
||||
}
|
||||
$state.loaded()
|
||||
// 更新缓存数据
|
||||
const cacheKey = this.site.key + '@' + typeTid
|
||||
FILM_DATA_CACHE[cacheKey] = {
|
||||
pagecount: this.pagecount,
|
||||
recordcount: this.recordcount,
|
||||
list: this.list
|
||||
}
|
||||
}
|
||||
if (type === '[object Array]') {
|
||||
// zy.list 返回的是按时间从旧到新排列, 我门需要翻转为从新到旧
|
||||
this.list.push(...res.reverse())
|
||||
}
|
||||
if (type === '[object Object]') {
|
||||
this.list.push(res)
|
||||
}
|
||||
$state.loaded()
|
||||
// 数据更新后,刷新页面
|
||||
if (this.$refs.filmWaterfall) {
|
||||
this.$refs.filmWaterfall.refresh()
|
||||
}
|
||||
} else {
|
||||
$state.complete()
|
||||
this.statusText = '暂无数据'
|
||||
}
|
||||
})
|
||||
})
|
||||
}, (this.infiniteHandlerCount <= 1 ? 0 : this.infiniteHandlerCount - 1) * interval)
|
||||
},
|
||||
detailEvent (site, e) {
|
||||
this.detail = {
|
||||
@@ -570,54 +723,32 @@ export default {
|
||||
}
|
||||
},
|
||||
downloadEvent (site, row) {
|
||||
zy.download(site.key, row.id).then(res => {
|
||||
if (res && res.length > 0) {
|
||||
const text = res.m3u8List
|
||||
if (text) {
|
||||
const list = text.split('#')
|
||||
let downloadUrl = res.name + '\n'
|
||||
const key = site.key
|
||||
const id = row.id
|
||||
zy.download(key, id).then(res => {
|
||||
if (res && res.m3u8List) {
|
||||
const list = res.m3u8List.split('#')
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『MP4』格式的链接已复制, 快去下载吧!')
|
||||
} else {
|
||||
zy.detail(key, id).then(res => {
|
||||
const list = [...res.m3u8List]
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『MP4』格式的链接已复制, 快去下载吧!')
|
||||
} else {
|
||||
this.$message.warning('没有查询到下载链接.')
|
||||
}
|
||||
} else {
|
||||
let m3u8List = []
|
||||
const dd = row.dl.dd
|
||||
const type = Object.prototype.toString.call(dd)
|
||||
if (type === '[object Array]') {
|
||||
for (const i of dd) {
|
||||
if (i._flag.indexOf('m3u8') >= 0) {
|
||||
m3u8List = i._t.split('#')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m3u8List = dd._t.split('#')
|
||||
}
|
||||
let downloadUrl = row.name + '\n'
|
||||
for (const i of m3u8List) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
|
||||
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
changeView () {
|
||||
if (this.view === 'Film') {
|
||||
this.getAllSites()
|
||||
if (this.setting.view === 'picture') {
|
||||
if (this.$refs.filmWaterfall) {
|
||||
this.$refs.filmWaterfall.refresh()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
querySearch (queryString, cb) {
|
||||
var searchList = this.searchList.slice(0, -1)
|
||||
var results = queryString ? searchList.filter(this.createFilter(queryString)) : this.searchList
|
||||
@@ -651,6 +782,9 @@ export default {
|
||||
this.searchList.push({ id: this.searchList.length + 1, keywords: '清除历史记录...' })
|
||||
})
|
||||
},
|
||||
stopSearchEvent () {
|
||||
this.searchRunning = false
|
||||
},
|
||||
searchEvent () {
|
||||
const wd = this.searchTxt
|
||||
if (this.setting.searchGroup !== this.searchGroup) {
|
||||
@@ -659,71 +793,53 @@ export default {
|
||||
}
|
||||
if (!wd) return
|
||||
this.searchID += 1
|
||||
var searchSites = []
|
||||
if (this.searchGroup === '站内') searchSites.push(this.site)
|
||||
if (this.searchGroup === '全站') searchSites = this.sites
|
||||
if (!searchSites.length) {
|
||||
searchSites = this.sites.filter(site => site.group === this.searchGroup)
|
||||
}
|
||||
this.searchContents = []
|
||||
this.pagecount = 0
|
||||
this.show.find = true
|
||||
this.show.class = false
|
||||
this.showFind = true
|
||||
this.statusText = ' '
|
||||
if (wd) {
|
||||
searchSites.forEach(site => {
|
||||
const id = this.searchID
|
||||
zy.search(site.key, wd).then(res => {
|
||||
if (id !== this.searchID) return
|
||||
const type = Object.prototype.toString.call(res)
|
||||
if (type === '[object Array]') {
|
||||
res.forEach(element => {
|
||||
zy.detail(site.key, element.id).then(detailRes => {
|
||||
detailRes.site = site
|
||||
if (id !== this.searchID) return
|
||||
this.searchContents.push(detailRes)
|
||||
this.searchContents.sort(function (a, b) {
|
||||
return a.site.id - b.site.id
|
||||
})
|
||||
this.statusText = '暂无数据'
|
||||
})
|
||||
})
|
||||
}
|
||||
if (type === '[object Object]') {
|
||||
zy.detail(site.key, res.id).then(detailRes => {
|
||||
this.searchRunning = true
|
||||
this.siteSearchCount = 0
|
||||
this.searchSites.forEach(site => {
|
||||
const id = this.searchID
|
||||
zy.search(site.key, wd).then(res => {
|
||||
if (id !== this.searchID || !this.searchRunning) return
|
||||
const type = Object.prototype.toString.call(res)
|
||||
if (type === '[object Array]') {
|
||||
let count = 0
|
||||
res.forEach(element => {
|
||||
zy.detail(site.key, element.id).then(detailRes => {
|
||||
if (id !== this.searchID || !this.searchRunning) return
|
||||
detailRes.site = site
|
||||
if (id !== this.searchID) return
|
||||
this.searchContents.push(detailRes)
|
||||
this.searchContents.sort(function (a, b) {
|
||||
return a.site.id - b.site.id
|
||||
})
|
||||
this.statusText = '暂无数据'
|
||||
}).finally(() => { count++; if (count === res.length) { this.siteSearchCount++; this.statusText = '暂无数据' } })
|
||||
})
|
||||
} else if (type === '[object Object]') {
|
||||
zy.detail(site.key, res.id).then(detailRes => {
|
||||
if (id !== this.searchID || !this.searchRunning) return
|
||||
detailRes.site = site
|
||||
this.searchContents.push(detailRes)
|
||||
this.searchContents.sort(function (a, b) {
|
||||
return a.site.id - b.site.id
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}).finally(() => { this.siteSearchCount++; this.statusText = '暂无数据' })
|
||||
} else if (res === undefined) {
|
||||
this.siteSearchCount++
|
||||
this.statusText = '暂无数据'
|
||||
if (this.searchGroup === '站内') this.$message.info('没有查询到数据!')
|
||||
}
|
||||
}).catch(() => { this.siteSearchCount++; if (this.searchGroup === '站内') this.$message.error('本次查询状态异常,未获取到数据!') })
|
||||
})
|
||||
},
|
||||
searchAndRecord () {
|
||||
this.addSearchRecord()
|
||||
this.searchEvent()
|
||||
},
|
||||
searchChangeEvent () {
|
||||
if (this.searchTxt.length >= 1) {
|
||||
this.show.class = false
|
||||
} else {
|
||||
this.show.class = true
|
||||
if (!this.searchTxt.length) {
|
||||
this.searchContents = []
|
||||
this.show.find = false
|
||||
if (this.setting.view === 'picture' && this.$refs.filmWaterfall) {
|
||||
this.$refs.filmWaterfall.refresh()
|
||||
} else {
|
||||
this.getClass().then(res => {
|
||||
if (res) {
|
||||
this.infiniteId += 1
|
||||
}
|
||||
})
|
||||
}
|
||||
this.showFind = false
|
||||
}
|
||||
},
|
||||
getAllSites () {
|
||||
@@ -746,28 +862,20 @@ export default {
|
||||
this.searchGroup = this.setting.searchGroup
|
||||
if (this.searchGroup === undefined) setting.find().then(res => { this.searchGroup = res.searchGroup })
|
||||
})
|
||||
},
|
||||
getSearchViewMode () {
|
||||
setting.find().then(res => {
|
||||
this.searchViewMode = res.searchViewMode === undefined ? 'picture' : res.searchViewMode
|
||||
})
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getAllSites()
|
||||
this.getSearchHistory()
|
||||
this.getSearchViewMode()
|
||||
},
|
||||
mounted () {
|
||||
window.addEventListener('resize', () => {
|
||||
if (this.$refs.filmWaterfall && this.view === 'Film') {
|
||||
this.$refs.filmWaterfall.resize()
|
||||
this.$refs.filmWaterfall.refresh()
|
||||
setTimeout(() => {
|
||||
this.$refs.filmWaterfall.refresh()
|
||||
}, 500)
|
||||
}
|
||||
}, false)
|
||||
addEventListener('resize', () => {
|
||||
setTimeout(() => {
|
||||
this.showTableLastColumn = window.outerWidth >= 1200
|
||||
if (this.$refs.filmWaterfall) this.$refs.filmWaterfall.resize()
|
||||
if (this.$refs.filmSearchWaterfall) this.$refs.filmSearchWaterfall.resize()
|
||||
}, 500)
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
<template>
|
||||
<div class="listpage" id="history">
|
||||
<div class="listpage-header" id="history-header">
|
||||
<el-switch v-model="viewMode" active-text="海报" active-value="picture" inactive-text="列表" inactive-value="table" @change="updateViewMode"></el-switch>
|
||||
<el-button @click.stop="exportHistory" icon="el-icon-upload2">导出</el-button>
|
||||
<el-button @click.stop="importHistory" icon="el-icon-download">导入</el-button>
|
||||
<el-button @click.stop="clearAllHistory" icon="el-icon-delete-solid">清空</el-button>
|
||||
<el-switch v-model="setting.historyViewMode" active-text="海报" active-value="picture" inactive-text="列表" inactive-value="table" @change="updateViewMode"></el-switch>
|
||||
<el-button @click.stop="exportHistory" icon="el-icon-upload2" title="导出全部,自动添加扩展名">导出</el-button>
|
||||
<el-button @click.stop="importHistory" icon="el-icon-download" title="支持同时导入多个文件">导入</el-button>
|
||||
<el-button @click.stop="removeSelectedItems" icon="el-icon-delete-solid">{{ multipleSelection.length === 0 ? "清空" : "删除所选" }}</el-button>
|
||||
</div>
|
||||
<div class="listpage-body" id="history-body">
|
||||
<div class="show-table" id="history-table" v-show="viewMode === 'table'">
|
||||
<el-table size="mini" fit height="100%" :data="history" row-key="id" @row-click="detailEvent">
|
||||
<div class="show-table" id="history-table" v-if="setting.historyViewMode === 'table'">
|
||||
<el-table size="mini" fit height="100%"
|
||||
:data="history"
|
||||
row-key="id"
|
||||
ref="historyTable"
|
||||
@select="selectionCellClick"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-click="detailEvent">
|
||||
<el-table-column
|
||||
type="selection">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="name"
|
||||
label="片名">
|
||||
@@ -52,7 +61,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="show-picture" id="star-picture" v-show="viewMode === 'picture'">
|
||||
<div class="show-picture" id="star-picture" v-if="setting.historyViewMode === 'picture'">
|
||||
<Waterfall ref="historyWaterfall" :list="history" :gutter="20" :width="240"
|
||||
:breakpoints="{
|
||||
1200: { //当屏幕宽度小于等于1200
|
||||
@@ -112,7 +121,10 @@ export default {
|
||||
return {
|
||||
history: [],
|
||||
sites: [],
|
||||
viewMode: setting.historyViewMode
|
||||
shiftDown: false,
|
||||
selectionBegin: '',
|
||||
selectionEnd: '',
|
||||
multipleSelection: []
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -150,22 +162,57 @@ export default {
|
||||
set (val) {
|
||||
this.SET_SHARE(val)
|
||||
}
|
||||
},
|
||||
setting: {
|
||||
get () {
|
||||
return this.$store.getters.getSetting
|
||||
},
|
||||
set (val) {
|
||||
this.SET_SETTING(val)
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
view () {
|
||||
this.getAllhistory()
|
||||
this.getAllsites()
|
||||
if (this.$refs.historyWaterfall) {
|
||||
this.$refs.historyWaterfall.refresh()
|
||||
if (this.view === 'History') {
|
||||
this.getAllhistory()
|
||||
this.getAllsites()
|
||||
if (this.setting.historyViewMode === 'table') this.showShiftPrompt()
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_VIDEO', 'SET_SHARE']),
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_VIDEO', 'SET_SHARE', 'SET_SETTING']),
|
||||
fmtMSS (s) {
|
||||
return (s - (s %= 60)) / 60 + (s > 9 ? ':' : ':0') + s
|
||||
},
|
||||
selectionCellClick (selection, row) { // 历史id与顺序刚好相反,大的反而在前面
|
||||
if (this.shiftDown && this.selectionBegin !== '' && selection.includes(row)) {
|
||||
this.selectionEnd = row.id
|
||||
const start = this.history.findIndex(e => e.id === Math.max(this.selectionBegin, this.selectionEnd))
|
||||
const end = this.history.findIndex(e => e.id === Math.min(this.selectionBegin, this.selectionEnd))
|
||||
const selections = this.history.slice(start, end + 1)
|
||||
this.$nextTick(() => {
|
||||
selections.forEach(e => this.$refs.historyTable.toggleRowSelection(e, true))
|
||||
})
|
||||
this.selectionBegin = this.selectionEnd = ''
|
||||
return
|
||||
}
|
||||
if (selection.includes(row)) {
|
||||
this.selectionBegin = row.id
|
||||
} else {
|
||||
this.selectionBegin = ''
|
||||
}
|
||||
},
|
||||
handleSelectionChange (rows) {
|
||||
this.multipleSelection = rows
|
||||
},
|
||||
removeSelectedItems () {
|
||||
if (!this.multipleSelection.length) this.multipleSelection = this.history
|
||||
this.multipleSelection.forEach(e => history.remove(e.id))
|
||||
this.getAllhistory()
|
||||
this.updateDatabase()
|
||||
},
|
||||
detailEvent (e) {
|
||||
this.detail = {
|
||||
show: true,
|
||||
@@ -196,7 +243,9 @@ export default {
|
||||
}
|
||||
},
|
||||
downloadEvent (e) {
|
||||
zy.download(e.site, e.ids).then(res => {
|
||||
const key = e.site
|
||||
const id = e.ids
|
||||
zy.download(key, id).then(res => {
|
||||
if (res && res.m3u8List) {
|
||||
const list = res.m3u8List.split('#')
|
||||
let downloadUrl = ''
|
||||
@@ -207,7 +256,7 @@ export default {
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『MP4』格式的链接已复制, 快去下载吧!')
|
||||
} else {
|
||||
zy.detail(e.site, e.ids).then(res => {
|
||||
zy.detail(key, id).then(res => {
|
||||
const list = [...res.m3u8List]
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
@@ -231,6 +280,7 @@ export default {
|
||||
}
|
||||
remote.dialog.showSaveDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
if (!result.filePath.endsWith('.json')) result.filePath += '.json'
|
||||
fs.writeFileSync(result.filePath, str)
|
||||
this.$message.success('已保存成功')
|
||||
}
|
||||
@@ -258,11 +308,6 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
clearAllHistory () {
|
||||
history.clear().then(res => {
|
||||
this.history = []
|
||||
})
|
||||
},
|
||||
getAllhistory () {
|
||||
history.all().then(res => {
|
||||
this.history = res.reverse()
|
||||
@@ -286,10 +331,10 @@ export default {
|
||||
this.$message.warning('删除历史记录失败, 错误信息: ' + err)
|
||||
})
|
||||
},
|
||||
updateDatabase (data) {
|
||||
updateDatabase () {
|
||||
history.clear().then(res => {
|
||||
var id = length
|
||||
data.forEach(ele => {
|
||||
this.history.forEach(ele => {
|
||||
ele.id = id
|
||||
id -= 1
|
||||
history.add(ele)
|
||||
@@ -303,37 +348,44 @@ export default {
|
||||
onEnd ({ newIndex, oldIndex }) {
|
||||
const currRow = _this.history.splice(oldIndex, 1)[0]
|
||||
_this.history.splice(newIndex, 0, currRow)
|
||||
_this.updateDatabase(_this.history)
|
||||
_this.updateDatabase()
|
||||
}
|
||||
})
|
||||
},
|
||||
getViewMode () {
|
||||
setting.find().then(res => {
|
||||
this.viewMode = res.historyViewMode
|
||||
})
|
||||
},
|
||||
updateViewMode () {
|
||||
if (this.setting.historyViewMode === 'table') {
|
||||
setTimeout(() => { this.rowDrop() }, 100)
|
||||
this.showShiftPrompt()
|
||||
} else {
|
||||
setTimeout(() => { if (this.$refs.historyWaterfall) this.$refs.historyWaterfall.refresh() }, 700)
|
||||
}
|
||||
setting.find().then(res => {
|
||||
res.historyViewMode = this.viewMode
|
||||
res.historyViewMode = this.setting.historyViewMode
|
||||
setting.update(res)
|
||||
})
|
||||
},
|
||||
showShiftPrompt () {
|
||||
if (this.setting.shiftTooltipLimitTimes === undefined) this.setting.shiftTooltipLimitTimes = 5
|
||||
if (this.setting.shiftTooltipLimitTimes) {
|
||||
this.$message.info('多选时支持shift快捷键')
|
||||
this.setting.shiftTooltipLimitTimes--
|
||||
setting.find().then(res => {
|
||||
res.shiftTooltipLimitTimes = this.setting.shiftTooltipLimitTimes
|
||||
setting.update(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.rowDrop()
|
||||
window.addEventListener('resize', () => {
|
||||
if (this.$refs.historyWaterfall && this.view === 'History') {
|
||||
this.$refs.historyWaterfall.resize()
|
||||
this.$refs.historyWaterfall.refresh()
|
||||
setTimeout(() => {
|
||||
this.$refs.historyWaterfall.refresh()
|
||||
}, 500)
|
||||
}
|
||||
}, false)
|
||||
if (this.setting.historyViewMode === 'table') setTimeout(() => { this.rowDrop() }, 100)
|
||||
addEventListener('keydown', code => { if (code.keyCode === 16) this.shiftDown = true })
|
||||
addEventListener('keyup', code => { if (code.keyCode === 16) this.shiftDown = false })
|
||||
addEventListener('resize', () => {
|
||||
setTimeout(() => { if (this.$refs.historyWaterfall) this.$refs.historyWaterfall.resize() }, 500)
|
||||
})
|
||||
},
|
||||
created () {
|
||||
this.getAllhistory()
|
||||
this.getViewMode()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
<div class="listpage" id="iptv">
|
||||
<div class="listpage-header" id="iptv-header" v-show="!enableBatchEdit">
|
||||
<el-switch v-model="enableBatchEdit" active-text="批处理及频道调整"></el-switch>
|
||||
<el-button @click.stop="exportChannels" icon="el-icon-upload2" >导出</el-button>
|
||||
<el-button @click.stop="importChannels" icon="el-icon-download">导入</el-button>
|
||||
<el-button @click="checkAllChannels" icon="el-icon-refresh" :loading="checkAllChannelsLoading">检测{{ this.checkAllChannelsLoading ? this.checkProgress + '/' + this.iptvList.length : '' }}</el-button>
|
||||
<el-button @click.stop="exportChannels" icon="el-icon-upload2" title="导出m3u时必须手动添加扩展名,要保存频道配置信息请选择json格式">导出</el-button>
|
||||
<el-button @click.stop="importChannels" icon="el-icon-download" title='支持同时导入多个文件,导入m3u时网址可带参数、含有"#"号时自动分割'>导入</el-button>
|
||||
<el-button @click="checkAllChannels" icon="el-icon-refresh" :loading="checkAllChannelsLoading" title="可在后台运行">检测{{ this.checkAllChannelsLoading ? this.checkProgress + '/' + this.iptvList.length : '' }}</el-button>
|
||||
<el-button @click.stop="resetChannelsEvent" icon="el-icon-refresh-left">重置</el-button>
|
||||
</div>
|
||||
<div class="listpage-header" id="iptv-header" v-show="enableBatchEdit">
|
||||
<el-switch v-model="enableBatchEdit" active-text="批处理及频道调整"></el-switch>
|
||||
<el-input placeholder="新组名/新频道名" v-model="inputContent"></el-input>
|
||||
<el-switch v-model="batchIsActive" active-text="启用"></el-switch>
|
||||
<el-button type="primary" icon="el-icon-edit" @click.stop="saveBatchEdit">保存分组与开关状态</el-button>
|
||||
<el-button type="primary" icon="el-icon-film" @click.stop="mergeChannel">{{ this.multipleSelection.length === 1 ? '频道重命名' : '频道合并' }}</el-button>
|
||||
<el-button type="primary" icon="el-icon-edit" @click.stop="saveBatchEdit" title="输入框组名为空时仅保存开关状态">保存分组与开关状态</el-button>
|
||||
<el-button type="primary" icon="el-icon-film" @click.stop="mergeChannel" title="勾选单个时可重命名频道">{{ this.multipleSelection.length === 1 ? '频道重命名' : '频道合并' }}</el-button>
|
||||
<el-button @click.stop="removeSelectedChannels" icon="el-icon-delete-solid">删除</el-button>
|
||||
</div>
|
||||
<div class="listpage-body" id="iptv-table">
|
||||
@@ -107,7 +107,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import { iptv, channelList } from '../lib/dexie'
|
||||
import { iptv, channelList, setting } from '../lib/dexie'
|
||||
import { iptv as defaultChannels } from '../lib/dexie/initData'
|
||||
import zy from '../lib/site/tools'
|
||||
import { remote } from 'electron'
|
||||
@@ -143,8 +143,13 @@ export default {
|
||||
this.SET_VIEW(val)
|
||||
}
|
||||
},
|
||||
setting () {
|
||||
return this.$store.getters.getSetting
|
||||
setting: {
|
||||
get () {
|
||||
return this.$store.getters.getSetting
|
||||
},
|
||||
set (val) {
|
||||
this.SET_SETTING(val)
|
||||
}
|
||||
},
|
||||
video: {
|
||||
get () {
|
||||
@@ -175,11 +180,6 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
view () {
|
||||
if (this.view === 'IPTV' && !this.checkAllChannelsLoading) {
|
||||
this.getChannelList()
|
||||
}
|
||||
},
|
||||
enableBatchEdit () {
|
||||
if (this.checkAllChannelsLoading) {
|
||||
this.$message.info('正在检测, 请勿操作.')
|
||||
@@ -187,6 +187,15 @@ export default {
|
||||
return
|
||||
}
|
||||
if (this.enableBatchEdit) {
|
||||
if (this.setting.shiftTooltipLimitTimes === undefined) this.setting.shiftTooltipLimitTimes = 5
|
||||
if (this.setting.shiftTooltipLimitTimes) {
|
||||
this.$message.info('多选时支持shift快捷键')
|
||||
this.setting.shiftTooltipLimitTimes--
|
||||
setting.find().then(res => {
|
||||
res.shiftTooltipLimitTimes = this.setting.shiftTooltipLimitTimes
|
||||
setting.update(res)
|
||||
})
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.expandedRows.forEach(e => this.$refs.iptvTable.toggleRowExpansion(e, false))
|
||||
})
|
||||
@@ -197,7 +206,7 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_VIDEO', 'SET_SHARE']),
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_VIDEO', 'SET_SHARE', 'SET_SETTING']),
|
||||
sortByLocaleCompare (a, b) {
|
||||
return a.localeCompare(b, 'zh')
|
||||
},
|
||||
@@ -318,6 +327,7 @@ export default {
|
||||
fs.writeFileSync(result.filePath, writer.toString())
|
||||
this.$message.success('已保存成功')
|
||||
} else {
|
||||
if (!result.filePath.endsWith('.json')) result.filePath += '.json'
|
||||
const arr = [...this.channelList] // 要保存channelList必须选json
|
||||
const str = JSON.stringify(arr, null, 2)
|
||||
fs.writeFileSync(result.filePath, str)
|
||||
@@ -394,14 +404,12 @@ export default {
|
||||
})
|
||||
},
|
||||
determineGroup (name) {
|
||||
if (name.toLowerCase().includes('cctv') && (name.includes('蓝光') || name.includes('高清'))) {
|
||||
return '央视高清'
|
||||
} else if (name.toLowerCase().includes('cctv')) {
|
||||
if (name.toLowerCase().includes('cctv') || name.toLowerCase().includes('cgtn')) {
|
||||
return '央视'
|
||||
} else if (name.includes('香港') || name.includes('澳门') || name.includes('台湾') || name.includes('凤凰') || name.includes('翡翠')) {
|
||||
return '港澳台'
|
||||
} else if (name.includes('卫视')) {
|
||||
return '卫视'
|
||||
} else if (name.includes('香港') || name.includes('澳门') || name.includes('台湾') || name.includes('凤凰')) {
|
||||
return '港澳台'
|
||||
} else if (name.includes('高清') || name.includes('蓝光') || name.includes('1080P')) {
|
||||
return '高清'
|
||||
} else {
|
||||
@@ -552,6 +560,7 @@ export default {
|
||||
}
|
||||
},
|
||||
async checkAllChannels () {
|
||||
if (this.checkAllChannelsLoading) return
|
||||
this.checkAllChannelsLoading = true
|
||||
this.stopFlag = false
|
||||
this.checkProgress = 0
|
||||
@@ -562,6 +571,7 @@ export default {
|
||||
await this.checkChannelsBySite(other).then(res => {
|
||||
this.checkAllChannelsLoading = false
|
||||
this.getChannelList()
|
||||
if (!this.stopFlag) this.$message.success('直播频道批量检测已完成!')
|
||||
})
|
||||
},
|
||||
async checkChannelsBySite (channels) {
|
||||
|
||||
@@ -98,10 +98,29 @@
|
||||
<circle cx="12" cy="12" r="10"></circle>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="last-tip" v-if="!video.key && right.history.length > 0" @click="historyItemEvent(right.history[0])">上次播放到【{{right.history[0].site}}】{{right.history[0].name}} 第{{right.history[0].index+1}}集</span>
|
||||
<span class="timespanSwitch" v-if="right.list.length > 1" title="跳过片头片尾,建议优先通过快捷键设置,更便捷更精准">
|
||||
<el-switch v-model="state.showTimespanSetting" active-text="手动跳略时长"></el-switch>
|
||||
</span>
|
||||
<span class="timespan" v-if="state.showTimespanSetting">
|
||||
<label>片头:</label>
|
||||
<input type="number" v-model="startPosition.min" style="width:45px" min="00" max="59" placeholder="00" required>
|
||||
<label>:</label>
|
||||
<input type="number" v-model="startPosition.sec" style="width:45px" min="00" max="59" placeholder="00" required>
|
||||
<span></span>
|
||||
<label>片尾:</label>
|
||||
<input type="number" v-model="endPosition.min" style="width:45px" min="00" max="59" placeholder="00" required>
|
||||
<label>:</label>
|
||||
<input type="number" v-model="endPosition.sec" style="width:45px" min="00" max="59" placeholder="00" required>
|
||||
<span></span>
|
||||
<input type="button" value="确定" @click="setProgressDotByInput">
|
||||
<span></span>
|
||||
<input type="button" value="重置" @click="() => { startPosition.min = startPosition.sec = endPosition.min = endPosition.sec = '00'; this.clearPosition() }">
|
||||
</span>
|
||||
<span class="last-tip" v-if="!video.key && right.history.length > 0" @click="historyItemEvent(right.history[0])">
|
||||
上次播放到:【{{right.history[0].site}}】{{right.history[0].name}} 第{{right.history[0].index+1}}集 {{fmtMSS(right.history[0].time.toFixed(0))}}/{{fmtMSS(right.history[0].duration.toFixed(0))}}</span>
|
||||
</div>
|
||||
<div class="more" v-if="video.iptv" :key="Boolean(video.iptv)">
|
||||
<span class="zy-svg" @click="channelListShow = !channelListShow">
|
||||
<span class="zy-svg" @click="state.showChannelList = !state.showChannelList">
|
||||
<svg role="img" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" aria-labelledby="dashboardIconTitle">
|
||||
<title id="dashboardIconTitle">频道列表</title>
|
||||
<rect width="20" height="20" x="2" y="2"></rect>
|
||||
@@ -184,10 +203,10 @@
|
||||
</div>
|
||||
</transition>
|
||||
<transition name="slideX">
|
||||
<div v-if="channelListShow" class="list">
|
||||
<div v-if="state.showChannelList" class="list" v-on-clickaway="closeListEvent">
|
||||
<div class="list-top">
|
||||
<span class="list-top-title">频道列表</span>
|
||||
<span class="list-top-close zy-svg" @click="channelListShow = false">
|
||||
<span class="list-top-close zy-svg" @click="state.showChannelList = false">
|
||||
<svg role="img" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" aria-labelledby="closeIconTitle">
|
||||
<title id="closeIconTitle">关闭</title>
|
||||
<path d="M6.34314575 6.34314575L17.6568542 17.6568542M6.34314575 17.6568542L17.6568542 6.34314575"></path>
|
||||
@@ -197,13 +216,13 @@
|
||||
<div class="list-body zy-scroll" :style="{overflowY:scroll? 'auto' : 'hidden',paddingRight: scroll ? '0': '5px' }" @mouseenter="scroll = true" @mouseleave="scroll = false">
|
||||
<el-input
|
||||
clearable
|
||||
size="small"
|
||||
size="small" title="支持按拼音首字母搜索"
|
||||
v-model.trim="searchTxt"
|
||||
placeholder="搜索">
|
||||
<i slot="prefix" class="el-input__icon el-icon-search"></i>
|
||||
</el-input>
|
||||
<el-tree ref="channelTree"
|
||||
:data="channelListForShow"
|
||||
:data="channelTree"
|
||||
:props="defaultProps"
|
||||
accordion
|
||||
:filter-node-method="filterNode"
|
||||
@@ -308,12 +327,14 @@ export default {
|
||||
videoTitle: true,
|
||||
airplay: true,
|
||||
closeVideoTouch: true,
|
||||
ignores: ['cssFullscreen'],
|
||||
ignores: ['cssFullscreen', 'replay'],
|
||||
preloadTime: 300
|
||||
},
|
||||
state: {
|
||||
showList: false,
|
||||
showHistory: false
|
||||
showHistory: false,
|
||||
showChannelList: false,
|
||||
showTimespanSetting: false
|
||||
},
|
||||
name: '',
|
||||
length: 0,
|
||||
@@ -325,12 +346,16 @@ export default {
|
||||
mainWindowBounds: {},
|
||||
searchTxt: '',
|
||||
channelList: [],
|
||||
channelListForShow: [],
|
||||
channelListShow: false,
|
||||
channelTree: [],
|
||||
isLive: false,
|
||||
defaultProps: {
|
||||
label: 'label',
|
||||
children: 'children'
|
||||
}
|
||||
},
|
||||
startPosition: { min: '00', sec: '00' }, // 对应调略输入框
|
||||
endPosition: { min: '00', sec: '00' },
|
||||
skipendStatus: false, // 是否跳过了片尾
|
||||
currentShortcutList: []
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
@@ -387,18 +412,23 @@ export default {
|
||||
this.SET_APPSTATE(val)
|
||||
}
|
||||
},
|
||||
setting () {
|
||||
return this.$store.getters.getSetting
|
||||
setting: {
|
||||
get () {
|
||||
return this.$store.getters.getSetting
|
||||
},
|
||||
set (val) {
|
||||
this.SET_SETTING(val)
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
view () {
|
||||
this.right.show = false
|
||||
this.right.type = ''
|
||||
if (this.view === 'Play') {
|
||||
this.right.show = false
|
||||
this.right.type = ''
|
||||
this.getChannelList()
|
||||
if (this.video.key === '' && !this.video.iptv) {
|
||||
this.channelListShow = true
|
||||
if (this.video.key === '' && !this.isLive) {
|
||||
this.state.showChannelList = true
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -427,10 +457,36 @@ export default {
|
||||
},
|
||||
searchTxt () {
|
||||
this.$refs.channelTree.filter(this.searchTxt)
|
||||
},
|
||||
startPosition: {
|
||||
handler (time) {
|
||||
this.leadingZero(time)
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
endPosition: {
|
||||
handler (time) {
|
||||
this.leadingZero(time)
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_VIDEO', 'SET_SHARE', 'SET_APPSTATE']),
|
||||
fmtMSS (s) {
|
||||
return (s - (s %= 60)) / 60 + (s > 9 ? ':' : ':0') + s
|
||||
},
|
||||
leadingZero (time) { // 格式化单个调略输入框
|
||||
Object.keys(time).forEach(key => {
|
||||
if (time[key] > 59 || time[key] < 0) {
|
||||
time[key] = '00'
|
||||
} else if (time[key].length > 2) {
|
||||
time[key] = '' + parseInt(time[key])
|
||||
} else if (time[key] < 10 && time[key].length === 1) {
|
||||
time[key] = '0' + time[key]
|
||||
}
|
||||
})
|
||||
},
|
||||
handleNodeClick (node) {
|
||||
if (node.channel) {
|
||||
this.playChannel(node.channel)
|
||||
@@ -442,7 +498,7 @@ export default {
|
||||
},
|
||||
async getUrls () {
|
||||
if (this.video.key === '') {
|
||||
if (!this.video.iptv) this.channelListShow = true
|
||||
if (!this.video.iptv) this.state.showChannelList = true
|
||||
return false
|
||||
}
|
||||
this.name = ''
|
||||
@@ -458,16 +514,25 @@ export default {
|
||||
// 是直播源,直接播放
|
||||
this.playChannel(this.video.iptv)
|
||||
} else {
|
||||
this.channelListShow = false
|
||||
const index = this.video.info.index | 0
|
||||
this.state.showChannelList = false
|
||||
const index = this.video.info.index || 0
|
||||
const db = await history.find({ site: this.video.key, ids: this.video.info.id })
|
||||
const key = this.video.key + '@' + this.video.info.id
|
||||
var time = this.video.info.time
|
||||
if (!time) {
|
||||
// 如果video.info.time没有设定的话,从历史中读取时间进度
|
||||
const db = await history.find({ site: this.video.key, ids: this.video.info.id })
|
||||
if (db) {
|
||||
if (db.index === index) {
|
||||
time = db.time
|
||||
}
|
||||
this.xg.removeAllProgressDot()
|
||||
this.startPosition = this.endPosition = { min: '00', sec: '00' }
|
||||
if (db) {
|
||||
if (!time && db.index === index) { // 如果video.info.time没有设定的话,从历史中读取时间进度
|
||||
time = db.time
|
||||
}
|
||||
if (!VIDEO_DETAIL_CACHE[key]) VIDEO_DETAIL_CACHE[key] = {}
|
||||
if (db.startPosition) { // 数据库保存的时长通过快捷键设置时可能为小数, this.startPosition为object对应输入框分秒转化到数据库后肯定为整数
|
||||
VIDEO_DETAIL_CACHE[key].startPosition = db.startPosition
|
||||
this.startPosition = { min: '' + parseInt(db.startPosition / 60), sec: '' + parseInt(db.startPosition % 60) }
|
||||
}
|
||||
if (db.endPosition) {
|
||||
VIDEO_DETAIL_CACHE[key].endPosition = db.endPosition
|
||||
this.endPosition = { min: '' + parseInt(db.endPosition / 60), sec: '' + parseInt(db.endPosition % 60) }
|
||||
}
|
||||
}
|
||||
this.playVideo(index, time)
|
||||
@@ -484,6 +549,7 @@ export default {
|
||||
channelList.add(ele)
|
||||
},
|
||||
playChannel (channel) {
|
||||
this.isLive = true
|
||||
if (channel.channels) {
|
||||
this.right.sources = channel.channels.filter(e => e.isActive)
|
||||
channel = channel.prefer ? channel.channels.find(e => e.id === channel.prefer) : channel.channels.filter(e => e.isActive)[0]
|
||||
@@ -498,12 +564,11 @@ export default {
|
||||
this.name = channel.name
|
||||
this.xg.src = channel.url
|
||||
this.xg.play()
|
||||
document.querySelector('xg-btn-quitMiniMode').style.display = 'none'
|
||||
document.querySelector('xg-btn-showhistory').style.display = 'none'
|
||||
document.querySelector('.xgplayer-playbackrate').style.display = 'none'
|
||||
},
|
||||
playVideo (index = 0, time = 0) {
|
||||
document.querySelector('xg-btn-quitMiniMode').style.display = 'none'
|
||||
this.isLive = false
|
||||
document.querySelector('xg-btn-showhistory').style.display = 'block'
|
||||
document.querySelector('.xgplayer-playbackrate').style.display = 'inline-block'
|
||||
this.fetchM3u8List().then(m3u8Arr => {
|
||||
@@ -514,21 +579,22 @@ export default {
|
||||
open(onlineUrl)
|
||||
} else {
|
||||
this.xg.src = m3u8Arr[index]
|
||||
if (time !== 0) {
|
||||
this.xg.play()
|
||||
this.xg.once('playing', () => {
|
||||
this.xg.currentTime = time
|
||||
})
|
||||
} else {
|
||||
this.xg.play()
|
||||
}
|
||||
const key = this.video.key + '@' + this.video.info.id
|
||||
const startTime = VIDEO_DETAIL_CACHE[key].startPosition || 0
|
||||
this.xg.play()
|
||||
this.xg.once('playing', () => {
|
||||
this.xg.currentTime = time > startTime ? time : startTime
|
||||
if (VIDEO_DETAIL_CACHE[key].startPosition) this.xg.addProgressDot(VIDEO_DETAIL_CACHE[key].startPosition, '片头')
|
||||
if (VIDEO_DETAIL_CACHE[key].endPosition) this.xg.addProgressDot(this.xg.duration - VIDEO_DETAIL_CACHE[key].endPosition, '片尾')
|
||||
})
|
||||
this.videoPlaying()
|
||||
this.skipendStatus = false
|
||||
this.xg.once('ended', () => {
|
||||
if (m3u8Arr.length > 1 && (m3u8Arr.length - 1 > index)) {
|
||||
this.video.info.time = 0
|
||||
this.video.info.index++
|
||||
}
|
||||
this.xg.off('ended')
|
||||
this.xg.off('ended') // 明明是once为何会触发多次,得注销掉以真正只执行一次
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -536,7 +602,7 @@ export default {
|
||||
fetchM3u8List () {
|
||||
return new Promise((resolve) => {
|
||||
const cacheKey = this.video.key + '@' + this.video.info.id
|
||||
if (VIDEO_DETAIL_CACHE[cacheKey]) {
|
||||
if (VIDEO_DETAIL_CACHE[cacheKey] && VIDEO_DETAIL_CACHE[cacheKey].list && VIDEO_DETAIL_CACHE[cacheKey].list.length) {
|
||||
this.name = VIDEO_DETAIL_CACHE[cacheKey].name
|
||||
resolve(VIDEO_DETAIL_CACHE[cacheKey].list)
|
||||
}
|
||||
@@ -559,10 +625,10 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
VIDEO_DETAIL_CACHE[cacheKey] = {
|
||||
VIDEO_DETAIL_CACHE[cacheKey] = Object.assign(VIDEO_DETAIL_CACHE[cacheKey] || {}, {
|
||||
list: m3u8Arr,
|
||||
name: res.name
|
||||
}
|
||||
})
|
||||
resolve(m3u8Arr)
|
||||
})
|
||||
})
|
||||
@@ -603,6 +669,37 @@ export default {
|
||||
this.checkStar()
|
||||
this.checkTop()
|
||||
},
|
||||
async setProgressDotEvent (position, timespan, text) { // 根据跳略时长在进度条上添加标记, position为位置, timespan为时长,text为标记文本(title)
|
||||
const key = this.video.key + '@' + this.video.info.id
|
||||
const db = await history.find({ site: this.video.key, ids: this.video.info.id })
|
||||
if (db && this.xg && VIDEO_DETAIL_CACHE[key].list.length > 1) {
|
||||
this[position] = { min: '' + parseInt(timespan / 60), sec: '' + parseInt(timespan % 60) }
|
||||
const positionTime = position === 'endPosition' ? this.xg.duration - timespan : timespan
|
||||
if (db[position]) this.xg.removeProgressDot(position === 'endPosition' ? this.xg.duration - db[position] : db[position])
|
||||
if (parseInt(this[position].min) || parseInt(this[position].sec)) this.xg.addProgressDot(positionTime, text) // 均为0时不添加标记
|
||||
const doc = { ...db }
|
||||
doc[position] = timespan
|
||||
delete doc.id
|
||||
history.update(db.id, doc)
|
||||
VIDEO_DETAIL_CACHE[key][position] = timespan
|
||||
}
|
||||
},
|
||||
async setProgressDotByInput () { // 对应调略输入框后的“确定”
|
||||
this.xg.removeAllProgressDot()
|
||||
const startTime = parseInt(this.startPosition.min) * 60 + parseInt(this.startPosition.sec)
|
||||
const endTime = parseInt(this.endPosition.min) * 60 + parseInt(this.endPosition.sec)
|
||||
if (startTime > this.xg.duration || endTime > this.xg.duration) {
|
||||
this.$message.error('设置的跳跃时间长度已超过视频播放时长,请调整设置!')
|
||||
return
|
||||
}
|
||||
await this.setProgressDotEvent('startPosition', startTime)
|
||||
await this.setProgressDotEvent('endPosition', endTime)
|
||||
},
|
||||
async clearPosition () {
|
||||
await this.setProgressDotEvent('startPosition', 0)
|
||||
await this.setProgressDotEvent('endPosition', 0)
|
||||
this.xg.removeAllProgressDot()
|
||||
},
|
||||
timerEvent () {
|
||||
this.timer = setInterval(async () => {
|
||||
const endTime = this.xg.duration
|
||||
@@ -665,6 +762,7 @@ export default {
|
||||
}
|
||||
},
|
||||
historyEvent () {
|
||||
this.state.showChannelList = false
|
||||
if (this.right.type === 'history') {
|
||||
this.right.show = false
|
||||
this.right.type = ''
|
||||
@@ -833,6 +931,7 @@ export default {
|
||||
closeListEvent () {
|
||||
this.right.show = false
|
||||
this.right.type = ''
|
||||
this.state.showChannelList = false
|
||||
},
|
||||
exportM3u8 () {
|
||||
const m3u8Arr = []
|
||||
@@ -941,7 +1040,7 @@ export default {
|
||||
this.getOtherSites()
|
||||
this.right.currentTime = this.xg.currentTime
|
||||
} else {
|
||||
this.channelListShow = false
|
||||
this.state.showChannelList = false
|
||||
this.right.type = 'sources'
|
||||
}
|
||||
this.right.show = true
|
||||
@@ -951,6 +1050,7 @@ export default {
|
||||
this.video = { key: e.key, info: { id: e.id, name: e.name, site: e.site, index: this.video.info.index, time: this.right.currentTime } }
|
||||
},
|
||||
mtEvent () {
|
||||
if (this.setting.shortcutModified) this.currentShortcutList.forEach(e => mt.unbind(e.key))
|
||||
setting.find().then(res => {
|
||||
if (res.shortcut) {
|
||||
shortcut.all().then(res => {
|
||||
@@ -961,17 +1061,25 @@ export default {
|
||||
}
|
||||
})
|
||||
}
|
||||
this.currentShortcutList = res
|
||||
})
|
||||
} else {
|
||||
shortcut.all().then(res => {
|
||||
for (const i of res) {
|
||||
mt.unbind(i.key)
|
||||
}
|
||||
this.currentShortcutList = []
|
||||
})
|
||||
}
|
||||
}).finally(() => {
|
||||
this.setting.shortcutModified = false
|
||||
setting.find().then(res => {
|
||||
res.shortcutModified = this.setting.shortcutModified
|
||||
setting.update(res)
|
||||
})
|
||||
})
|
||||
},
|
||||
shortcutEvent (e) {
|
||||
async shortcutEvent (e) {
|
||||
if (e === 'playAndPause') {
|
||||
if (this.xg) {
|
||||
if (this.xg.paused) {
|
||||
@@ -1063,6 +1171,18 @@ export default {
|
||||
}
|
||||
return false
|
||||
}
|
||||
if (e === 'startPosition') {
|
||||
this.setProgressDotEvent('startPosition', this.xg.currentTime, '片头')
|
||||
return false
|
||||
}
|
||||
if (e === 'endPosition') {
|
||||
this.setProgressDotEvent('endPosition', this.xg.duration - this.xg.currentTime, '片尾')
|
||||
return false
|
||||
}
|
||||
if (e === 'clearPosition') {
|
||||
this.clearPosition()
|
||||
return false
|
||||
}
|
||||
if (e === 'opacityUp') {
|
||||
const num = win.getOpacity()
|
||||
if (num > 0.1) {
|
||||
@@ -1218,14 +1338,14 @@ export default {
|
||||
async getChannelList () {
|
||||
await channelList.all().then(res => {
|
||||
this.channelList = res.filter(e => e.isActive)
|
||||
this.channelListForShow = []
|
||||
this.channelTree = []
|
||||
const groups = [...new Set(this.channelList.map(iptv => iptv.group))]
|
||||
groups.forEach(g => {
|
||||
var doc = {
|
||||
label: g,
|
||||
children: this.channelList.filter(x => x.group === g).map(i => { return { label: i.name, channel: i } })
|
||||
}
|
||||
this.channelListForShow.push(doc)
|
||||
this.channelTree.push(doc)
|
||||
})
|
||||
})
|
||||
},
|
||||
@@ -1239,6 +1359,19 @@ export default {
|
||||
setting.find().then(res => { res.volume = this.config.volume; setting.update(res) })
|
||||
})
|
||||
|
||||
this.xg.on('timeupdate', () => {
|
||||
const key = this.video.key + '@' + this.video.info.id
|
||||
if (VIDEO_DETAIL_CACHE[key] && VIDEO_DETAIL_CACHE[key].endPosition) {
|
||||
const time = this.xg.duration - VIDEO_DETAIL_CACHE[key].endPosition - this.xg.currentTime
|
||||
if (time > 0 && time < 0.3) { // timeupdate每0.25秒触发一次,只有自然播放到该点时才会跳过片尾
|
||||
if (!this.skipendStatus) {
|
||||
this.skipendStatus = true
|
||||
this.xg.emit('ended')
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
this.xg.on('playNextOne', () => {
|
||||
this.nextEvent()
|
||||
})
|
||||
@@ -1285,6 +1418,25 @@ export default {
|
||||
this.xg.on('exitFullscreen', () => {
|
||||
document.querySelector('.xg-view-videoTitle').style.display = 'none'
|
||||
})
|
||||
|
||||
this.xg.on('play', () => {
|
||||
if (!this.video.key) {
|
||||
if (!this.video.iptv && !this.video.info.ids) {
|
||||
// 如果当前播放页面的播放信息没有被赋值,播放历史记录
|
||||
if (this.right.history.length === 0) {
|
||||
this.$message.error('历史记录为空,无法播放!')
|
||||
this.videoStop()
|
||||
return
|
||||
}
|
||||
var historyItem = this.right.history[0]
|
||||
this.video = { key: historyItem.site, info: { id: historyItem.ids, name: historyItem.name, index: historyItem.index } }
|
||||
this.getUrls()
|
||||
} else if (this.video.iptv && !this.isLive) {
|
||||
this.playChannel(this.video.iptv)
|
||||
this.state.showChannelList = false
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
videoStop () {
|
||||
win.setProgressBar(-1)
|
||||
@@ -1298,13 +1450,16 @@ export default {
|
||||
this.xg.destroy(false)
|
||||
this.xg = null
|
||||
this.name = ''
|
||||
this.isLive = false
|
||||
this.state.showChannelList = true
|
||||
this.state.showTimespanSetting = false
|
||||
this.right.list = []
|
||||
this.getAllhistory()
|
||||
setTimeout(() => {
|
||||
this.xg = new HlsJsPlayer(this.config)
|
||||
this.playerInstall()
|
||||
this.bindEvent()
|
||||
}, 1000)
|
||||
}, 100)
|
||||
},
|
||||
minMaxEvent () {
|
||||
win.on('minimize', () => {
|
||||
@@ -1313,9 +1468,7 @@ export default {
|
||||
}
|
||||
})
|
||||
win.on('restore', () => {
|
||||
// 不知为何,在if clause里直接使用this.xg.hasStart居然就不工作,不得其解。
|
||||
var hasStart = this.xg.hasStart
|
||||
if (this.xg && hasStart) {
|
||||
if (this.xg && this.xg.hasStart) {
|
||||
this.xg.play()
|
||||
}
|
||||
})
|
||||
@@ -1401,6 +1554,9 @@ export default {
|
||||
cursor: pointer;
|
||||
margin-left: 3px;
|
||||
}
|
||||
.xgplayer-skin-default .xg-btn-quitMiniMode {
|
||||
display: none;
|
||||
}
|
||||
.xgplayer-skin-default .xg-btn-playPrev:hover,
|
||||
.xgplayer-skin-default .xg-btn-playNextOne:hover,
|
||||
.xgplayer-skin-default .xg-btn-showList:hover,
|
||||
@@ -1553,6 +1709,16 @@ export default {
|
||||
margin-right: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.timespan{
|
||||
margin-left: auto;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
input{
|
||||
&::-webkit-inner-spin-button, &::-webkit-outer-spin-button {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.list{
|
||||
|
||||
@@ -1,348 +1,338 @@
|
||||
<template>
|
||||
<div class="listpage" id="recommendataions">
|
||||
<div class="listpage-header" id="recommendataions-header">
|
||||
<el-switch v-model="viewMode" active-text="海报" active-value="picture" inactive-text="列表" inactive-value="table" @change="updateViewMode"></el-switch>
|
||||
<el-button type="text">视频数:{{ recommendations.length }}</el-button>
|
||||
<el-select v-model="selectedAreas" size="small" multiple collapse-tags placeholder="地区" popper-class="popper" :popper-append-to-body="false">
|
||||
<el-option
|
||||
v-for="item in areas"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="selectedTypes" size="small" multiple collapse-tags placeholder="类型" popper-class="popper" :popper-append-to-body="false">
|
||||
<el-option
|
||||
v-for="item in types"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="sortKeyword" size="small" placeholder="排序" popper-class="popper" :popper-append-to-body="false">
|
||||
<el-option
|
||||
v-for="item in sortKeywords"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button :loading="loading" @click.stop="updateEvent" icon="el-icon-refresh">更新推荐</el-button>
|
||||
</div>
|
||||
<div class="listpage-body" id="recommendataions-body" >
|
||||
<div class="show-table" id="star-table" v-show="viewMode === 'table'">
|
||||
<el-table size="mini" fit height="100%" row-key="id"
|
||||
ref="recommendataionsTable"
|
||||
:data="filteredRecommendations"
|
||||
@row-click="detailEvent">
|
||||
<el-table-column
|
||||
prop="name"
|
||||
label="片名">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="detail.area"
|
||||
label="地区"
|
||||
width="100">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="detail.type"
|
||||
label="类型"
|
||||
width="100">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="detail.year"
|
||||
label="上映"
|
||||
width="100"
|
||||
align="center">
|
||||
</el-table-column>
|
||||
<el-table-column v-if="filteredRecommendations.some(e => e.rate)"
|
||||
prop="rate"
|
||||
align="center"
|
||||
width="100"
|
||||
label="豆瓣评分">
|
||||
</el-table-column>
|
||||
<el-table-column v-if="filteredRecommendations.some(e => e.detail.note)"
|
||||
prop="detail.note"
|
||||
label="备注">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
header-align="center"
|
||||
align="right"
|
||||
width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click.stop="playEvent(scope.row)" type="text">播放</el-button>
|
||||
<el-button @click.stop="shareEvent(scope.row)" type="text">分享</el-button>
|
||||
<el-button @click.stop="downloadEvent(scope.row)" type="text">下载</el-button>
|
||||
<el-button @click.stop="deleteEvent(scope.row)" type="text">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="show-picture" id="star-picture" v-show="viewMode === 'picture'">
|
||||
<Waterfall ref="recommendataionsWaterfall" :list="filteredRecommendations" :gutter="20" :width="240"
|
||||
:breakpoints="{
|
||||
1200: { //当屏幕宽度小于等于1200
|
||||
rowPerView: 4,
|
||||
},
|
||||
800: { //当屏幕宽度小于等于800
|
||||
rowPerView: 3,
|
||||
},
|
||||
500: { //当屏幕宽度小于等于500
|
||||
rowPerView: 2,
|
||||
}
|
||||
}"
|
||||
animationDuration="0.5s"
|
||||
backgroundColor="rgba(0, 0, 0, 0)">
|
||||
<template slot="item" slot-scope="props">
|
||||
<div class="card">
|
||||
<div class="img">
|
||||
<div class="rate" v-if="props.data.rate && props.data.rate !== '暂无评分'">
|
||||
<span>{{props.data.rate}}分</span>
|
||||
</div>
|
||||
<img style="width: 100%" :src="props.data.detail.pic" alt="" @load="$refs.recommendataionsWaterfall.refresh()" @click="detailEvent(props.data)">
|
||||
<div class="operate">
|
||||
<div class="operate-wrap">
|
||||
<span class="o-play" @click="playEvent(props.data)">播放</span>
|
||||
<span class="o-share" @click="shareEvent(props.data)">分享</span>
|
||||
<span class="o-star" @click="downloadEvent(props.data)">下载</span>
|
||||
<span class="o-star" @click="deleteEvent(props.data)">删除</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="name" @click="detailEvent(props.data)">{{props.data.name}}</div>
|
||||
<div class="info">
|
||||
<span>{{props.data.detail.area}}</span>
|
||||
<span>{{props.data.detail.year}}</span>
|
||||
<span>{{props.data.detail.note}}</span>
|
||||
<span>{{props.data.detail.type}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</Waterfall>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import { history, recommendation, setting } from '../lib/dexie'
|
||||
import zy from '../lib/site/tools'
|
||||
import Waterfall from 'vue-waterfall-plugin'
|
||||
const { clipboard } = require('electron')
|
||||
export default {
|
||||
name: 'recommendations',
|
||||
data () {
|
||||
return {
|
||||
recommendations: [],
|
||||
sites: [],
|
||||
viewMode: 'picture',
|
||||
loading: false,
|
||||
types: [],
|
||||
selectedTypes: [],
|
||||
areas: [],
|
||||
selectedAreas: [],
|
||||
sortKeyword: '',
|
||||
sortKeywords: ['上映', '评分', '默认']
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Waterfall
|
||||
},
|
||||
computed: {
|
||||
view: {
|
||||
get () {
|
||||
return this.$store.getters.getView
|
||||
},
|
||||
set (val) {
|
||||
this.SET_VIEW(val)
|
||||
}
|
||||
},
|
||||
video: {
|
||||
get () {
|
||||
return this.$store.getters.getVideo
|
||||
},
|
||||
set (val) {
|
||||
this.SET_VIDEO(val)
|
||||
}
|
||||
},
|
||||
detail: {
|
||||
get () {
|
||||
return this.$store.getters.getDetail
|
||||
},
|
||||
set (val) {
|
||||
this.SET_DETAIL(val)
|
||||
}
|
||||
},
|
||||
share: {
|
||||
get () {
|
||||
return this.$store.getters.getShare
|
||||
},
|
||||
set (val) {
|
||||
this.SET_SHARE(val)
|
||||
}
|
||||
},
|
||||
filteredRecommendations () {
|
||||
var filteredData = this.recommendations.filter(x => (this.selectedAreas.length === 0) || this.selectedAreas.includes(x.detail.area))
|
||||
filteredData = filteredData.filter(x => (this.selectedTypes.length === 0) || this.selectedTypes.includes(x.detail.type))
|
||||
return filteredData
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
view () {
|
||||
if (this.view === 'Recommendation') {
|
||||
this.getRecommendations()
|
||||
if (this.$refs.recommendataionsWaterfall) {
|
||||
this.$refs.recommendataionsWaterfall.refresh()
|
||||
}
|
||||
}
|
||||
},
|
||||
sortKeyword () {
|
||||
switch (this.sortKeyword) {
|
||||
case '上映':
|
||||
this.recommendations = this.recommendations.sort(function (a, b) {
|
||||
return b.detail.year - a.detail.year
|
||||
})
|
||||
break
|
||||
case '评分':
|
||||
this.recommendations.sort(function (a, b) {
|
||||
return b.rate - a.rate
|
||||
})
|
||||
break
|
||||
case '默认':
|
||||
this.recommendations.sort(function (a, b) {
|
||||
return b.id - a.id
|
||||
})
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_VIDEO', 'SET_SHARE']),
|
||||
detailEvent (e) {
|
||||
this.detail = {
|
||||
show: true,
|
||||
key: e.key,
|
||||
info: {
|
||||
id: e.ids,
|
||||
name: e.name
|
||||
}
|
||||
}
|
||||
},
|
||||
updateEvent () {
|
||||
const url = 'https://raw.githubusercontent.com/cuiocean/ZY-Player-Resources/main/Recommendations/Recommendations.json'
|
||||
this.loading = true
|
||||
const axios = require('axios')
|
||||
axios.get(url).then(res => {
|
||||
if (res.status === 200) {
|
||||
if (res.data.length > 0) {
|
||||
this.recommendations = res.data
|
||||
recommendation.clear().then(recommendation.bulkAdd(this.recommendations))
|
||||
this.getFilterData()
|
||||
this.$message.success('更新推荐成功. 仅根据作者cuiocean个人喜好推荐,不喜请无视.')
|
||||
}
|
||||
}
|
||||
this.loading = false
|
||||
}).catch(error => {
|
||||
this.loading = false
|
||||
this.$message.error('更新推荐失败. ' + error)
|
||||
this.$message.warning('最新的推荐数据保存在Github上,请考虑使用代理或者等待下一版本内置数据更新.')
|
||||
})
|
||||
},
|
||||
async playEvent (e) {
|
||||
const db = await history.find({ site: e.key, ids: e.ids })
|
||||
if (db) {
|
||||
this.video = { key: e.key, info: { id: db.ids, name: db.name, index: db.index }, detail: db.detail }
|
||||
} else {
|
||||
this.video = { key: e.key, info: { id: e.ids, name: e.name, index: 0 }, detail: e.detail }
|
||||
}
|
||||
this.view = 'Play'
|
||||
},
|
||||
deleteEvent (e) {
|
||||
recommendation.remove(e.id).then(res => {
|
||||
if (res) {
|
||||
this.$message.warning('删除失败')
|
||||
}
|
||||
this.getRecommendations()
|
||||
})
|
||||
},
|
||||
shareEvent (e) {
|
||||
this.share = {
|
||||
show: true,
|
||||
key: e.key,
|
||||
info: e
|
||||
}
|
||||
},
|
||||
downloadEvent (e) {
|
||||
zy.download(e.key, e.ids).then(res => {
|
||||
if (res) {
|
||||
const text = res.m3u8List
|
||||
if (text) {
|
||||
const list = text.split('#')
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『MP4』格式的链接已复制, 快去下载吧!')
|
||||
} else {
|
||||
this.$message.warning('没有查询到下载链接.')
|
||||
}
|
||||
} else {
|
||||
zy.detail(e.key, e.ids).then(res => {
|
||||
const list = [...res.m3u8List]
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getRecommendations () {
|
||||
recommendation.all().then(res => {
|
||||
this.recommendations = res.sort(function (a, b) {
|
||||
return b.id - a.id
|
||||
})
|
||||
this.getFilterData()
|
||||
})
|
||||
},
|
||||
getFilterData () {
|
||||
this.types = [...new Set(this.recommendations.map(ele => ele.detail.type))].filter(x => x)
|
||||
this.areas = [...new Set(this.recommendations.map(ele => ele.detail.area))].filter(x => x)
|
||||
},
|
||||
getViewMode () {
|
||||
setting.find().then(res => {
|
||||
this.viewMode = res.recommendationViewMode
|
||||
})
|
||||
},
|
||||
updateViewMode () {
|
||||
setting.find().then(res => {
|
||||
res.recommendationViewMode = this.viewMode
|
||||
setting.update(res)
|
||||
})
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getRecommendations()
|
||||
this.getViewMode()
|
||||
},
|
||||
mounted () {
|
||||
window.addEventListener('resize', () => {
|
||||
if (this.$refs.recommendataionsWaterfall && this.view === 'Recommendation') {
|
||||
this.$refs.recommendataionsWaterfall.resize()
|
||||
this.$refs.recommendataionsWaterfall.refresh()
|
||||
setTimeout(() => {
|
||||
this.$refs.recommendataionsWaterfall.refresh()
|
||||
}, 500)
|
||||
}
|
||||
}, false)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div class="listpage" id="recommendataions">
|
||||
<div class="listpage-header" id="recommendataions-header">
|
||||
<el-switch v-model="setting.recommendationViewMode" active-text="海报" active-value="picture" inactive-text="列表" inactive-value="table" @change="updateViewMode"></el-switch>
|
||||
<el-button type="text">视频数:{{ recommendations.length }}</el-button>
|
||||
<el-select v-model="selectedAreas" size="small" multiple placeholder="地区" popper-class="popper" :popper-append-to-body="false">
|
||||
<el-option
|
||||
v-for="item in areas"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="selectedTypes" size="small" multiple placeholder="类型" popper-class="popper" :popper-append-to-body="false">
|
||||
<el-option
|
||||
v-for="item in types"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="sortKeyword" size="small" placeholder="排序" popper-class="popper" :popper-append-to-body="false">
|
||||
<el-option
|
||||
v-for="item in sortKeywords"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button :loading="loading" @click.stop="updateEvent" icon="el-icon-refresh">更新推荐</el-button>
|
||||
</div>
|
||||
<div class="listpage-body" id="recommendataions-body" >
|
||||
<div class="show-table" id="star-table" v-if="setting.recommendationViewMode === 'table'">
|
||||
<el-table size="mini" fit height="100%" row-key="id"
|
||||
ref="recommendataionsTable"
|
||||
:data="filteredRecommendations"
|
||||
@row-click="detailEvent">
|
||||
<el-table-column
|
||||
prop="name"
|
||||
label="片名">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="detail.area"
|
||||
label="地区"
|
||||
width="100">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="detail.type"
|
||||
label="类型"
|
||||
width="100">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="detail.year"
|
||||
label="上映"
|
||||
width="100"
|
||||
align="center">
|
||||
</el-table-column>
|
||||
<el-table-column v-if="filteredRecommendations.some(e => e.rate)"
|
||||
prop="rate"
|
||||
align="center"
|
||||
width="100"
|
||||
label="豆瓣评分">
|
||||
</el-table-column>
|
||||
<el-table-column v-if="filteredRecommendations.some(e => e.detail.note)"
|
||||
prop="detail.note"
|
||||
label="备注">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
header-align="center"
|
||||
align="right"
|
||||
width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click.stop="playEvent(scope.row)" type="text">播放</el-button>
|
||||
<el-button @click.stop="shareEvent(scope.row)" type="text">分享</el-button>
|
||||
<el-button @click.stop="downloadEvent(scope.row)" type="text">下载</el-button>
|
||||
<el-button @click.stop="deleteEvent(scope.row)" type="text">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="show-picture" id="star-picture" v-if="setting.recommendationViewMode === 'picture'">
|
||||
<Waterfall ref="recommendataionsWaterfall" :list="filteredRecommendations" :gutter="20" :width="240"
|
||||
:breakpoints="{
|
||||
1200: { //当屏幕宽度小于等于1200
|
||||
rowPerView: 4,
|
||||
},
|
||||
800: { //当屏幕宽度小于等于800
|
||||
rowPerView: 3,
|
||||
},
|
||||
500: { //当屏幕宽度小于等于500
|
||||
rowPerView: 2,
|
||||
}
|
||||
}"
|
||||
animationDuration="0.5s"
|
||||
backgroundColor="rgba(0, 0, 0, 0)">
|
||||
<template slot="item" slot-scope="props">
|
||||
<div class="card">
|
||||
<div class="img">
|
||||
<div class="rate" v-if="props.data.rate && props.data.rate !== '暂无评分'">
|
||||
<span>{{props.data.rate}}分</span>
|
||||
</div>
|
||||
<img style="width: 100%" :src="props.data.detail.pic" alt="" @load="$refs.recommendataionsWaterfall.refresh()" @click="detailEvent(props.data)">
|
||||
<div class="operate">
|
||||
<div class="operate-wrap">
|
||||
<span class="o-play" @click="playEvent(props.data)">播放</span>
|
||||
<span class="o-share" @click="shareEvent(props.data)">分享</span>
|
||||
<span class="o-star" @click="downloadEvent(props.data)">下载</span>
|
||||
<span class="o-star" @click="deleteEvent(props.data)">删除</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="name" @click="detailEvent(props.data)">{{props.data.name}}</div>
|
||||
<div class="info">
|
||||
<span>{{props.data.detail.area}}</span>
|
||||
<span>{{props.data.detail.year}}</span>
|
||||
<span>{{props.data.detail.note}}</span>
|
||||
<span>{{props.data.detail.type}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</Waterfall>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import { history, recommendation, setting } from '../lib/dexie'
|
||||
import zy from '../lib/site/tools'
|
||||
import Waterfall from 'vue-waterfall-plugin'
|
||||
const { clipboard } = require('electron')
|
||||
export default {
|
||||
name: 'recommendations',
|
||||
data () {
|
||||
return {
|
||||
recommendations: [],
|
||||
sites: [],
|
||||
loading: false,
|
||||
types: [],
|
||||
selectedTypes: [],
|
||||
areas: [],
|
||||
selectedAreas: [],
|
||||
sortKeyword: '',
|
||||
sortKeywords: ['上映', '评分', '默认']
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Waterfall
|
||||
},
|
||||
computed: {
|
||||
view: {
|
||||
get () {
|
||||
return this.$store.getters.getView
|
||||
},
|
||||
set (val) {
|
||||
this.SET_VIEW(val)
|
||||
}
|
||||
},
|
||||
video: {
|
||||
get () {
|
||||
return this.$store.getters.getVideo
|
||||
},
|
||||
set (val) {
|
||||
this.SET_VIDEO(val)
|
||||
}
|
||||
},
|
||||
detail: {
|
||||
get () {
|
||||
return this.$store.getters.getDetail
|
||||
},
|
||||
set (val) {
|
||||
this.SET_DETAIL(val)
|
||||
}
|
||||
},
|
||||
share: {
|
||||
get () {
|
||||
return this.$store.getters.getShare
|
||||
},
|
||||
set (val) {
|
||||
this.SET_SHARE(val)
|
||||
}
|
||||
},
|
||||
setting: {
|
||||
get () {
|
||||
return this.$store.getters.getSetting
|
||||
},
|
||||
set (val) {
|
||||
this.SET_SETTING(val)
|
||||
}
|
||||
},
|
||||
filteredRecommendations () {
|
||||
var filteredData = this.recommendations.filter(x => (this.selectedAreas.length === 0) || this.selectedAreas.includes(x.detail.area))
|
||||
filteredData = filteredData.filter(x => (this.selectedTypes.length === 0) || this.selectedTypes.includes(x.detail.type))
|
||||
return filteredData
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
view () {
|
||||
if (this.view === 'Recommendation') {
|
||||
if (this.$refs.recommendataionsWaterfall) this.$refs.recommendataionsWaterfall.resize()
|
||||
}
|
||||
},
|
||||
sortKeyword () {
|
||||
switch (this.sortKeyword) {
|
||||
case '上映':
|
||||
this.recommendations = this.recommendations.sort(function (a, b) {
|
||||
return b.detail.year - a.detail.year
|
||||
})
|
||||
break
|
||||
case '评分':
|
||||
this.recommendations.sort(function (a, b) {
|
||||
return b.rate - a.rate
|
||||
})
|
||||
break
|
||||
case '默认':
|
||||
this.recommendations.sort(function (a, b) {
|
||||
return b.id - a.id
|
||||
})
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_VIDEO', 'SET_SHARE', 'SET_SETTING']),
|
||||
detailEvent (e) {
|
||||
this.detail = {
|
||||
show: true,
|
||||
key: e.key,
|
||||
info: {
|
||||
id: e.ids,
|
||||
name: e.name
|
||||
}
|
||||
}
|
||||
},
|
||||
updateEvent () {
|
||||
const url = 'https://raw.githubusercontent.com/cuiocean/ZY-Player-Resources/main/Recommendations/Recommendations.json'
|
||||
this.loading = true
|
||||
const axios = require('axios')
|
||||
axios.get(url).then(res => {
|
||||
if (res.status === 200) {
|
||||
if (res.data.length > 0) {
|
||||
this.recommendations = res.data
|
||||
recommendation.clear().then(recommendation.bulkAdd(this.recommendations))
|
||||
this.getFilterData()
|
||||
this.$message.success('更新推荐成功. 仅根据作者cuiocean个人喜好推荐,不喜请无视.')
|
||||
}
|
||||
}
|
||||
this.loading = false
|
||||
}).catch(error => {
|
||||
this.loading = false
|
||||
this.$message.error('更新推荐失败. ' + error)
|
||||
this.$message.warning('最新的推荐数据保存在Github上,请考虑使用代理或者等待下一版本内置数据更新.')
|
||||
})
|
||||
},
|
||||
async playEvent (e) {
|
||||
const db = await history.find({ site: e.key, ids: e.ids })
|
||||
if (db) {
|
||||
this.video = { key: e.key, info: { id: db.ids, name: db.name, index: db.index }, detail: db.detail }
|
||||
} else {
|
||||
this.video = { key: e.key, info: { id: e.ids, name: e.name, index: 0 }, detail: e.detail }
|
||||
}
|
||||
this.view = 'Play'
|
||||
},
|
||||
deleteEvent (e) {
|
||||
recommendation.remove(e.id).then(res => {
|
||||
if (res) {
|
||||
this.$message.warning('删除失败')
|
||||
}
|
||||
this.getRecommendations()
|
||||
})
|
||||
},
|
||||
shareEvent (e) {
|
||||
this.share = {
|
||||
show: true,
|
||||
key: e.key,
|
||||
info: e.detail
|
||||
}
|
||||
},
|
||||
downloadEvent (e) {
|
||||
const key = e.key
|
||||
const id = e.ids
|
||||
zy.download(key, id).then(res => {
|
||||
if (res && res.m3u8List) {
|
||||
const list = res.m3u8List.split('#')
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『MP4』格式的链接已复制, 快去下载吧!')
|
||||
} else {
|
||||
zy.detail(key, id).then(res => {
|
||||
const list = [...res.m3u8List]
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getRecommendations () {
|
||||
recommendation.all().then(res => {
|
||||
this.recommendations = res.sort(function (a, b) {
|
||||
return b.id - a.id
|
||||
})
|
||||
this.getFilterData()
|
||||
})
|
||||
},
|
||||
getFilterData () {
|
||||
this.types = [...new Set(this.recommendations.map(ele => ele.detail.type))].filter(x => x)
|
||||
this.areas = [...new Set(this.recommendations.map(ele => ele.detail.area))].filter(x => x)
|
||||
},
|
||||
updateViewMode () {
|
||||
setTimeout(() => { if (this.$refs.recommendataionsWaterfall) this.$refs.recommendataionsWaterfall.refresh() }, 700)
|
||||
setting.find().then(res => {
|
||||
res.recommendationViewMode = this.setting.recommendationViewMode
|
||||
setting.update(res)
|
||||
})
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getRecommendations()
|
||||
},
|
||||
mounted () {
|
||||
addEventListener('resize', () => {
|
||||
setTimeout(() => { if (this.$refs.recommendataionsWaterfall) this.$refs.recommendataionsWaterfall.resize() }, 500)
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -5,22 +5,10 @@
|
||||
<div class="info">
|
||||
<a @click="linkOpen('http://zyplayer.fun/')">官网</a>
|
||||
<a @click="linkOpen('https://github.com/Hunlongyu/ZY-Player')">Github</a>
|
||||
<a @click="linkOpen('https://github.com/Hunlongyu/ZY-Player/issues')">当前版本v{{pkg.version}} 反馈</a>
|
||||
<a style="color:#38dd77" @click="quitAndInstall()" v-show="latestVersion !== pkg.version" >最新版本v{{latestVersion}}</a>
|
||||
</div>
|
||||
<div class="view">
|
||||
<div class="title">视图</div>
|
||||
<div class="view-box">
|
||||
<div class="zy-select" @mouseleave="show.view = false">
|
||||
<div class="vs-placeholder" @click="show.view = true">默认视图</div>
|
||||
<div class="vs-options" v-show="show.view">
|
||||
<ul class="zy-scroll">
|
||||
<li :class="d.view === 'picture' ? 'active' : ''" @click="changeView('picture')">海报</li>
|
||||
<li :class="d.view === 'table' ? 'active' : ''" @click="changeView('table')">列表</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a @click="linkOpen('https://github.com/Hunlongyu/ZY-Player/releases/tag/v' + pkg.version)">v{{pkg.version}}更新日志</a>
|
||||
<a @click="linkOpen('https://github.com/Hunlongyu/ZY-Player/issues/80')">常见问题</a>
|
||||
<a @click="linkOpen('https://github.com/Hunlongyu/ZY-Player/issues')">反馈建议</a>
|
||||
<a style="color:#38dd77" @click="openUpdate()" v-show="update.find" >最新版本v{{update.version}}</a>
|
||||
</div>
|
||||
<div class="shortcut">
|
||||
<div class="title">快捷键</div>
|
||||
@@ -40,6 +28,9 @@
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="impShortcut">导入</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="resetShortcut">重置</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="shortcut">
|
||||
@@ -210,13 +201,29 @@
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<div class="update" v-if="update.show">
|
||||
<div class="wrapper">
|
||||
<div class="body">
|
||||
<div class="content" v-html="update.html"></div>
|
||||
<div class="progress" v-show="update.percent > 0">
|
||||
<el-progress :percentage="update.percent"></el-progress>
|
||||
<div class="size" style="font-size: 14px">更新包大小: {{update.size}} KB</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<el-button size="small" @click="cancelUpdate">取消</el-button>
|
||||
<el-button size="small" v-show="!update.downloaded" @click="startUpdate">更新</el-button>
|
||||
<el-button size="small" v-show="update.downloaded" @click="installUpdate">安装</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import pkg from '../../package.json'
|
||||
import { setting, sites, shortcut } from '../lib/dexie'
|
||||
import { sites as defaultSites } from '../lib/dexie/initData'
|
||||
import { sites as defaultSites, localKey as defaultShortcuts } from '../lib/dexie/initData'
|
||||
import { shell, clipboard, remote, ipcRenderer } from 'electron'
|
||||
import db from '../lib/dexie/dexie'
|
||||
import zy from '../lib/site/tools'
|
||||
@@ -245,6 +252,15 @@ export default {
|
||||
scheme: '',
|
||||
url: '',
|
||||
port: ''
|
||||
},
|
||||
update: {
|
||||
find: false,
|
||||
version: '',
|
||||
show: false,
|
||||
html: '',
|
||||
percent: 0,
|
||||
size: 0,
|
||||
downloaded: false
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -290,11 +306,6 @@ export default {
|
||||
this.shortcutList = res
|
||||
})
|
||||
},
|
||||
changeView (e) {
|
||||
this.d.view = e
|
||||
this.updateSettingEvent()
|
||||
this.show.view = false
|
||||
},
|
||||
async clearCache () {
|
||||
const win = remote.getCurrentWindow()
|
||||
const ses = win.webContents.session
|
||||
@@ -416,10 +427,20 @@ export default {
|
||||
this.$message.info('已清空原数据')
|
||||
shortcut.add(json).then(e => {
|
||||
this.$message.success('已添加成功')
|
||||
this.getSites()
|
||||
this.getShortcut()
|
||||
this.d.shortcutModified = true
|
||||
this.updateSettingEvent()
|
||||
})
|
||||
})
|
||||
},
|
||||
resetShortcut () {
|
||||
shortcut.clear().then(shortcut.add(defaultShortcuts)).then(res => {
|
||||
this.getShortcut()
|
||||
this.$message.success('快捷键已重置')
|
||||
this.d.shortcutModified = true
|
||||
this.updateSettingEvent()
|
||||
})
|
||||
},
|
||||
async changeProxyType (e) {
|
||||
this.d.proxy.type = e
|
||||
if (e === 'manual') {
|
||||
@@ -466,20 +487,31 @@ export default {
|
||||
return false
|
||||
}
|
||||
},
|
||||
getLatestVersion () {
|
||||
checkUpdate () {
|
||||
ipcRenderer.send('checkForUpdate')
|
||||
ipcRenderer.on('update-available', (e, info) => {
|
||||
this.latestVersion = info.version
|
||||
})
|
||||
ipcRenderer.on('update-error', () => {
|
||||
this.$message.warning = '更新出错.'
|
||||
})
|
||||
ipcRenderer.on('update-downloaded', () => {
|
||||
this.$message.info = '下载完毕, 退出安装'
|
||||
this.update.find = true
|
||||
this.update.version = info.version
|
||||
this.update.html = info.releaseNotes
|
||||
})
|
||||
},
|
||||
quitAndInstall () {
|
||||
this.$message.success('已开始下载更新,下载完毕后,将自动退出安装。')
|
||||
openUpdate () {
|
||||
this.update.show = true
|
||||
},
|
||||
cancelUpdate () {
|
||||
this.update.show = false
|
||||
},
|
||||
startUpdate () {
|
||||
ipcRenderer.send('downloadUpdate')
|
||||
ipcRenderer.on('download-progress', (info, progress) => {
|
||||
this.update.size = progress.total
|
||||
this.update.percent = parseFloat(progress.percent).toFixed(1)
|
||||
})
|
||||
ipcRenderer.on('update-downloaded', () => {
|
||||
this.update.downloaded = true
|
||||
})
|
||||
},
|
||||
installUpdate () {
|
||||
ipcRenderer.send('quitAndInstall')
|
||||
},
|
||||
createContextMenu () {
|
||||
@@ -498,7 +530,7 @@ export default {
|
||||
this.getSites()
|
||||
this.getSetting()
|
||||
this.getShortcut()
|
||||
this.getLatestVersion()
|
||||
this.checkUpdate()
|
||||
this.createContextMenu()
|
||||
}
|
||||
}
|
||||
@@ -536,17 +568,6 @@ export default {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.view{
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
margin-top: 20px;
|
||||
.view-box{
|
||||
margin-top: 10px;
|
||||
.zy-select{
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.site{
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
@@ -641,5 +662,28 @@ export default {
|
||||
font-size: 12px;
|
||||
color: #ff000066;
|
||||
}
|
||||
.update{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(7, 17, 27, 0.7);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
.wrapper{
|
||||
background-color: #fff;
|
||||
padding: 20px 50px 40px;
|
||||
border-radius: 4px;
|
||||
max-width: 500px;
|
||||
max-height: 90%;
|
||||
overflow: auto;
|
||||
.footer{
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
</div>
|
||||
<div class="right" id="right">
|
||||
<div class="title">{{ share.info.name }}</div>
|
||||
<qrcode-vue id="qr" :value="link" :size="160" level="L" />
|
||||
<qrcode-vue v-if="link !== ''" id="qr" :value="link" :size="160" level="L" />
|
||||
<div class="tips">
|
||||
<p>长按二维码,识别播放。</p>
|
||||
<p><img src="@/assets/image/logo.png"></p>
|
||||
@@ -68,22 +68,28 @@ export default {
|
||||
info: {}
|
||||
}
|
||||
},
|
||||
getDetail () {
|
||||
this.loading = true
|
||||
const id = this.share.info.ids || this.share.info.id
|
||||
zy.detail(this.share.key, id).then(res => {
|
||||
async getUrl (dl) {
|
||||
const t = dl.dd._t
|
||||
if (t) {
|
||||
return t.split('#')[0].split('$')[1]
|
||||
} else {
|
||||
const id = this.share.info.ids || this.share.info.id
|
||||
const res = await zy.detail(this.share.key, id)
|
||||
if (res) {
|
||||
this.pic = res.pic
|
||||
var m3u8List = res.m3u8List
|
||||
const url = m3u8List[1]
|
||||
this.link = 'http://zyplayer.fun/player/player.html?url=' + url + '&title=' + this.share.info.name
|
||||
return res.m3u8List[1]
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
async getDetail () {
|
||||
this.loading = true
|
||||
this.pic = this.share.info.pic
|
||||
const url = await this.getUrl(this.share.info.dl)
|
||||
this.link = 'http://hunlongyu.gitee.io/zy-player-web?url=' + url + '&name=' + this.share.info.name
|
||||
this.loading = false
|
||||
},
|
||||
picLoadEvent () {
|
||||
const dom = document.getElementById('share')
|
||||
html2canvas(dom, { useCORS: true, allowTaint: true }).then(res => {
|
||||
html2canvas(dom).then(res => {
|
||||
const png = res.toDataURL('image/png')
|
||||
const p = nativeImage.createFromDataURL(png)
|
||||
clipboard.writeImage(p)
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
<template>
|
||||
<div class="listpage" id="star">
|
||||
<div class="listpage-header" id="star-header">
|
||||
<el-switch v-model="viewMode" active-text="海报" active-value="picture" inactive-text="列表" inactive-value="table" @change="updateViewMode"></el-switch>
|
||||
<el-button @click.stop="exportFavoritesEvent" icon="el-icon-upload2">导出</el-button>
|
||||
<el-button @click.stop="importFavoritesEvent" icon="el-icon-download">导入</el-button>
|
||||
<el-button @click.stop="clearFavoritesEvent" icon="el-icon-delete-solid">清空</el-button>
|
||||
<el-switch v-model="setting.starViewMode" active-text="海报" active-value="picture" inactive-text="列表" inactive-value="table" @change="updateViewMode"></el-switch>
|
||||
<el-button @click.stop="exportFavoritesEvent" icon="el-icon-upload2" title="导出全部,自动添加扩展名">导出</el-button>
|
||||
<el-button @click.stop="importFavoritesEvent" icon="el-icon-download" title="支持同时导入多个文件">导入</el-button>
|
||||
<el-button @click.stop="removeSelectedItems" icon="el-icon-delete-solid">{{ multipleSelection.length === 0 ? "清空" : "删除所选" }}</el-button>
|
||||
<el-button @click.stop="updateAllEvent" icon="el-icon-refresh">同步所有收藏</el-button>
|
||||
</div>
|
||||
<div class="listpage-body" id="star-body">
|
||||
<div class="show-table" id="star-table" v-show="viewMode === 'table'">
|
||||
<div class="show-table" id="star-table" v-if="setting.starViewMode === 'table'">
|
||||
<el-table size="mini" fit height="100%" row-key="id"
|
||||
ref="starTable"
|
||||
:data="list"
|
||||
:cell-class-name="checkUpdate"
|
||||
@row-click="detailEvent"
|
||||
@sort-change="handleSortChange">
|
||||
ref="starTable"
|
||||
:data="list"
|
||||
:cell-class-name="checkUpdate"
|
||||
@row-click="detailEvent"
|
||||
@sort-change="handleSortChange"
|
||||
@select="selectionCellClick"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column
|
||||
type="selection">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
sortable
|
||||
:sort-method="(a , b) => sortByLocaleCompare(a.name, b.name)"
|
||||
@@ -78,7 +83,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="show-picture" id="star-picture" v-show="viewMode === 'picture'">
|
||||
<div class="show-picture" id="star-picture" v-if="setting.starViewMode === 'picture'">
|
||||
<Waterfall ref="starWaterfall" :list="list" :gutter="20" :width="240"
|
||||
:breakpoints="{
|
||||
1200: { //当屏幕宽度小于等于1200
|
||||
@@ -146,8 +151,11 @@ export default {
|
||||
return {
|
||||
list: [],
|
||||
sites: [],
|
||||
viewMode: 'picture',
|
||||
numNoUpdate: 0
|
||||
numNoUpdate: 0,
|
||||
shiftDown: false,
|
||||
selectionBegin: '',
|
||||
selectionEnd: '',
|
||||
multipleSelection: []
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -185,6 +193,14 @@ export default {
|
||||
set (val) {
|
||||
this.SET_SHARE(val)
|
||||
}
|
||||
},
|
||||
setting: {
|
||||
get () {
|
||||
return this.$store.getters.getSetting
|
||||
},
|
||||
set (val) {
|
||||
this.SET_SETTING(val)
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -192,9 +208,7 @@ export default {
|
||||
if (this.view === 'Star') {
|
||||
this.getAllsites()
|
||||
this.getFavorites()
|
||||
if (this.$refs.starWaterfall) {
|
||||
this.$refs.starWaterfall.refresh()
|
||||
}
|
||||
if (this.setting.starViewMode === 'table') this.showShiftPrompt()
|
||||
}
|
||||
},
|
||||
numNoUpdate () {
|
||||
@@ -206,13 +220,40 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_VIDEO', 'SET_SHARE']),
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_VIDEO', 'SET_SHARE', 'SET_SETTING']),
|
||||
handleSortChange (column, prop, order) {
|
||||
this.updateDatabase()
|
||||
},
|
||||
sortByLocaleCompare (a, b) {
|
||||
return a.localeCompare(b, 'zh')
|
||||
},
|
||||
selectionCellClick (selection, row) { // 同history一样,逆序
|
||||
if (this.shiftDown && this.selectionBegin !== '' && selection.includes(row)) {
|
||||
this.selectionEnd = row.id
|
||||
const start = this.list.findIndex(e => e.id === Math.max(this.selectionBegin, this.selectionEnd))
|
||||
const end = this.list.findIndex(e => e.id === Math.min(this.selectionBegin, this.selectionEnd))
|
||||
const selections = this.list.slice(start, end + 1)
|
||||
this.$nextTick(() => {
|
||||
selections.forEach(e => this.$refs.starTable.toggleRowSelection(e, true))
|
||||
})
|
||||
this.selectionBegin = this.selectionEnd = ''
|
||||
return
|
||||
}
|
||||
if (selection.includes(row)) {
|
||||
this.selectionBegin = row.id
|
||||
} else {
|
||||
this.selectionBegin = ''
|
||||
}
|
||||
},
|
||||
handleSelectionChange (rows) {
|
||||
this.multipleSelection = rows
|
||||
},
|
||||
removeSelectedItems () {
|
||||
if (!this.multipleSelection.length) this.multipleSelection = this.list
|
||||
this.multipleSelection.forEach(e => star.remove(e.id))
|
||||
this.getFavorites()
|
||||
this.updateDatabase()
|
||||
},
|
||||
detailEvent (e) {
|
||||
this.detail = {
|
||||
show: true,
|
||||
@@ -249,7 +290,7 @@ export default {
|
||||
this.share = {
|
||||
show: true,
|
||||
key: e.key,
|
||||
info: e
|
||||
info: e.detail
|
||||
}
|
||||
},
|
||||
checkUpdate ({ row, rowIndex }) {
|
||||
@@ -299,23 +340,20 @@ export default {
|
||||
})
|
||||
},
|
||||
downloadEvent (e) {
|
||||
zy.download(e.key, e.ids).then(res => {
|
||||
if (res) {
|
||||
const text = res.m3u8List
|
||||
if (text) {
|
||||
const list = text.split('#')
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『MP4』格式的链接已复制, 快去下载吧!')
|
||||
} else {
|
||||
this.$message.warning('没有查询到下载链接.')
|
||||
const key = e.key
|
||||
const id = e.id
|
||||
zy.download(key, id).then(res => {
|
||||
if (res && res.m3u8List) {
|
||||
const list = res.m3u8List.split('#')
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『MP4』格式的链接已复制, 快去下载吧!')
|
||||
} else {
|
||||
zy.detail(e.key, e.ids).then(res => {
|
||||
zy.detail(key, id).then(res => {
|
||||
const list = [...res.m3u8List]
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
@@ -362,13 +400,12 @@ export default {
|
||||
const str = JSON.stringify(arr, null, 2)
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'JSON file', extensions: ['json'] },
|
||||
{ name: 'Normal text file', extensions: ['txt'] },
|
||||
{ name: 'All types', extensions: ['*'] }
|
||||
{ name: 'JSON file', extensions: ['json'] }
|
||||
]
|
||||
}
|
||||
remote.dialog.showSaveDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
if (!result.filePath.endsWith('.json')) result.filePath += '.json'
|
||||
fs.writeFileSync(result.filePath, str)
|
||||
this.$message.success('导出收藏成功')
|
||||
}
|
||||
@@ -379,9 +416,7 @@ export default {
|
||||
importFavoritesEvent () {
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'JSON file', extensions: ['json'] },
|
||||
{ name: 'Normal text file', extensions: ['txt'] },
|
||||
{ name: 'All types', extensions: ['*'] }
|
||||
{ name: 'JSON file', extensions: ['json'] }
|
||||
],
|
||||
properties: ['openFile', 'multiSelections']
|
||||
}
|
||||
@@ -429,11 +464,6 @@ export default {
|
||||
this.$message.error(err)
|
||||
})
|
||||
},
|
||||
clearFavoritesEvent () {
|
||||
star.clear().then(e => {
|
||||
this.getFavorites()
|
||||
})
|
||||
},
|
||||
syncTableData () {
|
||||
if (this.$refs.starTable.tableData && this.$refs.starTable.tableData.length === this.list.length) {
|
||||
this.list = this.$refs.starTable.tableData
|
||||
@@ -461,33 +491,40 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
getViewMode () {
|
||||
setting.find().then(res => {
|
||||
this.viewMode = res.starViewMode
|
||||
})
|
||||
},
|
||||
updateViewMode () {
|
||||
if (this.setting.starViewMode === 'table') {
|
||||
setTimeout(() => { this.rowDrop() }, 100)
|
||||
this.showShiftPrompt()
|
||||
} else {
|
||||
setTimeout(() => { if (this.$refs.starWaterfall) this.$refs.starWaterfall.refresh() }, 700)
|
||||
}
|
||||
setting.find().then(res => {
|
||||
res.starViewMode = this.viewMode
|
||||
res.starViewMode = this.setting.starViewMode
|
||||
setting.update(res)
|
||||
})
|
||||
},
|
||||
showShiftPrompt () {
|
||||
if (this.setting.shiftTooltipLimitTimes === undefined) this.setting.shiftTooltipLimitTimes = 5
|
||||
if (this.setting.shiftTooltipLimitTimes) {
|
||||
this.$message.info('多选时支持shift快捷键')
|
||||
this.setting.shiftTooltipLimitTimes--
|
||||
setting.find().then(res => {
|
||||
res.shiftTooltipLimitTimes = this.setting.shiftTooltipLimitTimes
|
||||
setting.update(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getFavorites()
|
||||
this.getViewMode()
|
||||
},
|
||||
mounted () {
|
||||
this.rowDrop()
|
||||
window.addEventListener('resize', () => {
|
||||
if (this.$refs.starWaterfall && this.view === 'Star') {
|
||||
this.$refs.starWaterfall.resize()
|
||||
this.$refs.starWaterfall.refresh()
|
||||
setTimeout(() => {
|
||||
this.$refs.starWaterfall.refresh()
|
||||
}, 500)
|
||||
}
|
||||
}, false)
|
||||
if (this.setting.starViewMode === 'table') setTimeout(() => { this.rowDrop() }, 100)
|
||||
addEventListener('keydown', code => { if (code.keyCode === 16) this.shiftDown = true })
|
||||
addEventListener('keyup', code => { if (code.keyCode === 16) this.shiftDown = false })
|
||||
addEventListener('resize', () => {
|
||||
setTimeout(() => { if (this.$refs.starWaterfall) this.$refs.starWaterfall.resize() }, 500)
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -16,6 +16,20 @@ db.version(4).stores({
|
||||
channelList: '++id, name, prefer, channels, group, isActive'
|
||||
})
|
||||
|
||||
// 参考https://github.com/dfahlander/Dexie.js/releases/tag/v3.0.0-alpha.3 upgrade可以改变主键和表名了
|
||||
// https://dexie.org/docs/Version/Version.stores()
|
||||
// https://dexie.org/docs/Version/Version.upgrade()
|
||||
// https://ahuigo.github.io/b/ria/js-indexedDB#/ 比较旧,适当参考
|
||||
db.version(5).stores({
|
||||
shortcut: null
|
||||
})
|
||||
|
||||
db.version(6).stores({
|
||||
shortcut: '++id, name, key, desc'
|
||||
}).upgrade(async tx => {
|
||||
await tx.shortcut.bulkAdd(localKey)
|
||||
})
|
||||
|
||||
db.on('populate', () => {
|
||||
db.setting.bulkAdd(setting)
|
||||
db.sites.bulkAdd(sites)
|
||||
|
||||
@@ -20,16 +20,7 @@
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"key": "wolongzy",
|
||||
"id": 3,
|
||||
"name": "卧龙资源网",
|
||||
"api": "https://www.mhapi123.com/inc/api.php",
|
||||
"download": "",
|
||||
"group": "默认",
|
||||
"isActive": true
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"key": "123ku",
|
||||
"name": "123 资源",
|
||||
"api": "http://cj.123ku2.com:12315/inc/api.php",
|
||||
@@ -39,7 +30,7 @@
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"id": 4,
|
||||
"key": "subo988",
|
||||
"name": "速播资源站",
|
||||
"api": "https://www.subo988.com/inc/api.php",
|
||||
@@ -49,7 +40,7 @@
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"id": 5,
|
||||
"key": "88zyw",
|
||||
"name": "88 影视资源站",
|
||||
"api": "http://www.88zyw.net/inc/api.php",
|
||||
@@ -60,24 +51,26 @@
|
||||
},
|
||||
{
|
||||
"key": "zuidazy",
|
||||
"id": 7,
|
||||
"id": 6,
|
||||
"name": "最大资源网",
|
||||
"api": "http://www.zdziyuan.com/inc/ldg_sea.php",
|
||||
"download": "http://www.zdziyuan.com/inc/apidown.php",
|
||||
"group": "默认",
|
||||
"isActive": true
|
||||
"isActive": true,
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"key": "mbo",
|
||||
"id": 8,
|
||||
"id": 7,
|
||||
"name": "秒播资源",
|
||||
"api": "http://caiji.mb77.vip/inc/seacmsapi.php",
|
||||
"download": "",
|
||||
"group": "默认",
|
||||
"isActive": true
|
||||
"isActive": true,
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"id": 8,
|
||||
"key": "apibdzy",
|
||||
"name": "百度云资源",
|
||||
"api": "https://api.apibdzy.com/api.php/provide/vod/at/xml",
|
||||
@@ -87,7 +80,7 @@
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"id": 9,
|
||||
"key": "okzy",
|
||||
"name": "OK 资源网",
|
||||
"api": "http://cj.okzy.tv/inc/api.php",
|
||||
@@ -97,7 +90,7 @@
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"id": 10,
|
||||
"key": "kuyunzy",
|
||||
"name": "酷云资源",
|
||||
"api": "http://caiji.kuyun98.com/inc/ldg_api.php",
|
||||
@@ -107,7 +100,7 @@
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"id": 11,
|
||||
"key": "kubozy",
|
||||
"name": "酷播资源",
|
||||
"api": "http://api.kbzyapi.com/inc/api.php",
|
||||
@@ -117,7 +110,7 @@
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"id": 12,
|
||||
"key": "yongjiuzy",
|
||||
"name": "永久资源",
|
||||
"api": "http://cj.yongjiuzyw.com/inc/api.php",
|
||||
@@ -127,7 +120,7 @@
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"id": 13,
|
||||
"key": "rrzy",
|
||||
"name": "人人资源",
|
||||
"api": "https://www.rrzyw.cc/api.php/provide/vod/from/rrm3u8/at/xml/",
|
||||
@@ -137,7 +130,7 @@
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"id": 14,
|
||||
"key": "bbkdj",
|
||||
"name": "步步高顶尖资源网",
|
||||
"api": "http://api.bbkdj.com/api",
|
||||
@@ -147,17 +140,7 @@
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"key": "solezy",
|
||||
"name": "搜乐资源网",
|
||||
"api": "https://www.caijizy.vip/api.php/provide/vod/at/xml/",
|
||||
"download": "",
|
||||
"group": "默认",
|
||||
"isActive": true,
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"id": 15,
|
||||
"key": "zuixinzy",
|
||||
"name": "最新资源",
|
||||
"api": "http://api.zuixinapi.com/inc/api.php",
|
||||
@@ -167,47 +150,7 @@
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"key": "605zy",
|
||||
"name": "605资源",
|
||||
"api": "http://www.605zy.net/inc/seacmsapi.php",
|
||||
"download": "",
|
||||
"group": "默认",
|
||||
"isActive": true,
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"key": "doubanzy",
|
||||
"name": "豆瓣电影资源",
|
||||
"api": "http://v.1988cj.com/inc/api.php",
|
||||
"download": "http://v.1988cj.com/inc/apidown.php",
|
||||
"group": "默认",
|
||||
"isActive": true,
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"key": "135zy",
|
||||
"name": "135 资源网",
|
||||
"api": "http://cj.zycjw1.com/inc/api.php",
|
||||
"download": "http://cj.zycjw1.com/inc/apidown.php",
|
||||
"group": "默认",
|
||||
"isActive": true,
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"key": "mgtvzy",
|
||||
"name": "芒果 TV 资源网",
|
||||
"api": "https://api.shijiapi.com/api.php/provide/vod/at/xml/",
|
||||
"download": "",
|
||||
"group": "默认",
|
||||
"isActive": true,
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 22,
|
||||
"id": 16,
|
||||
"key": "209zy",
|
||||
"name": "209 资源",
|
||||
"api": "http://cj.1156zy.com/inc/api.php",
|
||||
@@ -215,45 +158,5 @@
|
||||
"group": "默认",
|
||||
"isActive": true,
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 23,
|
||||
"key": "kkzy",
|
||||
"name": "快快资源",
|
||||
"api": "https://api.kkzy.tv/inc/api.php",
|
||||
"download": "",
|
||||
"group": "默认",
|
||||
"isActive": true,
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 24,
|
||||
"key": "mokazy",
|
||||
"name": "魔卡资源网",
|
||||
"api": "https://cj.heiyap.com/api.php/provide/vod/at/xml/",
|
||||
"download": "",
|
||||
"group": "默认",
|
||||
"isActive": true,
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 25,
|
||||
"key": "158zy",
|
||||
"name": "壹伍捌资源网",
|
||||
"api": "http://cj.158zyz.net:158/inc/api.php",
|
||||
"download": "",
|
||||
"group": "默认",
|
||||
"isActive": true,
|
||||
"status": "可用"
|
||||
},
|
||||
{
|
||||
"id": 26,
|
||||
"key": "kyzy",
|
||||
"name": "快影资源站",
|
||||
"api": "https://www.kyzy.tv/api.php/kyyun/vod/at/xml/",
|
||||
"download": "",
|
||||
"group": "默认",
|
||||
"isActive": true,
|
||||
"status": "可用"
|
||||
}
|
||||
]
|
||||
@@ -91,6 +91,21 @@ const localKey = [
|
||||
desc: '跳到视频结束位置',
|
||||
key: 'end'
|
||||
},
|
||||
{
|
||||
name: 'startPosition',
|
||||
desc: '标记片头',
|
||||
key: 'ctrl+home'
|
||||
},
|
||||
{
|
||||
name: 'endPosition',
|
||||
desc: '标记片尾',
|
||||
key: 'ctrl+end'
|
||||
},
|
||||
{
|
||||
name: 'clearPosition',
|
||||
desc: '清除标记',
|
||||
key: 'ctrl+del'
|
||||
},
|
||||
{
|
||||
name: 'opacityUp',
|
||||
desc: '透明度调高',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Vue from 'vue'
|
||||
import { Message, Button, Table, TableColumn, Tag, Input, Dialog, Form, FormItem, Switch, Select, Option, Checkbox, Autocomplete, Col, Tree } from 'element-ui'
|
||||
import { Message, Button, Table, TableColumn, Tag, Input, InputNumber, Dialog, Form, FormItem, Switch, Select, Option, Checkbox, Autocomplete, Col, Tree, Divider, Progress } from 'element-ui'
|
||||
import Plugin from 'v-fit-columns'
|
||||
Vue.use(Button)
|
||||
Vue.use(Col)
|
||||
@@ -7,6 +7,7 @@ Vue.use(Table)
|
||||
Vue.use(TableColumn)
|
||||
Vue.use(Tag)
|
||||
Vue.use(Input)
|
||||
Vue.use(InputNumber)
|
||||
Vue.use(Dialog)
|
||||
Vue.use(Form)
|
||||
Vue.use(FormItem)
|
||||
@@ -17,4 +18,6 @@ Vue.use(Option)
|
||||
Vue.use(Checkbox)
|
||||
Vue.use(Autocomplete)
|
||||
Vue.use(Tree)
|
||||
Vue.use(Divider)
|
||||
Vue.use(Progress)
|
||||
Vue.prototype.$message = Message
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import express from 'express'
|
||||
import cors from 'cors'
|
||||
const Axios = require('axios')
|
||||
|
||||
const app = express()
|
||||
app.use(cors())
|
||||
app.use(express.json())
|
||||
app.use(express.urlencoded({ extended: true }))
|
||||
|
||||
app.post('/api', async (req, res) => {
|
||||
const result = await Axios.get(req.body.url)
|
||||
res.json({
|
||||
code: 1,
|
||||
info: result.data
|
||||
})
|
||||
})
|
||||
|
||||
app.listen(44444)
|
||||
@@ -228,7 +228,10 @@ const zy = {
|
||||
const type = Object.prototype.toString.call(dd)
|
||||
if (type === '[object Array]') {
|
||||
for (const i of dd) {
|
||||
m3u8List = i._t.split('#')
|
||||
// 如果含有多个视频列表的话, 仅获取m3u8列表
|
||||
if (i._flag.includes('m3u8')) {
|
||||
m3u8List = i._t.split('#')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m3u8List = dd._t.split('#')
|
||||
@@ -390,17 +393,15 @@ const zy = {
|
||||
async proxy () {
|
||||
return new Promise((resolve, reject) => {
|
||||
setting.find().then(db => {
|
||||
if (db.proxy) {
|
||||
if (db.proxy.type === 'none') {
|
||||
session.setProxy({ proxyRules: 'direct://' })
|
||||
if (db && db.proxy && db.proxy.type === 'manual') {
|
||||
if (db.proxy.scheme && db.proxy.url && db.proxy.port) {
|
||||
const proxyURL = db.proxy.scheme + '://' + db.proxy.url.trim() + ':' + db.proxy.port.trim()
|
||||
session.setProxy({ proxyRules: proxyURL })
|
||||
http.globalAgent = https.globalAgent = new ElectronProxyAgent(session)
|
||||
} else if (db.proxy.type === 'manual') {
|
||||
if (db.proxy.scheme && db.proxy.url && db.proxy.port) {
|
||||
const proxyURL = db.proxy.scheme + '://' + db.proxy.url.trim() + ':' + db.proxy.port.trim()
|
||||
session.setProxy({ proxyRules: proxyURL })
|
||||
http.globalAgent = https.globalAgent = new ElectronProxyAgent(session)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
session.setProxy({ proxyRules: 'direct://' })
|
||||
http.globalAgent = https.globalAgent = new ElectronProxyAgent(session)
|
||||
}
|
||||
// 不要删了,留着测试用
|
||||
// axios.get('https://api.my-ip.io/ip').then(res => console.log(res))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { BrowserWindow, ipcMain } from 'electron'
|
||||
import { autoUpdater } from 'electron-updater'
|
||||
const { autoUpdater } = require('@imjs/electron-differential-updater')
|
||||
|
||||
export function initUpdater (win = BrowserWindow) {
|
||||
autoUpdater.autoDownload = false
|
||||
@@ -10,9 +10,14 @@ export function initUpdater (win = BrowserWindow) {
|
||||
autoUpdater.checkForUpdates()
|
||||
})
|
||||
|
||||
// 主进程监听开始下载事件
|
||||
ipcMain.on('downloadUpdate', () => {
|
||||
autoUpdater.downloadUpdate()
|
||||
})
|
||||
|
||||
// 主进程监听退出并安装事件
|
||||
ipcMain.on('quitAndInstall', () => {
|
||||
autoUpdater.downloadUpdate()
|
||||
autoUpdater.quitAndInstall()
|
||||
})
|
||||
|
||||
// 开始检测是否有更新
|
||||
@@ -36,13 +41,12 @@ export function initUpdater (win = BrowserWindow) {
|
||||
})
|
||||
|
||||
// 下载更新进度
|
||||
autoUpdater.on('download-progress', (progressObj) => {
|
||||
win.webContents.send('download-progress', progressObj)
|
||||
autoUpdater.on('download-progress', (info, progress) => {
|
||||
win.webContents.send('download-progress', info, progress)
|
||||
})
|
||||
|
||||
// 下载完成并退出安装
|
||||
// 下载完成
|
||||
autoUpdater.on('update-downloaded', () => {
|
||||
win.webContents.send('update-downloaded')
|
||||
autoUpdater.quitAndInstall()
|
||||
})
|
||||
}
|
||||
|
||||
129
yarn.lock
@@ -1116,6 +1116,23 @@
|
||||
dependencies:
|
||||
"@hapi/hoek" "^8.3.0"
|
||||
|
||||
"@imjs/electron-differential-updater@^5.1.3":
|
||||
version "5.1.3"
|
||||
resolved "https://registry.npm.taobao.org/@imjs/electron-differential-updater/download/@imjs/electron-differential-updater-5.1.3.tgz#8427c387cbc20d0fe256b636d450b80312c7cbaa"
|
||||
integrity sha1-hCfDh8vCDQ/iVrY21FC4AxLHy6o=
|
||||
dependencies:
|
||||
"@types/node" "^14.0.11"
|
||||
"@types/semver" "^7.1.0"
|
||||
app-builder-bin "^3.5.9"
|
||||
builder-util-runtime "^8.7.1"
|
||||
fs-extra "^9.0.1"
|
||||
js-yaml "^3.14.0"
|
||||
lazy-val "^1.0.4"
|
||||
lodash.isequal "^4.5.0"
|
||||
semver "^7.3.2"
|
||||
watch "^1.0.2"
|
||||
zlib "^1.0.5"
|
||||
|
||||
"@intervolga/optimize-cssnano-plugin@^1.0.5":
|
||||
version "1.0.6"
|
||||
resolved "https://registry.npmjs.org/@intervolga/optimize-cssnano-plugin/-/optimize-cssnano-plugin-1.0.6.tgz#be7c7846128b88f6a9b1d1261a0ad06eb5c0fdf8"
|
||||
@@ -1304,6 +1321,11 @@
|
||||
resolved "https://registry.npmjs.org/@types/node/-/node-12.12.49.tgz#f3dec66fce54758350d309b84f989003702f1190"
|
||||
integrity sha512-bkB9k2k7Vu35WM1N06j93QgdXuALx9Dv3j7p/XHPAFTTc7tK8LLp43WltPg/LsciKDssbsr/shYsg036QJxNug==
|
||||
|
||||
"@types/node@^14.0.11":
|
||||
version "14.14.11"
|
||||
resolved "https://registry.npm.taobao.org/@types/node/download/@types/node-14.14.11.tgz?cache=0&sync_timestamp=1607444891103&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-14.14.11.tgz#fc25a4248a5e8d0837019b1d170146d07334abe0"
|
||||
integrity sha1-/CWkJIpejQg3AZsdFwFG0HM0q+A=
|
||||
|
||||
"@types/normalize-package-data@^2.4.0":
|
||||
version "2.4.0"
|
||||
resolved "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e"
|
||||
@@ -1324,7 +1346,7 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.3.tgz#7ee330ba7caafb98090bece86a5ee44115904c2c"
|
||||
integrity sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==
|
||||
|
||||
"@types/semver@^7.3.1":
|
||||
"@types/semver@^7.1.0":
|
||||
version "7.3.4"
|
||||
resolved "https://registry.npm.taobao.org/@types/semver/download/@types/semver-7.3.4.tgz#43d7168fec6fa0988bb1a513a697b29296721afb"
|
||||
integrity sha1-Q9cWj+xvoJiLsaUTppeykpZyGvs=
|
||||
@@ -2021,6 +2043,11 @@ app-builder-bin@3.5.9:
|
||||
resolved "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-3.5.9.tgz#a3ac0c25286bac68357321cb2eaf7128b0bc0a4f"
|
||||
integrity sha512-NSjtqZ3x2kYiDp3Qezsgukx/AUzKPr3Xgf9by4cYt05ILWGAptepeeu0Uv+7MO+41o6ujhLixTou8979JGg2Kg==
|
||||
|
||||
app-builder-bin@^3.5.9:
|
||||
version "3.5.10"
|
||||
resolved "https://registry.npm.taobao.org/app-builder-bin/download/app-builder-bin-3.5.10.tgz#4a7f9999fccc0c435b6284ae1366bc76a17c4a7d"
|
||||
integrity sha1-Sn+ZmfzMDENbYoSuE2a8dqF8Sn0=
|
||||
|
||||
app-builder-lib@22.7.0:
|
||||
version "22.7.0"
|
||||
resolved "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-22.7.0.tgz#ccd3e7ece2d46bc209423a77aa142f74aaf65db0"
|
||||
@@ -2614,7 +2641,7 @@ builder-util-runtime@8.7.1:
|
||||
debug "^4.2.0"
|
||||
sax "^1.2.4"
|
||||
|
||||
builder-util-runtime@8.7.2:
|
||||
builder-util-runtime@^8.7.1:
|
||||
version "8.7.2"
|
||||
resolved "https://registry.npm.taobao.org/builder-util-runtime/download/builder-util-runtime-8.7.2.tgz#d93afc71428a12789b437e13850e1fa7da956d72"
|
||||
integrity sha1-2Tr8cUKKEnibQ34ThQ4fp9qVbXI=
|
||||
@@ -3352,24 +3379,16 @@ core-js@^3.6.5:
|
||||
resolved "https://registry.npmjs.org/core-js/-/core-js-3.6.5.tgz#7395dc273af37fb2e50e9bd3d9fe841285231d1a"
|
||||
integrity sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA==
|
||||
|
||||
core-js@^3.7.0:
|
||||
version "3.7.0"
|
||||
resolved "https://registry.npm.taobao.org/core-js/download/core-js-3.7.0.tgz?cache=0&sync_timestamp=1604675690423&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcore-js%2Fdownload%2Fcore-js-3.7.0.tgz#b0a761a02488577afbf97179e4681bf49568520f"
|
||||
integrity sha1-sKdhoCSIV3r7+XF55Ggb9JVoUg8=
|
||||
core-js@^3.8.0:
|
||||
version "3.8.1"
|
||||
resolved "https://registry.npm.taobao.org/core-js/download/core-js-3.8.1.tgz?cache=0&sync_timestamp=1607215907966&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcore-js%2Fdownload%2Fcore-js-3.8.1.tgz#f51523668ac8a294d1285c3b9db44025fda66d47"
|
||||
integrity sha1-9RUjZorIopTRKFw7nbRAJf2mbUc=
|
||||
|
||||
core-util-is@1.0.2, core-util-is@~1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
|
||||
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
|
||||
|
||||
cors@^2.8.5:
|
||||
version "2.8.5"
|
||||
resolved "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29"
|
||||
integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==
|
||||
dependencies:
|
||||
object-assign "^4"
|
||||
vary "^1"
|
||||
|
||||
cosmiconfig@^5.0.0:
|
||||
version "5.2.1"
|
||||
resolved "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a"
|
||||
@@ -3645,10 +3664,10 @@ d@1, d@^1.0.1:
|
||||
es5-ext "^0.10.50"
|
||||
type "^1.0.1"
|
||||
|
||||
danmu.js@0.2.23:
|
||||
version "0.2.23"
|
||||
resolved "https://registry.npm.taobao.org/danmu.js/download/danmu.js-0.2.23.tgz#339b512152ed5a8253829be007c5be5bd3821856"
|
||||
integrity sha1-M5tRIVLtWoJTgpvgB8W+W9OCGFY=
|
||||
danmu.js@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.npm.taobao.org/danmu.js/download/danmu.js-0.3.0.tgz#10ddd456dcc9ddd1835f07569773cb880d43173a"
|
||||
integrity sha1-EN3UVtzJ3dGDXwdWl3PLiA1DFzo=
|
||||
dependencies:
|
||||
event-emitter "^0.3.5"
|
||||
|
||||
@@ -4160,23 +4179,10 @@ electron-to-chromium@^1.3.591:
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.607.tgz#1bff13f1cf89f2fee0d244b8c64a7138f80f3a3b"
|
||||
integrity sha512-h2SYNaBnlplGS0YyXl8oJWokfcNxVjJANQfMCsQefG6OSuAuNIeW+A8yGT/ci+xRoBb3k2zq1FrOvkgoKBol8g==
|
||||
|
||||
electron-updater@^4.3.5:
|
||||
version "4.3.5"
|
||||
resolved "https://registry.npm.taobao.org/electron-updater/download/electron-updater-4.3.5.tgz?cache=0&sync_timestamp=1600328924432&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Felectron-updater%2Fdownload%2Felectron-updater-4.3.5.tgz#4fb36f593a031c87ea07ee141c9f064d5deffb15"
|
||||
integrity sha1-T7NvWToDHIfqB+4UHJ8GTV3v+xU=
|
||||
dependencies:
|
||||
"@types/semver" "^7.3.1"
|
||||
builder-util-runtime "8.7.2"
|
||||
fs-extra "^9.0.1"
|
||||
js-yaml "^3.14.0"
|
||||
lazy-val "^1.0.4"
|
||||
lodash.isequal "^4.5.0"
|
||||
semver "^7.3.2"
|
||||
|
||||
electron@^11.0.2:
|
||||
version "11.0.3"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-11.0.3.tgz#c29eaacda38ce561890e59906ca5f507c72b3ec4"
|
||||
integrity sha512-nNfbLi7Q1xfJXOEO2adck5TS6asY4Jxc332E4Te8XfQ9hcaC3GiCdeEqk9FndNCwxhJA5Lr9jfSGRTwWebFa/w==
|
||||
electron@^11.0.3:
|
||||
version "11.0.4"
|
||||
resolved "https://registry.npm.taobao.org/electron/download/electron-11.0.4.tgz?cache=0&sync_timestamp=1607394603492&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Felectron%2Fdownload%2Felectron-11.0.4.tgz#78b54760294eb42a36f33308a7987bf0b3dd6125"
|
||||
integrity sha1-eLVHYClOtCo28zMIp5h78LPdYSU=
|
||||
dependencies:
|
||||
"@electron/get" "^1.0.1"
|
||||
"@types/node" "^12.0.12"
|
||||
@@ -4695,6 +4701,13 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3:
|
||||
md5.js "^1.3.4"
|
||||
safe-buffer "^5.1.1"
|
||||
|
||||
exec-sh@^0.2.0:
|
||||
version "0.2.2"
|
||||
resolved "https://registry.npm.taobao.org/exec-sh/download/exec-sh-0.2.2.tgz#2a5e7ffcbd7d0ba2755bdecb16e5a427dfbdec36"
|
||||
integrity sha1-Kl5//L19C6J1W97LFuWkJ9+97DY=
|
||||
dependencies:
|
||||
merge "^1.2.0"
|
||||
|
||||
execa@^0.8.0:
|
||||
version "0.8.0"
|
||||
resolved "https://registry.npmjs.org/execa/-/execa-0.8.0.tgz#d8d76bbc1b55217ed190fd6dd49d3c774ecfc8da"
|
||||
@@ -5951,9 +5964,9 @@ inherits@2.0.3:
|
||||
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
|
||||
|
||||
ini@^1.3.4, ini@^1.3.5, ini@~1.3.0:
|
||||
version "1.3.5"
|
||||
resolved "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
|
||||
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==
|
||||
version "1.3.8"
|
||||
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c"
|
||||
integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==
|
||||
|
||||
inquirer@^7.1.0:
|
||||
version "7.3.0"
|
||||
@@ -6943,6 +6956,11 @@ merge2@^1.2.3:
|
||||
resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
|
||||
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
|
||||
|
||||
merge@^1.2.0:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.npm.taobao.org/merge/download/merge-1.2.1.tgz#38bebf80c3220a8a487b6fcfb3941bb11720c145"
|
||||
integrity sha1-OL6/gMMiCopIe2/Ps5QbsRcgwUU=
|
||||
|
||||
methods@~1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
|
||||
@@ -7390,7 +7408,7 @@ oauth-sign@~0.9.0:
|
||||
resolved "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455"
|
||||
integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==
|
||||
|
||||
object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
|
||||
object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
|
||||
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=
|
||||
@@ -10387,7 +10405,7 @@ validate-npm-package-license@^3.0.1:
|
||||
spdx-correct "^3.0.0"
|
||||
spdx-expression-parse "^3.0.0"
|
||||
|
||||
vary@^1, vary@~1.1.2:
|
||||
vary@~1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
|
||||
integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
|
||||
@@ -10533,10 +10551,18 @@ vuedraggable@^2.24.3:
|
||||
dependencies:
|
||||
sortablejs "1.10.2"
|
||||
|
||||
vuex@^3.5.1:
|
||||
version "3.5.1"
|
||||
resolved "https://registry.npm.taobao.org/vuex/download/vuex-3.5.1.tgz#f1b8dcea649bc25254cf4f4358081dbf5da18b3d"
|
||||
integrity sha1-8bjc6mSbwlJUz09DWAgdv12hiz0=
|
||||
vuex@^3.6.0:
|
||||
version "3.6.0"
|
||||
resolved "https://registry.npm.taobao.org/vuex/download/vuex-3.6.0.tgz?cache=0&sync_timestamp=1606318256705&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvuex%2Fdownload%2Fvuex-3.6.0.tgz#95efa56a58f7607c135b053350833a09e01aa813"
|
||||
integrity sha1-le+lalj3YHwTWwUzUIM6CeAaqBM=
|
||||
|
||||
watch@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npm.taobao.org/watch/download/watch-1.0.2.tgz#340a717bde765726fa0aa07d721e0147a551df0c"
|
||||
integrity sha1-NApxe952Vyb6CqB9ch4BR6VR3ww=
|
||||
dependencies:
|
||||
exec-sh "^0.2.0"
|
||||
minimist "^1.2.0"
|
||||
|
||||
watchpack-chokidar2@^2.0.0:
|
||||
version "2.0.0"
|
||||
@@ -10819,14 +10845,14 @@ xgplayer-hls.js@^2.2.5:
|
||||
event-emitter "^0.3.5"
|
||||
eventemitter3 "^4.0.7"
|
||||
|
||||
xgplayer@^2.13.1:
|
||||
version "2.13.1"
|
||||
resolved "https://registry.yarnpkg.com/xgplayer/-/xgplayer-2.13.1.tgz#a463ca0f80c635dc9d3d9b1adc58b8efab7bcba2"
|
||||
integrity sha512-dwmlCgFQBzmm8ru11RMzAvhXOvmXJURzJ7zVIxuadUa+ofTb1brzEdqwbKEw7Hf35XnwsO3R/Ve+Di96tKlmRw==
|
||||
xgplayer@^2.13.2:
|
||||
version "2.14.4"
|
||||
resolved "https://registry.npm.taobao.org/xgplayer/download/xgplayer-2.14.4.tgz?cache=0&sync_timestamp=1607313373198&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fxgplayer%2Fdownload%2Fxgplayer-2.14.4.tgz#d0cfacd95a08807e1783db8b8546d373a5df52e8"
|
||||
integrity sha1-0M+s2VoIgH4Xg9uLhUbTc6XfUug=
|
||||
dependencies:
|
||||
chalk "^2.3.2"
|
||||
commander "^2.15.1"
|
||||
danmu.js "0.2.23"
|
||||
danmu.js "^0.3.0"
|
||||
deepmerge "^1.5.0"
|
||||
downloadjs "1.4.7"
|
||||
draggabilly "^2.2.0"
|
||||
@@ -10944,3 +10970,8 @@ yorkie@^2.0.0:
|
||||
is-ci "^1.0.10"
|
||||
normalize-path "^1.0.0"
|
||||
strip-indent "^2.0.0"
|
||||
|
||||
zlib@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.npm.taobao.org/zlib/download/zlib-1.0.5.tgz#6e7c972fc371c645a6afb03ab14769def114fcc0"
|
||||
integrity sha1-bnyXL8NxxkWmr7A6sUdp3vEU/MA=
|
||||
|
||||