From 8003497e719f8c5bdcff5f93b0c20c66d8b567f6 Mon Sep 17 00:00:00 2001 From: fofolee Date: Wed, 8 Jan 2025 16:13:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=86=E5=88=86=E6=95=B0=E6=8D=AE=E5=A4=84?= =?UTF-8?q?=E7=90=86=E5=88=86=E7=B1=BB=EF=BC=8C=E6=96=B0=E5=A2=9E=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E5=8A=A0=E5=AF=86=E3=80=81=E6=95=B0=E5=AD=A6=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/lib/quickcomposer.js | 2 + .../quickcomposer/{data => coding}/crypto.js | 0 .../quickcomposer/{data => coding}/encoder.js | 0 .../quickcomposer/{data => coding}/hash.js | 0 plugin/lib/quickcomposer/coding/index.js | 9 + .../quickcomposer/{data => coding}/utils.js | 0 plugin/lib/quickcomposer/data/index.js | 8 - plugin/lib/quickcomposer/math/index.js | 5 + .../quickcomposer/{data => math}/random.js | 0 .../AsymmetricCryptoEditor.vue | 0 .../SymmetricCryptoEditor.vue | 0 src/js/composer/cardComponents.js | 4 +- src/js/composer/commands/codingCommand.js | 120 ++++++++++ src/js/composer/commands/dataCommands.js | 226 ------------------ src/js/composer/commands/index.js | 4 + src/js/composer/commands/mathCommands.js | 120 ++++++++++ src/js/composer/commands/notifyCommands.js | 4 +- src/js/composer/commands/uiCommands.js | 8 +- 18 files changed, 271 insertions(+), 239 deletions(-) rename plugin/lib/quickcomposer/{data => coding}/crypto.js (100%) rename plugin/lib/quickcomposer/{data => coding}/encoder.js (100%) rename plugin/lib/quickcomposer/{data => coding}/hash.js (100%) create mode 100644 plugin/lib/quickcomposer/coding/index.js rename plugin/lib/quickcomposer/{data => coding}/utils.js (100%) create mode 100644 plugin/lib/quickcomposer/math/index.js rename plugin/lib/quickcomposer/{data => math}/random.js (100%) rename src/components/composer/{data => coding}/AsymmetricCryptoEditor.vue (100%) rename src/components/composer/{data => coding}/SymmetricCryptoEditor.vue (100%) create mode 100644 src/js/composer/commands/codingCommand.js create mode 100644 src/js/composer/commands/mathCommands.js diff --git a/plugin/lib/quickcomposer.js b/plugin/lib/quickcomposer.js index f19007c..bec8553 100644 --- a/plugin/lib/quickcomposer.js +++ b/plugin/lib/quickcomposer.js @@ -4,6 +4,8 @@ const quickcomposer = { file: require("./quickcomposer/file"), system: require("./quickcomposer/system"), network: require("./quickcomposer/network"), + coding: require("./quickcomposer/coding"), + math: require("./quickcomposer/math"), }; module.exports = quickcomposer; diff --git a/plugin/lib/quickcomposer/data/crypto.js b/plugin/lib/quickcomposer/coding/crypto.js similarity index 100% rename from plugin/lib/quickcomposer/data/crypto.js rename to plugin/lib/quickcomposer/coding/crypto.js diff --git a/plugin/lib/quickcomposer/data/encoder.js b/plugin/lib/quickcomposer/coding/encoder.js similarity index 100% rename from plugin/lib/quickcomposer/data/encoder.js rename to plugin/lib/quickcomposer/coding/encoder.js diff --git a/plugin/lib/quickcomposer/data/hash.js b/plugin/lib/quickcomposer/coding/hash.js similarity index 100% rename from plugin/lib/quickcomposer/data/hash.js rename to plugin/lib/quickcomposer/coding/hash.js diff --git a/plugin/lib/quickcomposer/coding/index.js b/plugin/lib/quickcomposer/coding/index.js new file mode 100644 index 0000000..ec0f41c --- /dev/null +++ b/plugin/lib/quickcomposer/coding/index.js @@ -0,0 +1,9 @@ +const crypto = require("./crypto"); +const hash = require("./hash"); +const encoder = require("./encoder"); + +module.exports = { + ...crypto, + ...hash, + ...encoder, +}; diff --git a/plugin/lib/quickcomposer/data/utils.js b/plugin/lib/quickcomposer/coding/utils.js similarity index 100% rename from plugin/lib/quickcomposer/data/utils.js rename to plugin/lib/quickcomposer/coding/utils.js diff --git a/plugin/lib/quickcomposer/data/index.js b/plugin/lib/quickcomposer/data/index.js index 5a82893..7349068 100644 --- a/plugin/lib/quickcomposer/data/index.js +++ b/plugin/lib/quickcomposer/data/index.js @@ -1,17 +1,9 @@ -const encoder = require("./encoder"); -const hash = require("./hash"); const string = require("./string"); -const crypto = require("./crypto"); const buffer = require("./buffer"); const zlib = require("./zlib"); -const random = require("./random"); module.exports = { - ...encoder, - ...hash, ...string, - ...crypto, buffer, zlib, - random, }; diff --git a/plugin/lib/quickcomposer/math/index.js b/plugin/lib/quickcomposer/math/index.js new file mode 100644 index 0000000..382c85b --- /dev/null +++ b/plugin/lib/quickcomposer/math/index.js @@ -0,0 +1,5 @@ +const random = require("./random"); + +module.exports = { + random, +}; diff --git a/plugin/lib/quickcomposer/data/random.js b/plugin/lib/quickcomposer/math/random.js similarity index 100% rename from plugin/lib/quickcomposer/data/random.js rename to plugin/lib/quickcomposer/math/random.js diff --git a/src/components/composer/data/AsymmetricCryptoEditor.vue b/src/components/composer/coding/AsymmetricCryptoEditor.vue similarity index 100% rename from src/components/composer/data/AsymmetricCryptoEditor.vue rename to src/components/composer/coding/AsymmetricCryptoEditor.vue diff --git a/src/components/composer/data/SymmetricCryptoEditor.vue b/src/components/composer/coding/SymmetricCryptoEditor.vue similarity index 100% rename from src/components/composer/data/SymmetricCryptoEditor.vue rename to src/components/composer/coding/SymmetricCryptoEditor.vue diff --git a/src/js/composer/cardComponents.js b/src/js/composer/cardComponents.js index ef8a13c..1ed8732 100644 --- a/src/js/composer/cardComponents.js +++ b/src/js/composer/cardComponents.js @@ -44,10 +44,10 @@ export const RegexEditor = defineAsyncComponent(() => // Crypto Components export const SymmetricCryptoEditor = defineAsyncComponent(() => - import("src/components/composer/data/SymmetricCryptoEditor.vue") + import("src/components/composer/coding/SymmetricCryptoEditor.vue") ); export const AsymmetricCryptoEditor = defineAsyncComponent(() => - import("src/components/composer/data/AsymmetricCryptoEditor.vue") + import("src/components/composer/coding/AsymmetricCryptoEditor.vue") ); // File Components diff --git a/src/js/composer/commands/codingCommand.js b/src/js/composer/commands/codingCommand.js new file mode 100644 index 0000000..40a699a --- /dev/null +++ b/src/js/composer/commands/codingCommand.js @@ -0,0 +1,120 @@ +export const codingCommands = { + label: "编码加密", + icon: "lock", + defaultOpened: false, + commands: [ + { + value: "quickcomposer.coding.base64Encode", + label: "编解码", + desc: "文本编解码", + icon: "code", + outputVariable: "processedText", + saveOutput: true, + config: [ + { + label: "要编解码的文本", + icon: "text_fields", + type: "varInput", + }, + ], + functionSelector: [ + { + label: "Base64编码", + value: "quickcomposer.coding.base64Encode", + icon: "title", + }, + { + label: "Base64解码", + value: "quickcomposer.coding.base64Decode", + icon: "title", + }, + { + label: "十六进制编码", + value: "quickcomposer.coding.hexEncode", + icon: "code", + }, + { + label: "十六进制解码", + value: "quickcomposer.coding.hexDecode", + icon: "code", + }, + { + label: "URL编码", + value: "quickcomposer.coding.urlEncode", + icon: "link", + }, + { + label: "URL解码", + value: "quickcomposer.coding.urlDecode", + icon: "link", + }, + { + label: "HTML编码", + value: "quickcomposer.coding.htmlEncode", + icon: "html", + }, + { + label: "HTML解码", + value: "quickcomposer.coding.htmlDecode", + icon: "html", + }, + ], + }, + { + value: "quickcomposer.coding.symmetricCrypto", + label: "对称加解密", + component: "SymmetricCryptoEditor", + outputVariable: "processedText", + saveOutput: true, + }, + { + value: "quickcomposer.coding.asymmetricCrypto", + label: "非对称加解密", + component: "AsymmetricCryptoEditor", + outputVariable: "processedText", + saveOutput: true, + }, + { + value: "quickcomposer.coding.md5Hash", + label: "哈希计算", + desc: "计算文本的哈希值", + icon: "enhanced_encryption", + outputVariable: "hashValue", + saveOutput: true, + config: [ + { + label: "要计算哈希的文本", + icon: "text_fields", + type: "varInput", + }, + ], + functionSelector: [ + { + label: "MD5", + value: "quickcomposer.coding.md5Hash", + icon: "functions", + }, + { + label: "SHA1", + value: "quickcomposer.coding.sha1Hash", + icon: "functions", + }, + { + label: "SHA256", + value: "quickcomposer.coding.sha256Hash", + icon: "functions", + }, + { + label: "SHA512", + value: "quickcomposer.coding.sha512Hash", + icon: "functions", + }, + { + label: "SM3", + value: "quickcomposer.coding.sm3Hash", + icon: "functions", + }, + ], + }, + ], +}; diff --git a/src/js/composer/commands/dataCommands.js b/src/js/composer/commands/dataCommands.js index 539642f..bfda4f3 100644 --- a/src/js/composer/commands/dataCommands.js +++ b/src/js/composer/commands/dataCommands.js @@ -5,232 +5,6 @@ export const dataCommands = { icon: "format_color_text", defaultOpened: false, commands: [ - { - value: "quickcomposer.data.base64Encode", - label: "编解码", - desc: "文本编解码", - icon: "code", - outputVariable: "processedText", - saveOutput: true, - config: [ - { - label: "要编解码的文本", - icon: "text_fields", - type: "varInput", - }, - ], - functionSelector: [ - { - label: "Base64编码", - value: "quickcomposer.data.base64Encode", - icon: "title", - }, - { - label: "Base64解码", - value: "quickcomposer.data.base64Decode", - icon: "title", - }, - { - label: "十六进制编码", - value: "quickcomposer.data.hexEncode", - icon: "code", - }, - { - label: "十六进制解码", - value: "quickcomposer.data.hexDecode", - icon: "code", - }, - { - label: "URL编码", - value: "quickcomposer.data.urlEncode", - icon: "link", - }, - { - label: "URL解码", - value: "quickcomposer.data.urlDecode", - icon: "link", - }, - { - label: "HTML编码", - value: "quickcomposer.data.htmlEncode", - icon: "html", - }, - { - label: "HTML解码", - value: "quickcomposer.data.htmlDecode", - icon: "html", - }, - ], - }, - { - value: "quickcomposer.data.symmetricCrypto", - label: "对称加解密", - component: "SymmetricCryptoEditor", - outputVariable: "processedText", - saveOutput: true, - }, - { - value: "quickcomposer.data.asymmetricCrypto", - label: "非对称加解密", - component: "AsymmetricCryptoEditor", - outputVariable: "processedText", - saveOutput: true, - }, - { - value: "quickcomposer.data.md5Hash", - label: "哈希计算", - desc: "计算文本的哈希值", - icon: "enhanced_encryption", - outputVariable: "hashValue", - saveOutput: true, - config: [ - { - label: "要计算哈希的文本", - icon: "text_fields", - type: "varInput", - }, - ], - functionSelector: [ - { - label: "MD5", - value: "quickcomposer.data.md5Hash", - icon: "functions", - }, - { - label: "SHA1", - value: "quickcomposer.data.sha1Hash", - icon: "functions", - }, - { - label: "SHA256", - value: "quickcomposer.data.sha256Hash", - icon: "functions", - }, - { - label: "SHA512", - value: "quickcomposer.data.sha512Hash", - icon: "functions", - }, - { - label: "SM3", - value: "quickcomposer.data.sm3Hash", - icon: "functions", - }, - ], - }, - { - value: "Math.sin", - label: "数学计算", - desc: "数学函数计算", - icon: "calculate", - outputVariable: "calculatedText", - saveOutput: true, - config: [ - { - label: "要计算的数值", - icon: "numbers", - type: "numInput", - }, - ], - functionSelector: [ - { - label: "正弦(sin)", - value: "Math.sin", - icon: "functions", - }, - { - label: "余弦(cos)", - value: "Math.cos", - icon: "functions", - }, - { - label: "正切(tan)", - value: "Math.tan", - icon: "functions", - }, - { - label: "反正弦(asin)", - value: "Math.asin", - icon: "functions", - }, - { - label: "反余弦(acos)", - value: "Math.acos", - icon: "functions", - }, - { - label: "反正切(atan)", - value: "Math.atan", - icon: "functions", - }, - { - label: "平方根(sqrt)", - value: "Math.sqrt", - icon: "functions", - }, - { - label: "自然对数(ln)", - value: "Math.log", - icon: "functions", - }, - { - label: "10对数(log10)", - value: "Math.log10", - icon: "functions", - }, - { - label: "绝对值(abs)", - value: "Math.abs", - icon: "functions", - }, - { - label: "向上取整(ceil)", - value: "Math.ceil", - icon: "functions", - }, - { - label: "向下取整(floor)", - value: "Math.floor", - icon: "functions", - }, - { - label: "四舍五入(round)", - value: "Math.round", - icon: "functions", - }, - { - label: "幂运算(pow)", - value: "Math.pow", - icon: "functions", - }, - ], - }, - { - value: "quickcomposer.data.random", - label: "随机数", - config: [ - { - label: "整数", - type: "switch", - defaultValue: false, - width: 2, - }, - { - label: "起始值", - icon: "last_page", - type: "numInput", - width: 5, - }, - { - label: "结束值", - icon: "first_page", - type: "numInput", - width: 5, - }, - ], - outputVariable: "randomNumber", - saveOutput: true, - }, { value: "quickcomposer.data.reverseString", label: "字符串反转", diff --git a/src/js/composer/commands/index.js b/src/js/composer/commands/index.js index 75a67ab..072f2a7 100644 --- a/src/js/composer/commands/index.js +++ b/src/js/composer/commands/index.js @@ -7,6 +7,8 @@ import { otherCommands } from "./otherCommands"; import { simulateCommands } from "./simulateCommands"; import { controlCommands } from "./controlCommands"; import { uiCommands } from "./uiCommands"; +import { codingCommands } from "./codingCommand"; +import { mathCommands } from "./mathCommands"; export const commandCategories = [ fileCommands, @@ -14,8 +16,10 @@ export const commandCategories = [ systemCommands, notifyCommands, dataCommands, + codingCommands, controlCommands, uiCommands, simulateCommands, + mathCommands, otherCommands, ]; diff --git a/src/js/composer/commands/mathCommands.js b/src/js/composer/commands/mathCommands.js new file mode 100644 index 0000000..6ec7dca --- /dev/null +++ b/src/js/composer/commands/mathCommands.js @@ -0,0 +1,120 @@ +export const mathCommands = { + label: "数学计算", + icon: "calculate", + defaultOpened: false, + commands: [ + { + value: "Math.sin", + label: "数学计算", + desc: "数学函数计算", + icon: "calculate", + outputVariable: "calculatedText", + saveOutput: true, + config: [ + { + label: "要计算的数值", + icon: "numbers", + type: "numInput", + }, + ], + functionSelector: [ + { + label: "正弦(sin)", + value: "Math.sin", + icon: "functions", + }, + { + label: "余弦(cos)", + value: "Math.cos", + icon: "functions", + }, + { + label: "正切(tan)", + value: "Math.tan", + icon: "functions", + }, + { + label: "反正弦(asin)", + value: "Math.asin", + icon: "functions", + }, + { + label: "反余弦(acos)", + value: "Math.acos", + icon: "functions", + }, + { + label: "反正切(atan)", + value: "Math.atan", + icon: "functions", + }, + { + label: "平方根(sqrt)", + value: "Math.sqrt", + icon: "functions", + }, + { + label: "自然对数(ln)", + value: "Math.log", + icon: "functions", + }, + { + label: "10对数(log10)", + value: "Math.log10", + icon: "functions", + }, + { + label: "绝对值(abs)", + value: "Math.abs", + icon: "functions", + }, + { + label: "向上取整(ceil)", + value: "Math.ceil", + icon: "functions", + }, + { + label: "向下取整(floor)", + value: "Math.floor", + icon: "functions", + }, + { + label: "四舍五入(round)", + value: "Math.round", + icon: "functions", + }, + { + label: "幂运算(pow)", + value: "Math.pow", + icon: "functions", + }, + ], + }, + { + value: "quickcomposer.math.random", + label: "随机数", + config: [ + { + label: "整数", + type: "switch", + defaultValue: false, + width: 2, + }, + { + label: "起始值", + icon: "last_page", + type: "numInput", + width: 5, + }, + { + label: "结束值", + icon: "first_page", + type: "numInput", + width: 5, + }, + ], + outputVariable: "randomNumber", + saveOutput: true, + }, + ], +}; diff --git a/src/js/composer/commands/notifyCommands.js b/src/js/composer/commands/notifyCommands.js index 09a9675..b7e4245 100644 --- a/src/js/composer/commands/notifyCommands.js +++ b/src/js/composer/commands/notifyCommands.js @@ -1,6 +1,6 @@ export const notifyCommands = { - label: "消息通知", - icon: "chat_bubble_outline", + label: "输出消息", + icon: "output", defaultOpened: false, commands: [ { diff --git a/src/js/composer/commands/uiCommands.js b/src/js/composer/commands/uiCommands.js index f69e540..fa3ab71 100644 --- a/src/js/composer/commands/uiCommands.js +++ b/src/js/composer/commands/uiCommands.js @@ -1,7 +1,7 @@ import { newVarInputVal } from "js/composer/varInputValManager"; export const uiCommands = { - label: "UI操作", + label: "用户交互", icon: "web", defaultOpened: false, commands: [ @@ -52,6 +52,12 @@ export const uiCommands = { }, ], }, + { + label: "标题", + type: "varInput", + defaultValue: newVarInputVal("str", "请选择"), + width: 12, + }, ], }, {