From 10de5052c666f786506811eed733e8696c8be5c3 Mon Sep 17 00:00:00 2001 From: fofolee Date: Mon, 4 Apr 2022 15:52:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E3=80=81=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CommandCard.vue | 30 +--- src/components/CommandEditor.vue | 246 +++++++++++++++++++++++++++---- src/pages/ConfigurationPage.vue | 149 +++++++++++++------ 3 files changed, 328 insertions(+), 97 deletions(-) diff --git a/src/components/CommandCard.vue b/src/components/CommandCard.vue index 1ef5116..a49c295 100644 --- a/src/components/CommandCard.vue +++ b/src/components/CommandCard.vue @@ -276,17 +276,11 @@ export default { }, // 编辑命令 editCommand() { - let routeData = { - from: "configuration", - action: "edit", - data: this.commandInfo, + let event = { + type: "edit", + data: this.commandInfo.features.code, }; - this.$router.push({ - name: "code", - params: { - data: JSON.stringify(routeData), - }, - }); + this.$emit("commandChanged", event); }, // 运行命令 runCommand() { @@ -297,33 +291,21 @@ export default { // 启用/禁用命令 toggleCommandActivated() { let event = { - type: "disable", data: this.commandInfo.features.code, }; - if (!this.$utools.whole.removeFeature(this.commandInfo.features.code)) { - this.$utools.whole.setFeature( - JSON.parse(JSON.stringify(this.commandInfo.features)) - ); - event.type = "enable"; - } + event.type = this.isCommandActivated ? "enable" : "disable"; this.$emit("commandChanged", event); }, // 移除命令 removeCommand() { quickcommand.showConfirmBox("删除这个快捷命令").then((x) => { if (!x) return; - let code = this.commandInfo.features.code; - utools.copyText(JSON.stringify(this.commandInfo, null, 4)); - this.$utools.delDB(this.$utools.DBPRE.QC + code); - this.$utools.whole.removeFeature(code); this.isCommandAlive = false; + let code = this.commandInfo.features.code; this.$emit("commandChanged", { type: "remove", data: code, }); - quickcommand.showMessageBox( - "删除成功,为防止误操作,已将删除的命令复制到剪贴板" - ); }); }, // 导出到剪贴板 diff --git a/src/components/CommandEditor.vue b/src/components/CommandEditor.vue index 75d98ad..65827ef 100644 --- a/src/components/CommandEditor.vue +++ b/src/components/CommandEditor.vue @@ -1,8 +1,195 @@