diff --git a/publish/changeLog.md b/publish/changeLog.md index dfbb942b..fa8794a2 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -5,6 +5,7 @@ ### 优化 - 程序启动时对数据文件做读取校验,数据出现损坏时自动备份损坏的数据,若出现数据读取错误的弹窗并出现我的列表丢失时可到GitHub或加群反馈 +- 当设置-代理启用,但主机地址为空的时,将不再使用代理配置进行网络连接,并且在离开设置界面时自动禁用代理 ### 修复 diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 635d8bd3..99d0d59a 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -164,6 +164,20 @@ export default { })) } }, + 'globalObj.proxy.enable'(n, o) { + if (n != this.setting.network.proxy.enable) { + this.setSetting({ + ...this.setting, + network: { + ...this.setting.network, + proxy: { + ...this.setting.network.proxy, + enable: n, + }, + }, + }) + } + }, 'windowSizeActive.fontSize'(n) { document.documentElement.style.fontSize = n }, diff --git a/src/renderer/store/modules/player.js b/src/renderer/store/modules/player.js index ca3b24eb..d6e7a662 100644 --- a/src/renderer/store/modules/player.js +++ b/src/renderer/store/modules/player.js @@ -391,7 +391,7 @@ const mutations = { playIndex = -1 } else { let listId = playMusicInfo.listId - if (listId != '__temp__' && listId === state.listInfo.id) playIndex = state.listInfo.list.indexOf(state.playMusicInfo.musicInfo) + if (listId != '__temp__' && listId === state.listInfo.id) playIndex = state.listInfo.list.indexOf(playMusicInfo.musicInfo) } state.playMusicInfo = playMusicInfo diff --git a/src/renderer/utils/index.js b/src/renderer/utils/index.js index 2c9f2759..673b6440 100644 --- a/src/renderer/utils/index.js +++ b/src/renderer/utils/index.js @@ -371,7 +371,7 @@ export const clearCache = () => rendererInvoke(NAMES.mainWindow.clear_cache) export const setWindowSize = (width, height) => rendererSend(NAMES.mainWindow.set_window_size, { width, height }) -export const getProxyInfo = () => window.globalObj.proxy.enable +export const getProxyInfo = () => window.globalObj.proxy.enable && window.globalObj.proxy.host ? `http://${window.globalObj.proxy.username}:${window.globalObj.proxy.password}@${window.globalObj.proxy.host}:${window.globalObj.proxy.port};` : undefined diff --git a/src/renderer/views/Setting.vue b/src/renderer/views/Setting.vue index 371146af..fc12e9dc 100644 --- a/src/renderer/views/Setting.vue +++ b/src/renderer/views/Setting.vue @@ -169,11 +169,11 @@ div(:class="$style.main") p material-checkbox(id="setting_network_proxy_enable" v-model="current_setting.network.proxy.enable" @change="handleProxyChange('enable')" :label="$t('view.setting.is_enable')") p - material-input(:class="$style.gapLeft" v-model="current_setting.network.proxy.host" @change="handleProxyChange('host')" :placeholder="$t('view.setting.network_proxy_host')") - material-input(:class="$style.gapLeft" v-model="current_setting.network.proxy.port" @change="handleProxyChange('port')" :placeholder="$t('view.setting.network_proxy_port')") + material-input(:class="$style.gapLeft" v-model.trim="current_setting.network.proxy.host" @change="handleProxyChange('host')" :placeholder="$t('view.setting.network_proxy_host')") + material-input(:class="$style.gapLeft" v-model.trim="current_setting.network.proxy.port" @change="handleProxyChange('port')" :placeholder="$t('view.setting.network_proxy_port')") p - material-input(:class="$style.gapLeft" v-model="current_setting.network.proxy.username" @change="handleProxyChange('username')" :placeholder="$t('view.setting.network_proxy_username')") - material-input(:class="$style.gapLeft" v-model="current_setting.network.proxy.password" @change="handleProxyChange('password')" type="password" :placeholder="$t('view.setting.network_proxy_password')") + material-input(:class="$style.gapLeft" v-model.trim="current_setting.network.proxy.username" @change="handleProxyChange('username')" :placeholder="$t('view.setting.network_proxy_username')") + material-input(:class="$style.gapLeft" v-model.trim="current_setting.network.proxy.password" @change="handleProxyChange('password')" type="password" :placeholder="$t('view.setting.network_proxy_password')") dt#odc {{$t('view.setting.odc')}} dd div(:class="$style.gapTop") @@ -652,6 +652,8 @@ export default { window.eventHub.$off(eventBaseName.set_config, this.handleUpdateSetting) window.eventHub.$off(eventBaseName.key_down, this.handleKeyDown) window.eventHub.$off(eventBaseName.set_hot_key_config, this.handleUpdateHotKeyConfig) + + if (this.current_setting.network.proxy.enable && !this.current_setting.network.proxy.host) window.globalObj.proxy.enable = false }, methods: { ...mapMutations(['setSetting', 'setSettingVersion', 'setVersionModalVisible']),