parent
c3bdde6495
commit
6730b5f3c0
|
@ -6,7 +6,7 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
||||||
<link href="lib/css/reset-basic.css" rel="stylesheet">
|
<link href="lib/css/reset-basic.css" rel="stylesheet">
|
||||||
<link href="/css/desktop-lrc.css" rel="stylesheet">
|
<link href="/css/desktop-lrc.css" rel="stylesheet">
|
||||||
<script>window.LIBS_BASE_URL = location.origin + '/lib';window.__ENV_LANG__ = 'zh'</script>
|
<script>window.LIBS_BASE_URL = location.origin + '/lib';</script>
|
||||||
<script type="module" src="js/desktop-lrc.js"></script>
|
<script type="module" src="js/desktop-lrc.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body class="do-fn-noselect" anot="lrc">
|
<body class="do-fn-noselect" anot="lrc">
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<link href="lib/css/elem-ui.css" rel="stylesheet">
|
<link href="lib/css/elem-ui.css" rel="stylesheet">
|
||||||
<link href="css/app.css" rel="stylesheet">
|
<link href="css/app.css" rel="stylesheet">
|
||||||
<link href="css/modules.css" rel="stylesheet">
|
<link href="css/modules.css" rel="stylesheet">
|
||||||
<script>window.LIBS_BASE_URL = location.origin + '/lib';window.__ENV_LANG__ = 'zh'</script>
|
<script>window.LIBS_BASE_URL = location.origin + '/lib';</script>
|
||||||
<script type="module" src="js/app.js"></script>
|
<script type="module" src="js/app.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body class="do-fn-noselect" anot="app" :css="{'background-image': coverBG}">
|
<body class="do-fn-noselect" anot="app" :css="{'background-image': coverBG}">
|
||||||
|
|
|
@ -15,6 +15,7 @@ import Api from '/js/api.js'
|
||||||
import Artist from '/js/modules/artist.js'
|
import Artist from '/js/modules/artist.js'
|
||||||
import Local from '/js/modules/local.js'
|
import Local from '/js/modules/local.js'
|
||||||
import Profile from '/js/modules/profile.js'
|
import Profile from '/js/modules/profile.js'
|
||||||
|
import Search from '/js/modules/search.js'
|
||||||
|
|
||||||
import KTV from '/js/modules/ktv.js'
|
import KTV from '/js/modules/ktv.js'
|
||||||
|
|
||||||
|
@ -80,10 +81,9 @@ const LRC_WIN = new remote.BrowserWindow({
|
||||||
hasShadow: false,
|
hasShadow: false,
|
||||||
thickFrame: false,
|
thickFrame: false,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
|
// focusable: false,
|
||||||
show: false
|
show: false
|
||||||
})
|
})
|
||||||
// LRC_WIN.setIgnoreMouseEvents(true)
|
|
||||||
window.LRC_WIN = LRC_WIN
|
|
||||||
|
|
||||||
LRC_WIN.loadURL('app://sonist/desktop-lrc.html')
|
LRC_WIN.loadURL('app://sonist/desktop-lrc.html')
|
||||||
|
|
||||||
|
@ -237,6 +237,9 @@ Anot({
|
||||||
case 'profile':
|
case 'profile':
|
||||||
Profile.__init__()
|
Profile.__init__()
|
||||||
break
|
break
|
||||||
|
case 'search':
|
||||||
|
Search.__init__()
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,20 +14,10 @@ export default Anot({
|
||||||
$id: 'search',
|
$id: 'search',
|
||||||
state: {
|
state: {
|
||||||
filter: 'hot',
|
filter: 'hot',
|
||||||
list: [], //歌手列表
|
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: [], //单曲列表
|
methods: {
|
||||||
albumList: [] //专辑列表
|
__init__() {},
|
||||||
},
|
play() {}
|
||||||
methods: {}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="zh-CN">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
|
||||||
<link href="lib/css/reset-basic.css" rel="stylesheet">
|
|
||||||
<link href="/css/desktop-lrc.css" rel="stylesheet">
|
|
||||||
<script>window.LIBS_BASE_URL = location.origin + '/lib';window.__ENV_LANG__ = 'zh'</script>
|
|
||||||
<script type="module" src="js/desktop-lrc.js"></script>
|
|
||||||
</head>
|
|
||||||
<body class="do-fn-noselect" anot="lrc">
|
|
||||||
<div class="lrc-box">
|
|
||||||
<section class="left">
|
|
||||||
<span class="shadow" :text="lrc.l.txt"></span>
|
|
||||||
</section>
|
|
||||||
<section class="right">
|
|
||||||
<span class="shadow" :text="lrc.r.txt"></span>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
<div class="lrc-box">
|
|
||||||
<section class="left">
|
|
||||||
<span :text="lrc.l.txt" :css="{background: lrc.l.bg}"></span>
|
|
||||||
</section>
|
|
||||||
<section class="right">
|
|
||||||
<span :text="lrc.r.txt" :css="{background: lrc.r.bg}"></span>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="touch-bar do-fn-drag">
|
|
||||||
<a class="do-icon-lock lock do-fn-nodrag" :class="{actived: isLock}" :click="lock"></a>
|
|
||||||
<a class="do-icon-close quit do-fn-nodrag" :click="quit"></a>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
24
src/main.js
24
src/main.js
|
@ -4,7 +4,6 @@ const {
|
||||||
protocol,
|
protocol,
|
||||||
Tray,
|
Tray,
|
||||||
Menu,
|
Menu,
|
||||||
MenuItem,
|
|
||||||
session
|
session
|
||||||
} = require('electron')
|
} = require('electron')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
@ -30,8 +29,7 @@ let tray = null
|
||||||
|
|
||||||
const TRAYMENU_TMPL = [
|
const TRAYMENU_TMPL = [
|
||||||
{
|
{
|
||||||
label: '显示Sonist',
|
label: '显示主窗口',
|
||||||
type: 'normal',
|
|
||||||
click: () => {
|
click: () => {
|
||||||
win.show()
|
win.show()
|
||||||
}
|
}
|
||||||
|
@ -40,8 +38,7 @@ const TRAYMENU_TMPL = [
|
||||||
type: 'separator'
|
type: 'separator'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '退出应用',
|
label: '退出',
|
||||||
type: 'normal',
|
|
||||||
role: 'quit'
|
role: 'quit'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -57,7 +54,7 @@ const MENUBAR_TMPL = [
|
||||||
]
|
]
|
||||||
|
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
MENU_TMPL.unshift({
|
MENUBAR_TMPL.unshift({
|
||||||
label: 'Sonist',
|
label: 'Sonist',
|
||||||
submenu: [{ role: 'about' }, { type: 'separator' }, { role: 'quit' }]
|
submenu: [{ role: 'about' }, { type: 'separator' }, { role: 'quit' }]
|
||||||
})
|
})
|
||||||
|
@ -89,7 +86,9 @@ function createWindow() {
|
||||||
// 然后加载应用的 index.html。
|
// 然后加载应用的 index.html。
|
||||||
win.loadURL('app://sonist/index.html')
|
win.loadURL('app://sonist/index.html')
|
||||||
}
|
}
|
||||||
|
app.commandLine.appendSwitch('--lang', 'zh-CN')
|
||||||
app.commandLine.appendSwitch('--autoplay-policy', 'no-user-gesture-required')
|
app.commandLine.appendSwitch('--autoplay-policy', 'no-user-gesture-required')
|
||||||
|
|
||||||
app.setPath('appData', path.resolve(HOME, '.sonist/'))
|
app.setPath('appData', path.resolve(HOME, '.sonist/'))
|
||||||
protocol.registerStandardSchemes(['app'], { secure: true })
|
protocol.registerStandardSchemes(['app'], { secure: true })
|
||||||
|
|
||||||
|
@ -102,7 +101,7 @@ if (!fs.exists(appPath)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建窗口
|
// 创建窗口
|
||||||
app.on('ready', () => {
|
app.once('ready', () => {
|
||||||
protocol.registerBufferProtocol('app', (req, cb) => {
|
protocol.registerBufferProtocol('app', (req, cb) => {
|
||||||
let file = req.url.replace(/^app:\/\/sonist\//, '')
|
let file = req.url.replace(/^app:\/\/sonist\//, '')
|
||||||
let ext = path.extname(req.url).slice(1)
|
let ext = path.extname(req.url).slice(1)
|
||||||
|
@ -116,15 +115,18 @@ app.on('ready', () => {
|
||||||
tray.on('click', _ => {
|
tray.on('click', _ => {
|
||||||
win.show()
|
win.show()
|
||||||
})
|
})
|
||||||
|
tray.on('right-click', _ => {
|
||||||
|
tray.popUpContextMenu(traymenuList)
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
tray.setContextMenu(traymenuList)
|
tray.setContextMenu(traymenuList)
|
||||||
}
|
}
|
||||||
Menu.setApplicationMenu(menubarList)
|
Menu.setApplicationMenu(menubarList)
|
||||||
|
|
||||||
// const ses = session.defaultSession
|
session.defaultSession.setUserAgent(
|
||||||
// ses.setUserAgent('Hello wolrd')
|
'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()
|
createWindow()
|
||||||
// win.tray = tray
|
// win.openDevTools()
|
||||||
win.webContents.openDevTools()
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<section class="block">
|
<section class="block">
|
||||||
<span class="label">关于Sonist</span>
|
<span class="label">关于Sonist</span>
|
||||||
<div class="desc">
|
<div class="desc">
|
||||||
<p>当前版本: 0.0.1</p>
|
<p>当前版本: 0.9.0-alpha1</p>
|
||||||
<p>Sonist是一个本地音乐播放器, 同时支持酷狗的API来获取最新的歌曲信息,如排行榜, 最近单曲等(不提供下载服务, 仅为资讯展示, 如需要下载请到酷狗官网购买下载)。</p>
|
<p>Sonist是一个本地音乐播放器, 同时支持酷狗的API来获取最新的歌曲信息,如排行榜, 最近单曲等(不提供下载服务, 仅为资讯展示, 如需要下载请到酷狗官网购买下载)。</p>
|
||||||
<p>本播放器所使用的歌词/封面信息均来源于网络搜索, 不保证内容的准确性和时效性。</p>
|
<p>本播放器所使用的歌词/封面信息均来源于网络搜索, 不保证内容的准确性和时效性。</p>
|
||||||
<p>免责声明</p>
|
<p>免责声明</p>
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<h1>敬请期待...</h1>
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="do-mod-search">
|
<div class="do-mod-search" anot="search">
|
||||||
<div class="tabbar">
|
<div class="tabbar">
|
||||||
<span class="item active">我的音乐</span>
|
<span class="item active">我的音乐</span>
|
||||||
<span class="item">汪苏泷 <i class="do-icon-close"></i></span>
|
<span class="item">汪苏泷 <i class="do-icon-close"></i></span>
|
||||||
|
@ -17,7 +17,6 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr
|
<tr
|
||||||
:class="{active: it.id === curr.id}"
|
|
||||||
:for="it in list"
|
:for="it in list"
|
||||||
:dblclick="play(it, $index)">
|
:dblclick="play(it, $index)">
|
||||||
<td><i class="s-icon-music"></i></td>
|
<td><i class="s-icon-music"></i></td>
|
||||||
|
|
Reference in New Issue