diff --git a/src/components/Play.vue b/src/components/Play.vue index 8f5742f..95a1e46 100644 --- a/src/components/Play.vue +++ b/src/components/Play.vue @@ -354,7 +354,8 @@ export default { }, startPosition: { min: '00', sec: '00' }, // 对应调略输入框 endPosition: { min: '00', sec: '00' }, - skipendStatus: false // 是否跳过了片尾 + skipendStatus: false, // 是否跳过了片尾 + currentShortcutList: [] } }, filters: { @@ -411,8 +412,13 @@ export default { this.SET_APPSTATE(val) } }, - setting () { - return this.$store.getters.getSetting + setting: { + get () { + return this.$store.getters.getSetting + }, + set (val) { + this.SET_SETTING(val) + } } }, watch: { @@ -1044,6 +1050,7 @@ export default { this.video = { key: e.key, info: { id: e.id, name: e.name, site: e.site, index: this.video.info.index, time: this.right.currentTime } } }, mtEvent () { + if (this.setting.shortcutModified) this.currentShortcutList.forEach(e => mt.unbind(e.key)) setting.find().then(res => { if (res.shortcut) { shortcut.all().then(res => { @@ -1054,14 +1061,22 @@ export default { } }) } + this.currentShortcutList = res }) } else { shortcut.all().then(res => { for (const i of res) { mt.unbind(i.key) } + this.currentShortcutList = [] }) } + }).finally(() => { + this.setting.shortcutModified = false + setting.find().then(res => { + res.shortcutModified = this.setting.shortcutModified + setting.update(res) + }) }) }, async shortcutEvent (e) { diff --git a/src/components/Setting.vue b/src/components/Setting.vue index ba448c6..bcff144 100644 --- a/src/components/Setting.vue +++ b/src/components/Setting.vue @@ -427,7 +427,9 @@ export default { this.$message.info('已清空原数据') shortcut.add(json).then(e => { this.$message.success('已添加成功') - this.getSites() + this.getShortcut() + this.d.shortcutModified = true + this.updateSettingEvent() }) }) }, @@ -435,6 +437,8 @@ export default { shortcut.clear().then(shortcut.add(defaultShortcuts)).then(res => { this.getShortcut() this.$message.success('快捷键已重置') + this.d.shortcutModified = true + this.updateSettingEvent() }) }, async changeProxyType (e) {