diff --git a/README.md b/README.md index bce60092..d574e2bf 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,13 @@ npm run pack

lx-music UI

+### 启动参数 + +目前软件已支持的启动参数如下: + +- `-search` 启动软件时自动在搜索框搜索指定的内容,例如:`-search="突然的自我 - 伍佰"` +- `-nt` 以非透明模式启动,对于未开启AERO效果的win7系统可加此参数启动以确保界面正常显示 + ### 常见问题 常见问题已移至: diff --git a/publish/changeLog.md b/publish/changeLog.md index a8ef389e..2480ed9e 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -2,7 +2,9 @@ - 新增多语言设置,目前软件内置了简体中文、繁体中文、英语三种语言,欢迎提交PR翻译更多语言! - 新增无法打开外部歌单FAQ +- 新增启动参数`search`,使用例子:`.\lx-music-desktop.exe -search="突然的自我 - 伍佰"` ### 优化 - 优化月里嫦娥皮肤侧栏鼠标悬浮颜色 +- 优化播放进度条的动画效果 diff --git a/src/main/events/winEvent.js b/src/main/events/winEvent.js new file mode 100644 index 00000000..5be73705 --- /dev/null +++ b/src/main/events/winEvent.js @@ -0,0 +1,13 @@ +module.exports = mainWindow => { + mainWindow.on('close', () => { + mainWindow.setProgressBar(-1) + }) + + mainWindow.on('closed', () => { + mainWindow = global.mainWindow = null + }) + + mainWindow.on('restore', () => { + mainWindow.webContents.send('restore') + }) +} diff --git a/src/main/index.js b/src/main/index.js index 055c60db..59c46d88 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -26,6 +26,7 @@ global.envParams = parseEnv() require('../common/error') require('./events') +const winEvent = require('./events/winEvent') const autoUpdate = require('./utils/autoUpdate') const { isLinux, isMac } = require('../common/utils') @@ -67,13 +68,7 @@ function createWindow() { mainWindow.loadURL(winURL) - mainWindow.on('close', () => { - mainWindow.setProgressBar(-1) - }) - mainWindow.on('closed', () => { - mainWindow = global.mainWindow = null - }) - + winEvent(mainWindow) // mainWindow.webContents.openDevTools() if (!isDev) { diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 35c52dfb..4f461d0a 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -112,18 +112,8 @@ export default { ...mapMutations('download', ['updateDownloadList']), ...mapMutations(['setSetting']), init() { - rendererInvoke('getEnvParams').then(envParams => { - this.envParams = envParams - this.isNt = isLinux || this.envParams.nt - if (this.isNt) { - document.body.classList.remove('transparent') - document.body.classList.add('noTransparent') - } - if (this.isProd && !this.isNt) { - document.body.addEventListener('mouseenter', this.dieableIgnoreMouseEvents) - document.body.addEventListener('mouseleave', this.enableIgnoreMouseEvents) - } - }) + rendererInvoke('getEnvParams').then(this.handleEnvParamsInit) + document.body.addEventListener('click', this.handleBodyClick, true) rendererOn('update-available', (e, info) => { // this.showUpdateModal(true) @@ -259,6 +249,27 @@ export default { event.preventDefault() if (/^https?:\/\//.test(event.target.href)) openUrl(event.target.href) }, + handleEnvParamsInit(envParams) { + this.envParams = envParams + this.isNt = isLinux || this.envParams.nt + if (this.isNt) { + document.body.classList.remove('transparent') + document.body.classList.add('noTransparent') + } + if (this.isProd && !this.isNt) { + document.body.addEventListener('mouseenter', this.dieableIgnoreMouseEvents) + document.body.addEventListener('mouseleave', this.enableIgnoreMouseEvents) + } + + if (this.envParams.search != null) { + this.$router.push({ + path: 'search', + query: { + text: this.envParams.search, + }, + }) + } + }, }, beforeDestroy() { this.clearUpdateTimeout() diff --git a/src/renderer/components/core/Player.vue b/src/renderer/components/core/Player.vue index 16cbfe96..e3967892 100644 --- a/src/renderer/components/core/Player.vue +++ b/src/renderer/components/core/Player.vue @@ -48,7 +48,7 @@ div(:class="$style.player")