From f8e449b0179bb86041d376b005ce6a2f0294b5dd Mon Sep 17 00:00:00 2001 From: lyswhut Date: Sun, 19 Jan 2020 13:56:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=8D=E5=BC=BA=E5=88=B6wi?= =?UTF-8?q?n7=E5=BC=80=E5=90=AF=E9=80=8F=E6=98=8E=E6=95=88=E6=9E=9C?= =?UTF-8?q?=E5=8D=B3=E5=8F=AF=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FAQ.md | 4 +++- publish/changeLog.md | 1 + src/main/events/getEnvParams.js | 6 ++++++ src/main/events/index.js | 1 + src/main/index.js | 7 +++++-- src/main/utils/index.js | 17 +++++++++++++++++ src/renderer/App.vue | 31 +++++++++++++++++++++---------- 7 files changed, 54 insertions(+), 13 deletions(-) create mode 100644 src/main/events/getEnvParams.js diff --git a/FAQ.md b/FAQ.md index e4909531..e09de575 100644 --- a/FAQ.md +++ b/FAQ.md @@ -49,6 +49,8 @@ ## Windows 7 下界面异常 当 win7 没有开启**透明效果**时界面将会显示异常,开启方法请自行百度。
+从`0.14.0`版本起不再强制要求开启透明效果,若你实在不想开启(若非电脑配置太低,建议开启),可通过添加运行参数`-nt`来运行程序即可,例如:`.\lx-music-desktop.exe -nt`,添加方法可自行百度“给快捷方式加参数”。 + 对于一些完全无法正常显示界面的情况,请阅读下面的 **软件启动后,界面无法显示** ## 软件启动后,界面无法显示 @@ -85,7 +87,7 @@ ## 软件无法联网 -软件的排行榜、歌单、搜索列表无法加载: +软件的排行榜、歌单、搜索列表**都**无法加载: - 检查是否在设置界面开启了代理(当代理乱设置时软件将无法联网) - 检查软件是否被第三方软件/防火墙阻止联网 diff --git a/publish/changeLog.md b/publish/changeLog.md index e8c7b169..f637b98d 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -2,6 +2,7 @@ - 新增各大平台歌单热门标签显示(显示在歌单界面的第一个下拉标签菜单中) - 恢复QQ音乐源128k音质试听 +- 新增不强制win7开启透明效果即可使用,但要配置运行参数`-nt`,例如:`.\lx-music-desktop.exe -nt`,添加方法可自行百度“给快捷方式加参数” ### 优化 diff --git a/src/main/events/getEnvParams.js b/src/main/events/getEnvParams.js new file mode 100644 index 00000000..52f6f2f5 --- /dev/null +++ b/src/main/events/getEnvParams.js @@ -0,0 +1,6 @@ +const { mainHandle } = require('../../common/ipc') + +mainHandle('getEnvParams', async(event, options) => { + return global.envParams +}) + diff --git a/src/main/events/index.js b/src/main/events/index.js index c10c0f72..0ad3cfed 100644 --- a/src/main/events/index.js +++ b/src/main/events/index.js @@ -10,3 +10,4 @@ require('./showSaveDialog') require('./clearCache') require('./getCacheSize') require('./setIgnoreMouseEvent') +require('./getEnvParams') diff --git a/src/main/index.js b/src/main/index.js index 88cbfe03..811f1c2f 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -15,11 +15,14 @@ app.on('second-instance', (event, argv, cwd) => { } }) +const { getWindowSizeInfo, parseEnv } = require('./utils') + +global.envParams = parseEnv() + require('../common/error') require('./events') const autoUpdate = require('./utils/autoUpdate') const { isLinux, isMac } = require('../common/utils') -const { getWindowSizeInfo } = require('./utils') const isDev = process.env.NODE_ENV !== 'production' @@ -50,7 +53,7 @@ function createWindow() { useContentSize: true, width: windowSizeInfo.width, frame: false, - transparent: !isLinux, + transparent: !isLinux && !global.envParams.nt, enableRemoteModule: false, // icon: path.join(global.__static, isWin ? 'icons/256x256.ico' : 'icons/512x512.png'), resizable: false, diff --git a/src/main/utils/index.js b/src/main/utils/index.js index cc9f65b9..4f328a6a 100644 --- a/src/main/utils/index.js +++ b/src/main/utils/index.js @@ -6,3 +6,20 @@ exports.getWindowSizeInfo = () => { const { windowSizeId = 1 } = electronStore.get('setting') || {} return windowSizeList.find(i => i.id === windowSizeId) || windowSizeList[0] } + +exports.parseEnv = () => { + const params = {} + const rx = /^-\w+/ + for (let param of process.argv) { + if (!rx.test(param)) continue + param = param.substring(1) + let index = param.indexOf('=') + if (index < 0) { + params[param] = true + } else { + params[param.substring(0, index)] = param.substring(index + 1) + } + } + return params +} + diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 8f4afa36..ecd7dd21 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -1,5 +1,5 @@