新增不强制win7开启透明效果即可使用

pull/166/head
lyswhut 2020-01-19 13:56:54 +08:00
parent bb0b59080a
commit f8e449b017
7 changed files with 54 additions and 13 deletions

4
FAQ.md
View File

@ -49,6 +49,8 @@
## Windows 7 下界面异常
当 win7 没有开启**透明效果**时界面将会显示异常,开启方法请自行百度。<br>
从`0.14.0`版本起不再强制要求开启透明效果,若你实在不想开启(若非电脑配置太低,建议开启),可通过添加运行参数`-nt`来运行程序即可,例如:`.\lx-music-desktop.exe -nt`,添加方法可自行百度“给快捷方式加参数”。
对于一些完全无法正常显示界面的情况,请阅读下面的 **软件启动后,界面无法显示**
## 软件启动后,界面无法显示
@ -85,7 +87,7 @@
## 软件无法联网
软件的排行榜、歌单、搜索列表无法加载:
软件的排行榜、歌单、搜索列表**都**无法加载:
- 检查是否在设置界面开启了代理(当代理乱设置时软件将无法联网)
- 检查软件是否被第三方软件/防火墙阻止联网

View File

@ -2,6 +2,7 @@
- 新增各大平台歌单热门标签显示(显示在歌单界面的第一个下拉标签菜单中)
- 恢复QQ音乐源128k音质试听
- 新增不强制win7开启透明效果即可使用但要配置运行参数`-nt`,例如:`.\lx-music-desktop.exe -nt`,添加方法可自行百度“给快捷方式加参数”
### 优化

View File

@ -0,0 +1,6 @@
const { mainHandle } = require('../../common/ipc')
mainHandle('getEnvParams', async(event, options) => {
return global.envParams
})

View File

@ -10,3 +10,4 @@ require('./showSaveDialog')
require('./clearCache')
require('./getCacheSize')
require('./setIgnoreMouseEvent')
require('./getEnvParams')

View File

@ -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,

View File

@ -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
}

View File

@ -1,5 +1,5 @@
<template lang="pug">
#container(v-if="isProd && !isLinux" :class="theme" @mouseenter="enableIgnoreMouseEvents" @mouseleave="dieableIgnoreMouseEvents")
#container(v-if="isProd && !isNt" :class="theme" @mouseenter="enableIgnoreMouseEvents" @mouseleave="dieableIgnoreMouseEvents")
core-aside#left
#right
core-toolbar#toolbar
@ -20,7 +20,7 @@
<script>
import dnscache from 'dnscache'
import { mapMutations, mapGetters, mapActions } from 'vuex'
import { rendererOn, rendererSend } from '../common/ipc'
import { rendererOn, rendererSend, rendererInvoke } from '../common/ipc'
import { isLinux } from '../common/utils'
import music from './utils/music'
import { throttle, openUrl } from './utils'
@ -35,12 +35,15 @@ export default {
data() {
return {
isProd: process.env.NODE_ENV === 'production',
isLinux,
isNt: false,
globalObj: {
apiSource: 'test',
proxy: {},
},
updateTimeout: null,
envParams: {
nt: false,
},
}
},
computed: {
@ -66,7 +69,7 @@ export default {
}, 1000)
},
mounted() {
document.body.classList.add(this.isLinux ? 'noTransparent' : 'transparent')
document.body.classList.add(this.isNt ? 'noTransparent' : 'transparent')
this.init()
},
watch: {
@ -109,11 +112,19 @@ 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)
}
})
document.body.addEventListener('click', this.handleBodyClick, true)
if (this.isProd && !isLinux) {
document.body.addEventListener('mouseenter', this.dieableIgnoreMouseEvents)
document.body.addEventListener('mouseleave', this.enableIgnoreMouseEvents)
}
rendererOn('update-available', (e, info) => {
// this.showUpdateModal(true)
// console.log(info)
@ -173,12 +184,12 @@ export default {
music.init()
},
enableIgnoreMouseEvents() {
if (isLinux) return
if (!this.isNt) return
rendererSend('setIgnoreMouseEvents', false)
// console.log('content enable')
},
dieableIgnoreMouseEvents() {
if (isLinux) return
if (!this.isNt) return
// console.log('content disable')
rendererSend('setIgnoreMouseEvents', true)
},