新增窗口大小设置
parent
c97bc5edfc
commit
31e8b466cf
|
@ -1,3 +1,3 @@
|
||||||
#### 修复
|
#### 新增
|
||||||
|
|
||||||
- 兼容旧版酷我源搜索列表过滤128k音质的bug(注:0.8.1版本仅修复了酷我源的歌曲过滤问题,该修复仅对以后添加的歌曲有效,如果是之前添加的歌曲仍会出现这个问题,现修复对之前旧列表数据的兼容处理)
|
- 新增窗口大小设置,若觉得软件窗口小可以到设置页调大点
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
module.exports = {
|
||||||
|
windowSizeList: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: '小',
|
||||||
|
width: 920,
|
||||||
|
height: 590,
|
||||||
|
tabList: '645px',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: '中',
|
||||||
|
width: 1012,
|
||||||
|
height: 650,
|
||||||
|
tabList: '719px',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: '大',
|
||||||
|
width: 1104,
|
||||||
|
height: 708,
|
||||||
|
tabList: '792px',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
const { mainOn } = require('../../common/icp')
|
||||||
|
|
||||||
|
|
||||||
|
mainOn('restartWindow', (event, name) => {
|
||||||
|
console.log(name)
|
||||||
|
switch (name) {
|
||||||
|
case 'main':
|
||||||
|
default:
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
|
@ -18,6 +18,7 @@ app.on('second-instance', (event, argv, cwd) => {
|
||||||
require('./events')
|
require('./events')
|
||||||
const autoUpdate = require('./utils/autoUpdate')
|
const autoUpdate = require('./utils/autoUpdate')
|
||||||
const { isLinux, isMac } = require('../common/utils')
|
const { isLinux, isMac } = require('../common/utils')
|
||||||
|
const { getWindowSizeInfo } = require('./utils')
|
||||||
|
|
||||||
const isDev = process.env.NODE_ENV !== 'production'
|
const isDev = process.env.NODE_ENV !== 'production'
|
||||||
|
|
||||||
|
@ -39,13 +40,14 @@ if (isDev) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
|
let windowSizeInfo = getWindowSizeInfo()
|
||||||
/**
|
/**
|
||||||
* Initial window options
|
* Initial window options
|
||||||
*/
|
*/
|
||||||
mainWindow = global.mainWindow = new BrowserWindow({
|
mainWindow = global.mainWindow = new BrowserWindow({
|
||||||
height: 590,
|
height: windowSizeInfo.height,
|
||||||
useContentSize: true,
|
useContentSize: true,
|
||||||
width: 920,
|
width: windowSizeInfo.width,
|
||||||
frame: false,
|
frame: false,
|
||||||
transparent: !isLinux,
|
transparent: !isLinux,
|
||||||
// icon: path.join(global.__static, isWin ? 'icons/256x256.ico' : 'icons/512x512.png'),
|
// icon: path.join(global.__static, isWin ? 'icons/256x256.ico' : 'icons/512x512.png'),
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
const Store = require('electron-store')
|
||||||
|
const { windowSizeList } = require('../../common/config')
|
||||||
|
|
||||||
|
exports.getWindowSizeInfo = () => {
|
||||||
|
let electronStore = new Store()
|
||||||
|
const { windowSizeId = 1 } = electronStore.get('setting')
|
||||||
|
return windowSizeList.find(i => i.id === windowSizeId) || windowSizeList[0]
|
||||||
|
}
|
|
@ -413,7 +413,7 @@
|
||||||
|
|
||||||
|
|
||||||
// Width
|
// Width
|
||||||
@width-app-left: 180px;
|
@width-app-left: 20%;
|
||||||
|
|
||||||
// Height
|
// Height
|
||||||
@height-toolbar: 50px;
|
@height-toolbar: 50px;
|
||||||
|
|
|
@ -68,8 +68,8 @@ export default {
|
||||||
}
|
}
|
||||||
.logo {
|
.logo {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 20px;
|
padding: 12% 13%;
|
||||||
height: 100px;
|
// height: 120px;
|
||||||
color: @color-theme-font;
|
color: @color-theme-font;
|
||||||
flex: none;
|
flex: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,8 +88,6 @@ export default {
|
||||||
msDownX: 0,
|
msDownX: 0,
|
||||||
msDownVolume: 0,
|
msDownVolume: 0,
|
||||||
},
|
},
|
||||||
handleVolumeMsMoveFn: null,
|
|
||||||
handleVolumeMsUpFn: null,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -125,12 +123,14 @@ export default {
|
||||||
this.setVolume(volume)
|
this.setVolume(volume)
|
||||||
}, 300)
|
}, 300)
|
||||||
|
|
||||||
document.addEventListener('mousemove', this.handleVolumeMsMoveFn = this.handleVolumeMsMove.bind(this))
|
document.addEventListener('mousemove', this.handleVolumeMsMove)
|
||||||
document.addEventListener('mouseup', this.handleVolumeMsUpFn = this.handleVolumeMsUp.bind(this))
|
document.addEventListener('mouseup', this.handleVolumeMsUp)
|
||||||
|
window.addEventListener('resize', this.handleResize)
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
document.removeEventListener('mousemove', this.handleVolumeMsMoveFn)
|
document.removeEventListener('mousemove', this.handleVolumeMsMove)
|
||||||
document.removeEventListener('mouseup', this.handleVolumeMsUpFn)
|
document.removeEventListener('mouseup', this.handleVolumeMsUp)
|
||||||
|
window.removeEventListener('resize', this.handleResize)
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
changePlay(n) {
|
changePlay(n) {
|
||||||
|
@ -489,6 +489,9 @@ export default {
|
||||||
handleCopy(text) {
|
handleCopy(text) {
|
||||||
clipboardWriteText(text)
|
clipboardWriteText(text)
|
||||||
},
|
},
|
||||||
|
handleResize() {
|
||||||
|
this.setProgessWidth()
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
div(:class="$style.icon")
|
div(:class="$style.icon")
|
||||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 451.847 451.847' space='preserve')
|
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 451.847 451.847' space='preserve')
|
||||||
use(xlink:href='#icon-down')
|
use(xlink:href='#icon-down')
|
||||||
div.scroll(:class="$style.list" @click.stop ref="dom_list")
|
div.scroll(:class="$style.list" :style="{ width: listStyle }" @click.stop ref="dom_list")
|
||||||
div(:class="$style.tag" @click="handleClick(null)") 默认
|
div(:class="$style.tag" @click="handleClick(null)") 默认
|
||||||
dl(v-for="type in list")
|
dl(v-for="type in list")
|
||||||
dt(:class="$style.type") {{type.name}}
|
dt(:class="$style.type") {{type.name}}
|
||||||
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { isChildren } from '../../utils'
|
import { isChildren } from '../../utils'
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
list: {
|
list: {
|
||||||
|
@ -26,6 +27,13 @@ export default {
|
||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['setting', 'windowSizeList']),
|
||||||
|
listStyle() {
|
||||||
|
let info = this.windowSizeList.find(i => i.id === this.setting.windowSizeId) || this.windowSizeList[0]
|
||||||
|
return info.tabList
|
||||||
|
},
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
show: false,
|
show: false,
|
||||||
|
|
|
@ -34,4 +34,7 @@ export default {
|
||||||
route(state) {
|
route(state) {
|
||||||
return state.route
|
return state.route
|
||||||
},
|
},
|
||||||
|
windowSizeList(state) {
|
||||||
|
return state.windowSizeList
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// const isDev = process.env.NODE_ENV === 'development'
|
// const isDev = process.env.NODE_ENV === 'development'
|
||||||
import Store from 'electron-store'
|
import Store from 'electron-store'
|
||||||
import { updateSetting } from '../utils'
|
import { updateSetting } from '../utils'
|
||||||
|
import { windowSizeList } from '../../common/config'
|
||||||
import { version } from '../../../package.json'
|
import { version } from '../../../package.json'
|
||||||
let electronStore = new Store()
|
let electronStore = new Store()
|
||||||
const setting = updateSetting(electronStore.get('setting'))
|
const setting = updateSetting(electronStore.get('setting'))
|
||||||
|
@ -65,4 +66,5 @@ export default {
|
||||||
userInfo: null,
|
userInfo: null,
|
||||||
setting,
|
setting,
|
||||||
electronStore,
|
electronStore,
|
||||||
|
windowSizeList,
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,7 @@ export const isChildren = (parent, children) => {
|
||||||
* @param {*} setting
|
* @param {*} setting
|
||||||
*/
|
*/
|
||||||
export const updateSetting = setting => {
|
export const updateSetting = setting => {
|
||||||
const defaultVersion = '1.0.12'
|
const defaultVersion = '1.0.13'
|
||||||
const defaultSetting = {
|
const defaultSetting = {
|
||||||
version: defaultVersion,
|
version: defaultVersion,
|
||||||
player: {
|
player: {
|
||||||
|
@ -216,6 +216,7 @@ export const updateSetting = setting => {
|
||||||
password: '',
|
password: '',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
windowSizeId: 1,
|
||||||
themeId: 0,
|
themeId: 0,
|
||||||
sourceId: 'kw',
|
sourceId: 'kw',
|
||||||
apiSource: 'test',
|
apiSource: 'test',
|
||||||
|
@ -369,3 +370,10 @@ export const getCacheSize = () => remote.getCurrentWindow().webContents.session.
|
||||||
* @param {*} win
|
* @param {*} win
|
||||||
*/
|
*/
|
||||||
export const clearCache = () => remote.getCurrentWindow().webContents.session.clearCache()
|
export const clearCache = () => remote.getCurrentWindow().webContents.session.clearCache()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置窗口大小
|
||||||
|
* @param {*} width
|
||||||
|
* @param {*} height
|
||||||
|
*/
|
||||||
|
export const setWindowSize = (width, height) => remote.getCurrentWindow().setBounds({ width, height })
|
||||||
|
|
|
@ -18,9 +18,15 @@ div.scroll(:class="$style.setting")
|
||||||
dd(title='选择音乐来源')
|
dd(title='选择音乐来源')
|
||||||
h3 音乐来源
|
h3 音乐来源
|
||||||
div
|
div
|
||||||
material-checkbox(v-for="item in apiSources" :id="`setting_api_source_${item.id}`" @change="handleAPISourceChange(item.id)" :class="$style.gapTop"
|
material-checkbox(v-for="item in apiSources" :id="`setting_api_source_${item.id}`" name="setting_api_source" @change="handleAPISourceChange(item.id)" :class="$style.gapTop"
|
||||||
need v-model="current_setting.apiSource" :disabled="item.disabled" :value="item.id" :label="item.label" :key="item.id")
|
need v-model="current_setting.apiSource" :disabled="item.disabled" :value="item.id" :label="item.label" :key="item.id")
|
||||||
|
|
||||||
|
dd(title='设置软件窗口尺寸')
|
||||||
|
h3 窗口尺寸
|
||||||
|
div
|
||||||
|
material-checkbox(v-for="(item, index) in windowSizeList" :id="`setting_window_size_${item.id}`" name="setting_window_size" @change="handleWindowSizeChange(index)" :class="$style.gapLeft"
|
||||||
|
need v-model="current_setting.windowSizeId" :value="item.id" :label="item.name" :key="item.id")
|
||||||
|
|
||||||
dt 播放设置
|
dt 播放设置
|
||||||
dd(title="都不选时播放完当前歌曲就停止播放")
|
dd(title="都不选时播放完当前歌曲就停止播放")
|
||||||
h3 歌曲切换方式
|
h3 歌曲切换方式
|
||||||
|
@ -176,19 +182,22 @@ import {
|
||||||
getCacheSize,
|
getCacheSize,
|
||||||
clearCache,
|
clearCache,
|
||||||
sizeFormate,
|
sizeFormate,
|
||||||
|
setWindowSize,
|
||||||
} from '../utils'
|
} from '../utils'
|
||||||
import { rendererSend } from '../../common/icp'
|
import { rendererSend } from '../../common/icp'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Setting',
|
name: 'Setting',
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['setting', 'themes', 'version']),
|
...mapGetters(['setting', 'themes', 'version', 'windowSizeList']),
|
||||||
...mapGetters('list', ['defaultList', 'loveList']),
|
...mapGetters('list', ['defaultList', 'loveList']),
|
||||||
isLatestVer() {
|
isLatestVer() {
|
||||||
return this.version.newVersion && this.version.version === this.version.newVersion.version
|
return this.version.newVersion && this.version.version === this.version.newVersion.version
|
||||||
},
|
},
|
||||||
|
isShowRebootBtn() {
|
||||||
|
return this.current_setting.windowSizeId != window.currentWindowSizeId
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -225,6 +234,7 @@ export default {
|
||||||
odc: {
|
odc: {
|
||||||
isAutoClearSearchInput: false,
|
isAutoClearSearchInput: false,
|
||||||
},
|
},
|
||||||
|
windowSizeId: 1,
|
||||||
themeId: 0,
|
themeId: 0,
|
||||||
sourceId: 0,
|
sourceId: 0,
|
||||||
randomAnimate: true,
|
randomAnimate: true,
|
||||||
|
@ -314,6 +324,7 @@ export default {
|
||||||
...mapMutations('list', ['setList']),
|
...mapMutations('list', ['setList']),
|
||||||
init() {
|
init() {
|
||||||
this.current_setting = JSON.parse(JSON.stringify(this.setting))
|
this.current_setting = JSON.parse(JSON.stringify(this.setting))
|
||||||
|
if (!window.currentWindowSizeId) window.currentWindowSizeId = this.setting.windowSizeId
|
||||||
this.getCacheSize()
|
this.getCacheSize()
|
||||||
},
|
},
|
||||||
handleChangeSavePath() {
|
handleChangeSavePath() {
|
||||||
|
@ -502,6 +513,10 @@ export default {
|
||||||
this.getCacheSize()
|
this.getCacheSize()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
handleWindowSizeChange(index) {
|
||||||
|
let info = this.windowSizeList[index]
|
||||||
|
setWindowSize(info.width, info.height)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -549,6 +564,19 @@ export default {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-content {
|
||||||
|
display: inline-block;
|
||||||
|
transition: @transition-theme;
|
||||||
|
transition-property: opacity, transform;
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1);
|
||||||
|
|
||||||
|
&.hide {
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.gap-left {
|
.gap-left {
|
||||||
+ .gap-left {
|
+ .gap-left {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
|
|
Loading…
Reference in New Issue