v0.8.18 优化代码

This commit is contained in:
Hunlongyu
2020-02-22 12:21:06 +08:00
parent 9ce1a8ddf6
commit 4505186307
12 changed files with 56 additions and 12 deletions

View File

@@ -29,12 +29,17 @@
function get (name) {
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);//search,查询?后面的参数,并匹配正则
if(r!=null)return unescape(r[2]); return null;
if (r!=null)return unescape(r[2]); return null;
}
let link = window.location.href
let info = get('info')
let time = get('time')
let url = info.split('$')[1]
let flag = info.indexOf('$')
if (flag > 0) {
let url = info.split('$')[1]
} else {
let url = info
}
let player = new window.HlsJsPlayer({
id: 'mse',
url: url,

View File

@@ -1,6 +1,6 @@
{
"name": "zy",
"version": "0.8.17",
"version": "0.8.18",
"author": "Hunlongyu",
"description": "ZY Player 资源播放器",
"private": true,
@@ -13,7 +13,7 @@
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps",
"electron:generate-icons": "electron-icon-builder --input=./public/icon.png --output=build --flatten",
"bp": "vue-cli-service electron:build --win --x64 -p always"
"bp": "vue-cli-service electron:build --win --x64 portable -p always"
},
"main": "background.js",
"dependencies": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -12,6 +12,9 @@
.el-button--text{
border: none;
}
.el-button--text:focus, .el-button--text:hover{
color: var(--d-c-h);
}
.el-tabs__active-bar{
background-color: var(--d-bdc);
}

View File

@@ -12,6 +12,9 @@
.el-button--text{
border: none;
}
.el-button--text:focus, .el-button--text:hover{
color: var(--g-c-h);
}
.el-tabs__active-bar{
background-color: var(--g-bdc);
}

View File

@@ -12,6 +12,9 @@
.el-button--text{
border: none;
}
.el-button--text:focus, .el-button--text:hover{
color: var(--p-c-h);
}
.el-tabs__active-bar{
background-color: var(--p-bdc);
}

View File

@@ -12,6 +12,7 @@
<el-button size="mini" @click="openDetail" icon="el-icon-document" title="查看详情" circle></el-button>
<el-button size="mini" v-show="!star" @click="starEvent" icon="el-icon-star-off" title="添加收藏" circle></el-button>
<el-button size="mini" v-show="star" @click="starEvent" icon="el-icon-star-on" title="取消收藏" circle></el-button>
<el-button size="mini" @click="shareEvent" icon="el-icon-share" title="分享" circle></el-button>
<el-popover placement="bottom" width="150" trigger="click">
<el-row id="qrcode"></el-row>
<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>
@@ -48,7 +49,7 @@ import 'xgplayer'
import Hls from 'xgplayer-hls.js'
import video from '@/plugins/dexie/video'
import { qrcanvas } from 'qrcanvas'
const { ipcRenderer: ipc } = require('electron')
const { ipcRenderer: ipc, clipboard } = require('electron')
export default Vue.extend({
data () {
return {
@@ -145,6 +146,11 @@ export default Vue.extend({
this.num = v.split('$')[0]
// @ts-ignore
this.xg.src = url
video.find({ detail: this.video.detail }).then(res => {
if (res) {
video.update(res.id, this.video)
}
})
}
})
})
@@ -193,6 +199,15 @@ export default Vue.extend({
dom.appendChild(canvas)
}
},
shareEvent () {
let info: string = this.urls[this.video.index]
let title = this.video.name.replace(/^\s*|\s*$/g, '')
let url = info.split('$')[1]
let data = `http://zy.hly120506.top/player/index.html?info=${url}`
let txt = `资源名称: ${title}\n播放地址:${data}`
clipboard.writeText(txt)
this.$message.success('资源已复制到剪贴板中,快去分享吧~')
},
playBtnClick (i: string, j: number) {
if (this.video.index !== j) {
let url = i.split('$')[1]

View File

@@ -5,6 +5,11 @@
<el-table-column prop="name" label="影片名称"></el-table-column>
<el-table-column prop="type" label="影片类别" width="120"></el-table-column>
<el-table-column prop="time" label="更新时间" width="180"></el-table-column>
<el-table-column label="来源" width="120">
<template slot-scope="scope">
<span>{{ scope.row.detail | from }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="120">
<template slot-scope="scope">
<el-button size="small" type="text" @click="tableBtnClick('detail', scope.row)">详情</el-button>
@@ -28,6 +33,7 @@
<script lang="ts">
import Vue from 'vue'
import video from '@/plugins/dexie/video'
import sites from '@/lib/sites'
import { mapMutations } from 'vuex'
export default Vue.extend({
data () {
@@ -37,6 +43,17 @@ export default Vue.extend({
filmTotal: 0
}
},
filters: {
from (e: string) {
for (let i in sites) {
let url = sites[i].url
let f = e.indexOf(url)
if (f >= 0) {
return sites[i].name
}
}
}
},
computed: {
video: {
get () {

View File

@@ -5,15 +5,13 @@ module.exports = {
win: {
icon: './build/icons/icon.ico',
target: [
{
target: 'nsis',
arch: [
'ia32',
'x64'
]
}
'nsis','portable', 'zip', 'msi'
]
},
nsis: {
oneClick: false,
allowToChangeInstallationDirectory: true
},
productName: 'ZY Player',
publish: [{
'provider': 'github',