Skip to content

Commit fd715b7

Browse files
committed
v0.8.3 视频连播, 浏览加载超时提示,生成二维码
1 parent 6979d14 commit fd715b7

File tree

10 files changed

+298
-20
lines changed

10 files changed

+298
-20
lines changed

docs/player/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>ZY Player</title>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zy",
3-
"version": "0.8.2",
3+
"version": "0.8.3",
44
"author": "Hunlongyu",
55
"description": "ZY Player 资源播放器",
66
"private": true,
@@ -22,6 +22,7 @@
2222
"electron-updater": "^4.2.0",
2323
"element-ui": "^2.4.5",
2424
"flyio": "^0.6.14",
25+
"qrcanvas": "^3.0.6",
2526
"vue": "^2.6.10",
2627
"vue-class-component": "^7.0.2",
2728
"vue-property-decorator": "^8.3.0",

src/assets/theme/dark.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
background-color: var(--d-bgc);
1515
border-color: var(--d-dbc);
1616
}
17+
.el-table--border::after, .el-table--group::after, .el-table::before,
1718
.el-table, .el-table th, .el-table tr,
1819
.el-table--striped .el-table__body tr.el-table__row--striped td,
1920
.el-table--enable-row-hover .el-table__body tr:hover>td,

src/lib/util.zy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ interface detail {
3030
urls?: Array<string>
3131
}
3232

33+
fly.config.timeout = 10000
34+
3335
const zy: ZY = {
3436
num: 0,
3537
page: 1,

src/page/film.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ export default Vue.extend({
107107
this.filmData = res.list
108108
this.filmPage = p
109109
this.loading = false
110+
}).catch((err: any) => {
111+
if (err.status === 1) {
112+
this.$message.warning('获取资源超时,请切换分类,或者切换源。')
113+
}
110114
})
111115
},
112116
tableBtnClick (type: string, e: any) {

src/page/player.vue

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
<span>{{ num }}</span>
99
</span>
1010
<span>
11-
<el-button size="mini" @click="topEvent('top')" icon="el-icon-position" title="置顶" circle></el-button>
11+
<el-button size="mini" @click="topEvent('top')" icon="el-icon-place" title="置顶" circle></el-button>
1212
<el-button size="mini" @click="openDetail" icon="el-icon-document" title="查看详情" circle></el-button>
1313
<el-button size="mini" v-show="!star" @click="starEvent" icon="el-icon-star-off" title="添加收藏" circle></el-button>
1414
<el-button size="mini" v-show="star" @click="starEvent" icon="el-icon-star-on" title="取消收藏" circle></el-button>
15+
<el-popover placement="bottom" width="150" trigger="click">
16+
<el-row id="qrcode"></el-row>
17+
<el-button v-show="xg !== null" size="mini" @click="mobileEvent" icon="el-icon-mobile-phone" title="手机观看" circle slot="reference" style="margin-left: 10px;"></el-button>
18+
</el-popover>
1519
</span>
1620
</el-row>
1721
</el-row>
@@ -43,6 +47,7 @@ import 'xgplayer'
4347
// @ts-ignore
4448
import Hls from 'xgplayer-hls.js'
4549
import video from '@/plugins/dexie/video'
50+
import { qrcanvas } from 'qrcanvas'
4651
const { ipcRenderer: ipc } = require('electron')
4752
export default Vue.extend({
4853
data () {
@@ -131,8 +136,16 @@ export default Vue.extend({
131136
this.$nextTick(() => {
132137
this.xg = new Hls(this.config)
133138
// @ts-ignore
134-
this.xg.on('error', () => {
135-
this.$message.error('播放失败请重试~')
139+
this.xg.on('ended', () => {
140+
if (this.urls.length > 1 && (this.urls.length - 1 > this.video.index)) {
141+
this.$message.success('自动播放下一集')
142+
this.video.index++
143+
let v: any = this.urls[this.video.index]
144+
let url = v.split('$')[1]
145+
this.num = v.split('$')[0]
146+
// @ts-ignore
147+
this.xg.src = url
148+
}
136149
})
137150
})
138151
}
@@ -166,6 +179,20 @@ export default Vue.extend({
166179
}
167180
})
168181
},
182+
mobileEvent () {
183+
let info = this.urls[this.video.index]
184+
// @ts-ignore
185+
let time = this.xg.currentTime
186+
const canvas = qrcanvas({
187+
size: 120,
188+
data: `http://zy.hly120506.top/player/index.html?info=${info}&time=${time}`
189+
})
190+
const dom = document.getElementById('qrcode')
191+
if (dom) {
192+
dom.innerHTML = ''
193+
dom.appendChild(canvas)
194+
}
195+
},
169196
playBtnClick (i: string, j: number) {
170197
if (this.video.index !== j) {
171198
let url = i.split('$')[1]

src/page/search.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<el-row class="search">
33
<el-row class="search-box" :class="table === true ? 'search-box hasTable' : 'search-box'">
4-
<el-input class="search-input" size="medium" clearable placeholder="请输入内容" v-model.trim="keywords" @change="searchEvent">
4+
<el-input class="search-input" size="medium" clearable placeholder="请输入内容" v-model.trim="keywords" @change="searchEvent" @clear="clearEvent">
55
<el-select v-model="site" slot="prepend" placeholder="请选择" @change="selectSite" style="width: 130px;">
66
<el-option v-for="(i, j) in sites" :key="i.id" :label="i.name" :value="j"></el-option>
77
</el-select>
@@ -98,6 +98,13 @@ export default Vue.extend({
9898
})
9999
}
100100
},
101+
clearEvent () {
102+
this.loading = false
103+
this.filmData = []
104+
this.filmTotal = 0
105+
this.filmPage = 1
106+
this.table = false
107+
},
101108
pageChange (e:number) {
102109
this.filmPage = e
103110
this.searchEvent()

src/page/setting.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</el-row>
1616
</el-row>
1717
<el-row class="item opacity">
18-
<el-row class="title"><i class="el-icon-picture-outline-round"></i><span>透明度</span></el-row>
18+
<el-row class="title"><i class="el-icon-stopwatch"></i><span>透明度</span></el-row>
1919
<el-row class="info">
2020
<el-slider v-model="opacity" :min="50" :max="100" @input="setOpacity"></el-slider>
2121
</el-row>
@@ -73,7 +73,7 @@ export default Vue.extend({
7373
sites: sites,
7474
dbSite: 0,
7575
opacity: 100,
76-
oldVersion: 'v0.8.1',
76+
oldVersion: 'v0.8.3',
7777
newVersion: '',
7878
download: false
7979
}
@@ -170,7 +170,7 @@ export default Vue.extend({
170170
}
171171
}
172172
.item{
173-
margin-bottom: 30px;
173+
margin-bottom: 20px;
174174
.title{
175175
height: 24px;
176176
line-height: 24px;

src/plugins/element.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
Container, Row, Col, Header, Aside, Main, Drawer,
44
Tabs, TabPane, Button, Select, Option, Pagination,
55
Table, TableColumn, Input, Card, Link, Loading,
6-
Notification, Message, Slider
6+
Notification, Message, Slider, Popover
77
} from 'element-ui'
88

99
Vue.use(Container)
@@ -26,6 +26,7 @@ Vue.use(Card)
2626
Vue.use(Link)
2727
Vue.use(Loading)
2828
Vue.use(Slider)
29+
Vue.use(Popover)
2930

3031
Vue.prototype.$notify = Notification
3132
Vue.prototype.$message = Message

0 commit comments

Comments
 (0)