From 3ba0d019156f0f6bd71e48bf0879585a238ffccf Mon Sep 17 00:00:00 2001 From: fofolee Date: Tue, 12 Apr 2022 13:06:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=91=BD=E4=BB=A4=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E4=B9=9F=E9=9C=80=E8=A6=81=E4=B8=B4=E6=97=B6=E8=B5=8B?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CommandEditor.vue | 8 ++++---- src/components/CommandRunResult.vue | 14 +++++++------- src/js/options/commandTypes.js | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/CommandEditor.vue b/src/components/CommandEditor.vue index 43fd26a..cde4ea4 100644 --- a/src/components/CommandEditor.vue +++ b/src/components/CommandEditor.vue @@ -353,10 +353,10 @@ export default { }, // 运行 runCurrentCommand() { - // 如果 action 是 run 则输出一律为 text - this.quickcommandInfo.output = - this.$refs.menu?.currentCommand.output || "text"; - this.$refs.result.runCurrentCommand(_.cloneDeep(this.quickcommandInfo)); + let command = _.cloneDeep(this.quickcommandInfo); + command.output = this.$refs.menu?.currentCommand.output || "text"; + command.cmdType = this.$refs.menu?.cmdType.name; + this.$refs.result.runCurrentCommand(command); }, }, }; diff --git a/src/components/CommandRunResult.vue b/src/components/CommandRunResult.vue index f965ac8..718450b 100644 --- a/src/components/CommandRunResult.vue +++ b/src/components/CommandRunResult.vue @@ -60,8 +60,8 @@ export default { props: { /** * run: 「RunCode界面」 无侧栏,运行结果弹窗显示,保存命令历史 - * edit: 「编辑命令界面』 有侧栏,运行结果弹窗显示 - * new: 『新建命令界面」 有侧栏,运行结果弹窗显示 + * edit: 「编辑命令界面』 有侧栏,运行结果弹窗显示,需要对payload临时赋值 + * new: 『新建命令界面」 有侧栏,运行结果弹窗显示,需要对payload临时赋值 * config: 「配置界面』 运行结果弹窗显示,需要对payload临时赋值 * input: 『主输入框进入」 运行结果直接展示,动态调整窗体高度 */ @@ -75,7 +75,7 @@ export default { return this.action.type === "input"; }, needTempPayload() { - return this.action.type === "config"; + return ["edit", "new", "config"].includes(this.action.type); }, }, methods: { @@ -161,11 +161,11 @@ export default { // payload 临时赋值 async getTempPayload(currentCommand) { if (!this.needTempPayload) return; - let cmd = currentCommand.features.cmds[0]; - let type = cmd.type; + let type = + currentCommand.cmdType || currentCommand.features?.cmds[0].type; quickcommand.enterData = { - type: cmd.type || "text", - payload: (await commandTypes[type]?.tempPayload?.()) || cmd, + type: type || "text", + payload: await commandTypes[type]?.tempPayload?.(), }; }, // 显示运行结果 diff --git a/src/js/options/commandTypes.js b/src/js/options/commandTypes.js index 7637dc3..ddbc4f5 100644 --- a/src/js/options/commandTypes.js +++ b/src/js/options/commandTypes.js @@ -130,7 +130,7 @@ const commandTypes = { }], verify: rules => true, tempPayload: () => window.getBase64Ico(utools.showOpenDialog({ - title: "需要处理的文件", + title: "需要处理的图片", filters: [{ name: 'Images', extensions: ['png', @@ -184,4 +184,4 @@ const commandTypes = { } } -export default commandTypes \ No newline at end of file +export default commandTypes