From 6730b5f3c078c6b14c27417bfe5ddd0f129f2026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Sat, 19 Jan 2019 23:29:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E6=9C=AA=E5=BC=80=E6=94=BE?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/desktop-lrc.html | 2 +- src/index.html | 2 +- src/js/app.js | 7 +++++-- src/js/modules/rank.js | 0 src/js/modules/search.js | 20 +++++--------------- src/linux-stat.html | 35 ----------------------------------- src/main.js | 24 +++++++++++++----------- src/views/profile.htm | 2 +- src/views/rank.htm | 1 + src/views/search.htm | 3 +-- 10 files changed, 28 insertions(+), 68 deletions(-) create mode 100644 src/js/modules/rank.js delete mode 100644 src/linux-stat.html create mode 100644 src/views/rank.htm diff --git a/src/desktop-lrc.html b/src/desktop-lrc.html index 4223f42..855012c 100644 --- a/src/desktop-lrc.html +++ b/src/desktop-lrc.html @@ -6,7 +6,7 @@ - + diff --git a/src/index.html b/src/index.html index a26f7a0..f603681 100644 --- a/src/index.html +++ b/src/index.html @@ -8,7 +8,7 @@ - + diff --git a/src/js/app.js b/src/js/app.js index cf37c55..f05af11 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -15,6 +15,7 @@ import Api from '/js/api.js' import Artist from '/js/modules/artist.js' import Local from '/js/modules/local.js' import Profile from '/js/modules/profile.js' +import Search from '/js/modules/search.js' import KTV from '/js/modules/ktv.js' @@ -80,10 +81,9 @@ const LRC_WIN = new remote.BrowserWindow({ hasShadow: false, thickFrame: false, transparent: true, + // focusable: false, show: false }) -// LRC_WIN.setIgnoreMouseEvents(true) -window.LRC_WIN = LRC_WIN LRC_WIN.loadURL('app://sonist/desktop-lrc.html') @@ -237,6 +237,9 @@ Anot({ case 'profile': Profile.__init__() break + case 'search': + Search.__init__() + break default: break } diff --git a/src/js/modules/rank.js b/src/js/modules/rank.js new file mode 100644 index 0000000..e69de29 diff --git a/src/js/modules/search.js b/src/js/modules/search.js index 55f3c93..b8f911e 100644 --- a/src/js/modules/search.js +++ b/src/js/modules/search.js @@ -14,20 +14,10 @@ export default Anot({ $id: 'search', state: { filter: 'hot', - list: [], //歌手列表 - display: 'artist', // list | artist | album - artist: { - avatar: - 'http://singerimg.kugou.com/uploadpic/softhead/240/20181023/20181023141706176.jpg', - id: 3060, - name: '薛之谦', - info: '', - songCount: 0, - mvCount: 0, - albumCount: 0 - }, - songList: [], //单曲列表 - albumList: [] //专辑列表 + list: [] //歌手列表 }, - methods: {} + methods: { + __init__() {}, + play() {} + } }) diff --git a/src/linux-stat.html b/src/linux-stat.html deleted file mode 100644 index 4223f42..0000000 --- a/src/linux-stat.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - -
-
- -
-
- -
-
-
-
- -
-
- -
-
- -
- - -
- - \ No newline at end of file diff --git a/src/main.js b/src/main.js index 3e7778d..1e1f522 100644 --- a/src/main.js +++ b/src/main.js @@ -4,7 +4,6 @@ const { protocol, Tray, Menu, - MenuItem, session } = require('electron') const path = require('path') @@ -30,8 +29,7 @@ let tray = null const TRAYMENU_TMPL = [ { - label: '显示Sonist', - type: 'normal', + label: '显示主窗口', click: () => { win.show() } @@ -40,8 +38,7 @@ const TRAYMENU_TMPL = [ type: 'separator' }, { - label: '退出应用', - type: 'normal', + label: '退出', role: 'quit' } ] @@ -57,7 +54,7 @@ const MENUBAR_TMPL = [ ] if (process.platform === 'darwin') { - MENU_TMPL.unshift({ + MENUBAR_TMPL.unshift({ label: 'Sonist', submenu: [{ role: 'about' }, { type: 'separator' }, { role: 'quit' }] }) @@ -89,7 +86,9 @@ function createWindow() { // 然后加载应用的 index.html。 win.loadURL('app://sonist/index.html') } +app.commandLine.appendSwitch('--lang', 'zh-CN') app.commandLine.appendSwitch('--autoplay-policy', 'no-user-gesture-required') + app.setPath('appData', path.resolve(HOME, '.sonist/')) protocol.registerStandardSchemes(['app'], { secure: true }) @@ -102,7 +101,7 @@ if (!fs.exists(appPath)) { } // 创建窗口 -app.on('ready', () => { +app.once('ready', () => { protocol.registerBufferProtocol('app', (req, cb) => { let file = req.url.replace(/^app:\/\/sonist\//, '') let ext = path.extname(req.url).slice(1) @@ -116,15 +115,18 @@ app.on('ready', () => { tray.on('click', _ => { win.show() }) + tray.on('right-click', _ => { + tray.popUpContextMenu(traymenuList) + }) } else { tray.setContextMenu(traymenuList) } Menu.setApplicationMenu(menubarList) - // const ses = session.defaultSession - // ses.setUserAgent('Hello wolrd') + session.defaultSession.setUserAgent( + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36' + ) createWindow() - // win.tray = tray - win.webContents.openDevTools() + // win.openDevTools() }) diff --git a/src/views/profile.htm b/src/views/profile.htm index 0991245..7edafa3 100644 --- a/src/views/profile.htm +++ b/src/views/profile.htm @@ -38,7 +38,7 @@
关于Sonist
-

当前版本: 0.0.1

+

当前版本: 0.9.0-alpha1

Sonist是一个本地音乐播放器, 同时支持酷狗的API来获取最新的歌曲信息,如排行榜, 最近单曲等(不提供下载服务, 仅为资讯展示, 如需要下载请到酷狗官网购买下载)。

本播放器所使用的歌词/封面信息均来源于网络搜索, 不保证内容的准确性和时效性。

免责声明

diff --git a/src/views/rank.htm b/src/views/rank.htm new file mode 100644 index 0000000..ec498f3 --- /dev/null +++ b/src/views/rank.htm @@ -0,0 +1 @@ +

敬请期待...

\ No newline at end of file diff --git a/src/views/search.htm b/src/views/search.htm index 229de81..d78ef8d 100644 --- a/src/views/search.htm +++ b/src/views/search.htm @@ -1,4 +1,4 @@ -