From 6979d14f3500c76941e67fac6b8d7a00fca303ad Mon Sep 17 00:00:00 2001 From: Hunlongyu Date: Fri, 31 Jan 2020 01:35:55 +0800 Subject: [PATCH] =?UTF-8?q?v0.8.2=20=E7=AA=97=E5=8F=A3=E7=BD=AE=E9=A1=B6?= =?UTF-8?q?=EF=BC=8C=E7=AA=97=E5=8F=A3=E9=80=8F=E6=98=8E=EF=BC=8C=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E5=94=AF=E4=B8=80=E5=BA=94=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 +-- package.json | 2 +- src/App.vue | 11 ++-- src/assets/theme/light.scss | 2 +- src/background.ts | 68 +++++++++++++++----- src/page/player.vue | 11 +++- src/page/setting.vue | 121 ++++++++++++++++++++++++------------ src/plugins/element.ts | 3 +- src/store/index.ts | 2 +- 9 files changed, 155 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 0b2874e..7644efa 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,11 @@

# ZY Player - 资源播放器, 提供影视资源的浏览,搜索,播放,收藏,查看详情等功能. +### 下载: +[下载地址](https://github.com/Hunlongyu/ZY-Player/releases) + ### 截图: 主界面 ⬇ ![film.png](https://i.loli.net/2020/01/19/U1EPzoJHhTDnuxA.png) @@ -31,9 +33,8 @@ 收藏 ⬇ ![star.png](https://i.loli.net/2020/01/19/Q2fkWUvaXKZJcS4.png) -### 下载: - -[下载地址](https://github.com/Hunlongyu/ZY-Player/releases) +### 开发计划: +[第二期开发计划](https://github.com/Hunlongyu/ZY-Player/projects/2) ### 未完成: 1. 更换图标: 求大神设计一个 zy 的logo, 256x256 像素,风格请参考: diff --git a/package.json b/package.json index 6d51db1..871185e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zy", - "version": "0.8.1", + "version": "0.8.2", "author": "Hunlongyu", "description": "ZY Player 资源播放器", "private": true, diff --git a/src/App.vue b/src/App.vue index 86d8acf..02674f8 100644 --- a/src/App.vue +++ b/src/App.vue @@ -10,13 +10,13 @@ - - - - + + + + - + @@ -101,6 +101,7 @@ html,body{ } #app{ height: 100%; + user-select: none; .Header{ display: flex; justify-content: flex-end; diff --git a/src/assets/theme/light.scss b/src/assets/theme/light.scss index d52c08b..4beda6c 100644 --- a/src/assets/theme/light.scss +++ b/src/assets/theme/light.scss @@ -33,7 +33,7 @@ } } .Main{ - .film, .search, .star, .player{ + .film, .search, .star, .player, .setting{ .table-box{ &::-webkit-scrollbar-track { box-shadow: inset 0 0 6px var(--l-bdc); diff --git a/src/background.ts b/src/background.ts index f58f80d..35979f6 100644 --- a/src/background.ts +++ b/src/background.ts @@ -19,7 +19,7 @@ protocol.registerSchemesAsPrivileged([{ scheme: 'app', privileges: { secure: tru function createWindow () { // Create the browser window. win = new BrowserWindow({ - width: 1080, + width: 1680, height: 720, frame: false, webPreferences: { @@ -83,25 +83,59 @@ ipcMain.on('close', e => { } }) +ipcMain.on('opacity', (e, arg) => { + if (win) { + win.setOpacity(arg) + } +}) + +ipcMain.on('top', () => { + if (win) { + if (win.isAlwaysOnTop()) { + win.setAlwaysOnTop(false) + } else { + win.setAlwaysOnTop(true) + } + } +}) + +const gotTheLock = app.requestSingleInstanceLock() +if (!gotTheLock) { + app.quit() +} else { + app.on('second-instance', (event, commandLine, workingDirectory) => { + // 当运行第二个实例时,将会聚焦到win这个窗口 + if (win) { + if (win.isMinimized()) win.restore() + win.focus() + } + }) + + // 创建 win, 加载应用的其余部分, etc... + app.on('ready', () => { + createWindow() + }) +} + // This method will be called when Electron has finished // initialization and is ready to create browser windows. // Some APIs can only be used after this event occurs. -app.on('ready', async () => { - if (isDevelopment && !process.env.IS_TEST) { - // Install Vue Devtools - // Devtools extensions are broken in Electron 6.0.0 and greater - // See https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/378 for more info - // Electron will not launch with Devtools extensions installed on Windows 10 with dark mode - // If you are not using Windows 10 dark mode, you may uncomment these lines - // In addition, if the linked issue is closed, you can upgrade electron and uncomment these lines - // try { - // await installVueDevtools() - // } catch (e) { - // console.error('Vue Devtools failed to install:', e.toString()) - // } - } - createWindow() -}) +// app.on('ready', async () => { +// if (isDevelopment && !process.env.IS_TEST) { +// // Install Vue Devtools +// // Devtools extensions are broken in Electron 6.0.0 and greater +// // See https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/378 for more info +// // Electron will not launch with Devtools extensions installed on Windows 10 with dark mode +// // If you are not using Windows 10 dark mode, you may uncomment these lines +// // In addition, if the linked issue is closed, you can upgrade electron and uncomment these lines +// try { +// await installVueDevtools() +// } catch (e) { +// console.error('Vue Devtools failed to install:', e.toString()) +// } +// } +// createWindow() +// }) // Exit cleanly on request from parent process in development mode. if (isDevelopment) { diff --git a/src/page/player.vue b/src/page/player.vue index 0e32254..026a4d1 100644 --- a/src/page/player.vue +++ b/src/page/player.vue @@ -8,9 +8,10 @@ {{ num }} - - - + + + + @@ -42,6 +43,7 @@ import 'xgplayer' // @ts-ignore import Hls from 'xgplayer-hls.js' import video from '@/plugins/dexie/video' +const { ipcRenderer: ipc } = require('electron') export default Vue.extend({ data () { return { @@ -99,6 +101,9 @@ export default Vue.extend({ }, methods: { ...mapMutations(['SET_DETAIL', 'SET_VIDEO', 'SET_MAIN']), + topEvent (e:string) { + ipc.send(e) + }, goView (e: string) { this.Main = e }, diff --git a/src/page/setting.vue b/src/page/setting.vue index 3f573c3..a6b61c9 100644 --- a/src/page/setting.vue +++ b/src/page/setting.vue @@ -1,50 +1,58 @@