Skip to content

Commit 6979d14

Browse files
committed
v0.8.2 窗口置顶,窗口透明,启动唯一应用
1 parent be6b4b0 commit 6979d14

File tree

9 files changed

+155
-74
lines changed

9 files changed

+155
-74
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
<p>
1313

1414
# ZY Player
15-
1615
资源播放器, 提供影视资源的浏览,搜索,播放,收藏,查看详情等功能.
1716

17+
### 下载:
18+
[下载地址](https://github.com/Hunlongyu/ZY-Player/releases)
19+
1820
### 截图:
1921
主界面 ⬇
2022
![film.png](https://i.loli.net/2020/01/19/U1EPzoJHhTDnuxA.png)
@@ -31,9 +33,8 @@
3133
收藏 ⬇
3234
![star.png](https://i.loli.net/2020/01/19/Q2fkWUvaXKZJcS4.png)
3335

34-
### 下载:
35-
36-
[下载地址](https://github.com/Hunlongyu/ZY-Player/releases)
36+
### 开发计划:
37+
[第二期开发计划](https://github.com/Hunlongyu/ZY-Player/projects/2)
3738

3839
### 未完成:
3940
1. 更换图标: 求大神设计一个 zy 的logo, 256x256 像素,风格请参考:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zy",
3-
"version": "0.8.1",
3+
"version": "0.8.2",
44
"author": "Hunlongyu",
55
"description": "ZY Player 资源播放器",
66
"private": true,

src/App.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
<el-container>
1111
<el-aside class="Aside" width="70px">
1212
<el-row class="top">
13-
<i :class="Main === 'Film' ? 'el-icon-film active' : 'el-icon-film'" @click="asideMenuClick('Film')"></i>
14-
<i :class="Main === 'Search' ? 'el-icon-search active' : 'el-icon-search'" @click="asideMenuClick('Search')"></i>
15-
<i :class="Main === 'Player' ? 'el-icon-video-play active' : 'el-icon-video-play'" @click="asideMenuClick('Player')"></i>
16-
<i :class="Main === 'Star' ? 'el-icon-star-off active' : 'el-icon-star-off'" @click="asideMenuClick('Star')"></i>
13+
<i title="浏览" :class="Main === 'Film' ? 'el-icon-film active' : 'el-icon-film'" @click="asideMenuClick('Film')"></i>
14+
<i title="搜索" :class="Main === 'Search' ? 'el-icon-search active' : 'el-icon-search'" @click="asideMenuClick('Search')"></i>
15+
<i title="播放" :class="Main === 'Player' ? 'el-icon-video-play active' : 'el-icon-video-play'" @click="asideMenuClick('Player')"></i>
16+
<i title="收藏" :class="Main === 'Star' ? 'el-icon-star-off active' : 'el-icon-star-off'" @click="asideMenuClick('Star')"></i>
1717
</el-row>
1818
<el-row class="bottom">
19-
<i :class="Main === 'Setting' ? 'el-icon-setting active' : 'el-icon-setting'" @click="asideMenuClick('Setting')"></i>
19+
<i title="设置" :class="Main === 'Setting' ? 'el-icon-setting active' : 'el-icon-setting'" @click="asideMenuClick('Setting')"></i>
2020
</el-row>
2121
</el-aside>
2222
<el-main class="Main">
@@ -101,6 +101,7 @@ html,body{
101101
}
102102
#app{
103103
height: 100%;
104+
user-select: none;
104105
.Header{
105106
display: flex;
106107
justify-content: flex-end;

src/assets/theme/light.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
}
3434
}
3535
.Main{
36-
.film, .search, .star, .player{
36+
.film, .search, .star, .player, .setting{
3737
.table-box{
3838
&::-webkit-scrollbar-track {
3939
box-shadow: inset 0 0 6px var(--l-bdc);

src/background.ts

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protocol.registerSchemesAsPrivileged([{ scheme: 'app', privileges: { secure: tru
1919
function createWindow () {
2020
// Create the browser window.
2121
win = new BrowserWindow({
22-
width: 1080,
22+
width: 1680,
2323
height: 720,
2424
frame: false,
2525
webPreferences: {
@@ -83,25 +83,59 @@ ipcMain.on('close', e => {
8383
}
8484
})
8585

86+
ipcMain.on('opacity', (e, arg) => {
87+
if (win) {
88+
win.setOpacity(arg)
89+
}
90+
})
91+
92+
ipcMain.on('top', () => {
93+
if (win) {
94+
if (win.isAlwaysOnTop()) {
95+
win.setAlwaysOnTop(false)
96+
} else {
97+
win.setAlwaysOnTop(true)
98+
}
99+
}
100+
})
101+
102+
const gotTheLock = app.requestSingleInstanceLock()
103+
if (!gotTheLock) {
104+
app.quit()
105+
} else {
106+
app.on('second-instance', (event, commandLine, workingDirectory) => {
107+
// 当运行第二个实例时,将会聚焦到win这个窗口
108+
if (win) {
109+
if (win.isMinimized()) win.restore()
110+
win.focus()
111+
}
112+
})
113+
114+
// 创建 win, 加载应用的其余部分, etc...
115+
app.on('ready', () => {
116+
createWindow()
117+
})
118+
}
119+
86120
// This method will be called when Electron has finished
87121
// initialization and is ready to create browser windows.
88122
// Some APIs can only be used after this event occurs.
89-
app.on('ready', async () => {
90-
if (isDevelopment && !process.env.IS_TEST) {
91-
// Install Vue Devtools
92-
// Devtools extensions are broken in Electron 6.0.0 and greater
93-
// See https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/378 for more info
94-
// Electron will not launch with Devtools extensions installed on Windows 10 with dark mode
95-
// If you are not using Windows 10 dark mode, you may uncomment these lines
96-
// In addition, if the linked issue is closed, you can upgrade electron and uncomment these lines
97-
// try {
98-
// await installVueDevtools()
99-
// } catch (e) {
100-
// console.error('Vue Devtools failed to install:', e.toString())
101-
// }
102-
}
103-
createWindow()
104-
})
123+
// app.on('ready', async () => {
124+
// if (isDevelopment && !process.env.IS_TEST) {
125+
// // Install Vue Devtools
126+
// // Devtools extensions are broken in Electron 6.0.0 and greater
127+
// // See https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/378 for more info
128+
// // Electron will not launch with Devtools extensions installed on Windows 10 with dark mode
129+
// // If you are not using Windows 10 dark mode, you may uncomment these lines
130+
// // In addition, if the linked issue is closed, you can upgrade electron and uncomment these lines
131+
// try {
132+
// await installVueDevtools()
133+
// } catch (e) {
134+
// console.error('Vue Devtools failed to install:', e.toString())
135+
// }
136+
// }
137+
// createWindow()
138+
// })
105139

106140
// Exit cleanly on request from parent process in development mode.
107141
if (isDevelopment) {

src/page/player.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
<span>{{ num }}</span>
99
</span>
1010
<span>
11-
<el-button size="mini" @click="openDetail" icon="el-icon-document" circle></el-button>
12-
<el-button size="mini" v-show="!star" @click="starEvent" icon="el-icon-star-off" circle></el-button>
13-
<el-button size="mini" v-show="star" @click="starEvent" icon="el-icon-star-on" circle></el-button>
11+
<el-button size="mini" @click="topEvent('top')" icon="el-icon-position" title="置顶" circle></el-button>
12+
<el-button size="mini" @click="openDetail" icon="el-icon-document" title="查看详情" circle></el-button>
13+
<el-button size="mini" v-show="!star" @click="starEvent" icon="el-icon-star-off" title="添加收藏" circle></el-button>
14+
<el-button size="mini" v-show="star" @click="starEvent" icon="el-icon-star-on" title="取消收藏" circle></el-button>
1415
</span>
1516
</el-row>
1617
</el-row>
@@ -42,6 +43,7 @@ import 'xgplayer'
4243
// @ts-ignore
4344
import Hls from 'xgplayer-hls.js'
4445
import video from '@/plugins/dexie/video'
46+
const { ipcRenderer: ipc } = require('electron')
4547
export default Vue.extend({
4648
data () {
4749
return {
@@ -99,6 +101,9 @@ export default Vue.extend({
99101
},
100102
methods: {
101103
...mapMutations(['SET_DETAIL', 'SET_VIDEO', 'SET_MAIN']),
104+
topEvent (e:string) {
105+
ipc.send(e)
106+
},
102107
goView (e: string) {
103108
this.Main = e
104109
},

src/page/setting.vue

Lines changed: 80 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,58 @@
11
<template>
22
<el-row class="setting">
3-
<el-row class="item site">
4-
<el-row class="title"><i class="el-icon-set-up"></i><span>默认资源</span></el-row>
5-
<el-row class="info">
6-
<el-select v-model="dbSite" placeholder="请选择" size="small" @change="selectSite">
7-
<el-option
8-
v-for="(i, j) in sites"
9-
:key="i.id"
10-
:label="i.name"
11-
:value="j">
12-
</el-option>
13-
</el-select>
3+
<el-row class="setting-box table-box">
4+
<el-row class="item site">
5+
<el-row class="title"><i class="el-icon-set-up"></i><span>默认资源</span></el-row>
6+
<el-row class="info">
7+
<el-select v-model="dbSite" placeholder="请选择" size="small" @change="selectSite">
8+
<el-option
9+
v-for="(i, j) in sites"
10+
:key="i.id"
11+
:label="i.name"
12+
:value="j">
13+
</el-option>
14+
</el-select>
15+
</el-row>
1416
</el-row>
15-
</el-row>
16-
<el-row class="item theme">
17-
<el-row class="title"><i class="el-icon-picture-outline-round"></i><span>主题</span></el-row>
18-
<el-row class="card-box">
19-
<el-card shadow="hover" class="card">
20-
<img src="@/assets/image/light.png" class="image" @click="selectTheme('light')">
21-
<span size="mini">Light</span>
22-
</el-card>
23-
<el-card shadow="hover" class="card">
24-
<img src="@/assets/image/dark.png" class="image" @click="selectTheme('dark')">
25-
<span size="mini">Dark</span>
26-
</el-card>
17+
<el-row class="item opacity">
18+
<el-row class="title"><i class="el-icon-picture-outline-round"></i><span>透明度</span></el-row>
19+
<el-row class="info">
20+
<el-slider v-model="opacity" :min="50" :max="100" @input="setOpacity"></el-slider>
21+
</el-row>
2722
</el-row>
28-
</el-row>
29-
<el-row class="item update about">
30-
<el-row class="title"><i class="el-icon-refresh"></i><span>更新</span></el-row>
31-
<el-row class="info">
32-
<ul>
33-
<li>当前版本: {{oldVersion}}</li>
34-
<li>最新版本: {{newVersion}}</li>
35-
</ul>
23+
<el-row class="item theme">
24+
<el-row class="title"><i class="el-icon-picture-outline-round"></i><span>主题</span></el-row>
25+
<el-row class="card-box">
26+
<el-card shadow="hover" class="card">
27+
<img src="@/assets/image/light.png" class="image" @click="selectTheme('light')">
28+
<span size="mini">Light</span>
29+
</el-card>
30+
<el-card shadow="hover" class="card">
31+
<img src="@/assets/image/dark.png" class="image" @click="selectTheme('dark')">
32+
<span size="mini">Dark</span>
33+
</el-card>
34+
</el-row>
3635
</el-row>
37-
<el-row class="btns">
38-
<el-button v-show="download" size="small" @click="linkOpen('https://github.com/Hunlongyu/ZY-Player/releases/latest')">下载更新</el-button>
36+
<el-row class="item update">
37+
<el-row class="title"><i class="el-icon-refresh"></i><span>更新</span></el-row>
38+
<el-row class="info">
39+
<ul>
40+
<li>当前版本: {{oldVersion}}</li>
41+
<li>最新版本: {{newVersion}}</li>
42+
</ul>
43+
</el-row>
44+
<el-row class="btns">
45+
<el-button v-show="download" size="small" @click="linkOpen('https://github.com/Hunlongyu/ZY-Player/releases/latest')">下载更新</el-button>
46+
</el-row>
3947
</el-row>
40-
</el-row>
41-
<el-row class="item about">
42-
<el-row class="title"><i class="el-icon-view"></i><span>关于</span></el-row>
43-
<el-row class="info">
44-
<ul>
45-
<li><el-link :underline="false" @click="linkOpen('http://zy.hly120506.top')">官网: ZY Player</el-link></li>
46-
<li><el-link :underline="false" @click="linkOpen('https://github.com/Hunlongyu/ZY-Player/issues')">反馈: Issues</el-link></li>
47-
</ul>
48+
<el-row class="item about">
49+
<el-row class="title"><i class="el-icon-view"></i><span>关于</span></el-row>
50+
<el-row class="info">
51+
<ul>
52+
<li><el-link :underline="false" @click="linkOpen('http://zy.hly120506.top/')">官网: ZY Player</el-link></li>
53+
<li><el-link :underline="false" @click="linkOpen('https://github.com/Hunlongyu/ZY-Player/issues')">反馈: Issues</el-link></li>
54+
</ul>
55+
</el-row>
4856
</el-row>
4957
</el-row>
5058
</el-row>
@@ -57,12 +65,14 @@ import { shell } from 'electron'
5765
import site from '@/plugins/dexie/site'
5866
import theme from '@/plugins/dexie/theme'
5967
import fly from 'flyio'
68+
const { ipcRenderer: ipc } = require('electron')
6069
export default Vue.extend({
6170
name: 'setting',
6271
data () {
6372
return {
6473
sites: sites,
6574
dbSite: 0,
75+
opacity: 100,
6676
oldVersion: 'v0.8.1',
6777
newVersion: '',
6878
download: false
@@ -135,6 +145,9 @@ export default Vue.extend({
135145
this.download = false
136146
}
137147
})
148+
},
149+
setOpacity () {
150+
ipc.send('opacity', this.opacity / 100)
138151
}
139152
},
140153
created () {
@@ -145,6 +158,17 @@ export default Vue.extend({
145158
</script>
146159
<style lang="scss" scoped>
147160
.setting{
161+
height: 100%;
162+
position: relative;
163+
.setting-box{
164+
position: absolute;
165+
width: 100%;
166+
height: 100%;
167+
overflow: auto;
168+
&::-webkit-scrollbar{
169+
width: 6px;
170+
}
171+
}
148172
.item{
149173
margin-bottom: 30px;
150174
.title{
@@ -167,6 +191,21 @@ export default Vue.extend({
167191
}
168192
}
169193
}
194+
.update{
195+
ul{
196+
list-style: none;
197+
li{
198+
height: 30px;
199+
font-size: 14px;
200+
}
201+
}
202+
}
203+
.opacity{
204+
.info{
205+
width: 196px;
206+
margin-left: 12px;
207+
}
208+
}
170209
.theme{
171210
.card-box{
172211
display: flex;

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
6+
Notification, Message, Slider
77
} from 'element-ui'
88

99
Vue.use(Container)
@@ -25,6 +25,7 @@ Vue.use(Input)
2525
Vue.use(Card)
2626
Vue.use(Link)
2727
Vue.use(Loading)
28+
Vue.use(Slider)
2829

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

src/store/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Vue.use(Vuex)
55

66
export default new Vuex.Store({
77
state: {
8-
Main: 'Search',
8+
Main: 'Setting',
99
site: 0,
1010
theme: 'light',
1111
detail: {

0 commit comments

Comments
 (0)