mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-08 22:51:25 +08:00
编排配置文件优化
This commit is contained in:
parent
c94256c14d
commit
dfc1c7e2e3
@ -217,7 +217,7 @@ export default defineComponent({
|
|||||||
/* 输入框标签字体大小,占位时的位置 */
|
/* 输入框标签字体大小,占位时的位置 */
|
||||||
.command-composer :deep(.q-field--filled .q-field__label) {
|
.command-composer :deep(.q-field--filled .q-field__label) {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
top: 8px;
|
top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 输入框标签悬浮的位置 */
|
/* 输入框标签悬浮的位置 */
|
||||||
|
@ -76,27 +76,28 @@
|
|||||||
|
|
||||||
<!-- 参数输入 -->
|
<!-- 参数输入 -->
|
||||||
<div class="row items-center">
|
<div class="row items-center">
|
||||||
<!-- 按键编辑器 -->
|
<!-- 单独写组件的参数 -->
|
||||||
<template v-if="command.hasKeyRecorder">
|
<component
|
||||||
<KeyEditor v-model="argvLocal" class="col" />
|
:is="command.component"
|
||||||
</template>
|
v-model="argvLocal"
|
||||||
<!-- UBrowser编辑器 -->
|
class="col"
|
||||||
<template v-else-if="command.hasUBrowserEditor">
|
v-if="!!command.component"
|
||||||
<UBrowserEditor v-model="argvLocal" class="col" />
|
/>
|
||||||
</template>
|
<!-- 通用组件参数 -->
|
||||||
<!-- Axios编辑器 -->
|
<template v-else>
|
||||||
<template v-else-if="command.hasAxiosEditor">
|
<div
|
||||||
<AxiosConfigEditor v-model="argvLocal" class="col" />
|
v-for="item in command.config"
|
||||||
</template>
|
:key="item.key"
|
||||||
<!-- 普通参数输入 -->
|
class="col-12 row q-col-gutter-xs"
|
||||||
<template v-else-if="!command.hasNoArgs">
|
>
|
||||||
<VariableInput
|
<VariableInput
|
||||||
v-model="argvLocal"
|
v-model="argvLocal"
|
||||||
:label="placeholder"
|
:label="item.label"
|
||||||
:command="command"
|
:command="command"
|
||||||
class="col"
|
:class="`col-${item.width || 12}`"
|
||||||
ref="variableInput"
|
v-if="item.type === 'input'"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -272,12 +272,12 @@ export default defineComponent({
|
|||||||
|
|
||||||
const args = [this.mainKey, ...activeModifiers];
|
const args = [this.mainKey, ...activeModifiers];
|
||||||
// 为每个参数添加引号
|
// 为每个参数添加引号
|
||||||
this.$emit("update:modelValue", `"${args.join('","')}"`);
|
this.$emit("update:modelValue", `keyTap("${args.join('","')}")`);
|
||||||
},
|
},
|
||||||
parseKeyString(val) {
|
parseKeyString(val) {
|
||||||
try {
|
try {
|
||||||
// 移除开头和结尾的引号
|
// 移除 keyTap 和引号
|
||||||
const cleanVal = val.replace(/^"|"$/g, "");
|
const cleanVal = val.replace(/^keyTap\("/, "").replace(/"\)$/, "");
|
||||||
// 分割并移除每个参数的引号
|
// 分割并移除每个参数的引号
|
||||||
const args = cleanVal
|
const args = cleanVal
|
||||||
.split('","')
|
.split('","')
|
||||||
|
84
src/js/composer/commands/encodeCommands.js
Normal file
84
src/js/composer/commands/encodeCommands.js
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
export const encodeCommands = {
|
||||||
|
label: "编码解码",
|
||||||
|
icon: "code",
|
||||||
|
commands: [
|
||||||
|
{
|
||||||
|
value: "(text=>Buffer.from(text).toString('base64'))",
|
||||||
|
label: "Base64编码",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "text",
|
||||||
|
label: "要编码的文本",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "lock",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "(text=>Buffer.from(text,'base64').toString())",
|
||||||
|
label: "Base64解码",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "text",
|
||||||
|
label: "要解码的Base64文本",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "lock_open",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "(text=>Buffer.from(text).toString('hex'))",
|
||||||
|
label: "十六进制编码",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "text",
|
||||||
|
label: "要编码的文本",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "lock",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "(text=>Buffer.from(text,'hex').toString())",
|
||||||
|
label: "十六进制解码",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "text",
|
||||||
|
label: "要解码的十六进制文本",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "lock_open",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "encodeURIComponent",
|
||||||
|
label: "URL编码",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "text",
|
||||||
|
label: "要编码的文本",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "link",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "decodeURIComponent",
|
||||||
|
label: "URL解码",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "text",
|
||||||
|
label: "要解码的URL编码文本",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "link_off",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
32
src/js/composer/commands/fileCommands.js
Normal file
32
src/js/composer/commands/fileCommands.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
export const fileCommands = {
|
||||||
|
label: "文件操作",
|
||||||
|
icon: "folder",
|
||||||
|
commands: [
|
||||||
|
{
|
||||||
|
value: "open",
|
||||||
|
label: "打开文件/文件夹/软件",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "path",
|
||||||
|
label: "文件、文件夹或软件的绝对路径",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "folder_open",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "locate",
|
||||||
|
label: "在文件管理器中定位文件",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "path",
|
||||||
|
label: "文件、文件夹或软件的绝对路径",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "location_on",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
17
src/js/composer/commands/index.js
Normal file
17
src/js/composer/commands/index.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { fileCommands } from "./fileCommands";
|
||||||
|
import { networkCommands } from "./networkCommands";
|
||||||
|
import { systemCommands } from "./systemCommands";
|
||||||
|
import { notifyCommands } from "./notifyCommands";
|
||||||
|
import { encodeCommands } from "./encodeCommands";
|
||||||
|
import { otherCommands } from "./otherCommands";
|
||||||
|
import { keyCommands } from "./keyCommands";
|
||||||
|
|
||||||
|
export const commandCategories = [
|
||||||
|
fileCommands,
|
||||||
|
networkCommands,
|
||||||
|
systemCommands,
|
||||||
|
notifyCommands,
|
||||||
|
encodeCommands,
|
||||||
|
otherCommands,
|
||||||
|
keyCommands,
|
||||||
|
];
|
12
src/js/composer/commands/keyCommands.js
Normal file
12
src/js/composer/commands/keyCommands.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
export const keyCommands = {
|
||||||
|
label: "按键操作",
|
||||||
|
icon: "keyboard",
|
||||||
|
commands: [
|
||||||
|
{
|
||||||
|
value: "keyTap",
|
||||||
|
label: "模拟按键",
|
||||||
|
config: [],
|
||||||
|
component: "KeyEditor",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
49
src/js/composer/commands/networkCommands.js
Normal file
49
src/js/composer/commands/networkCommands.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
export const networkCommands = {
|
||||||
|
label: "网络操作",
|
||||||
|
icon: "language",
|
||||||
|
commands: [
|
||||||
|
{
|
||||||
|
value: "visit",
|
||||||
|
label: "用默认浏览器打开网址",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "url",
|
||||||
|
label: "要访问的网址链接",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "language",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "utools.ubrowser.goto",
|
||||||
|
label: "用ubrowser打开网址",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "url",
|
||||||
|
label: "要访问的网址链接",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "public",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
isAsync: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "ubrowser",
|
||||||
|
label: "ubrowser浏览器操作",
|
||||||
|
config: [],
|
||||||
|
component: "UBrowserEditor",
|
||||||
|
isAsync: true,
|
||||||
|
icon: "public",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "axios",
|
||||||
|
label: "HTTP请求(Axios)",
|
||||||
|
config: [],
|
||||||
|
component: "AxiosConfigEditor",
|
||||||
|
isAsync: true,
|
||||||
|
icon: "http",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
45
src/js/composer/commands/notifyCommands.js
Normal file
45
src/js/composer/commands/notifyCommands.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
export const notifyCommands = {
|
||||||
|
label: "消息通知",
|
||||||
|
icon: "notifications",
|
||||||
|
commands: [
|
||||||
|
{
|
||||||
|
value: "console.log",
|
||||||
|
label: "打印消息",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "message",
|
||||||
|
label: "要打印的消息文本",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "info",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "message",
|
||||||
|
label: "发送系统消息",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "message",
|
||||||
|
label: "要发送的系统消息文本",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "message",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "send",
|
||||||
|
label: "发送文本到活动窗口",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "text",
|
||||||
|
label: "要发送到窗口的文本内容",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "send",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
33
src/js/composer/commands/otherCommands.js
Normal file
33
src/js/composer/commands/otherCommands.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
export const otherCommands = {
|
||||||
|
label: "其他功能",
|
||||||
|
icon: "more_horiz",
|
||||||
|
commands: [
|
||||||
|
{
|
||||||
|
value: "utools.redirect",
|
||||||
|
label: "转至指定插件",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "pluginName",
|
||||||
|
label: "要跳转至的插件名称",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "alt_route",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "quickcommand.sleep",
|
||||||
|
label: "添加延时",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "ms",
|
||||||
|
label: "延迟的毫秒数",
|
||||||
|
type: "input",
|
||||||
|
inputType: "number",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "schedule",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
38
src/js/composer/commands/systemCommands.js
Normal file
38
src/js/composer/commands/systemCommands.js
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
export const systemCommands = {
|
||||||
|
label: "系统操作",
|
||||||
|
icon: "computer",
|
||||||
|
commands: [
|
||||||
|
{
|
||||||
|
value: "system",
|
||||||
|
label: "执行系统命令",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "command",
|
||||||
|
label: "要执行的命令行",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "terminal",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "copyTo",
|
||||||
|
label: "将内容写入剪贴板",
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
key: "content",
|
||||||
|
label: "要写入剪切板的内容",
|
||||||
|
type: "input",
|
||||||
|
defaultValue: "",
|
||||||
|
icon: "content_copy",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "electron.clipboard.readText",
|
||||||
|
label: "获取剪贴板内容",
|
||||||
|
config: [],
|
||||||
|
icon: "content_copy",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
@ -3,182 +3,4 @@ export {
|
|||||||
defaultUBrowserConfigs,
|
defaultUBrowserConfigs,
|
||||||
} from "./ubrowserConfig";
|
} from "./ubrowserConfig";
|
||||||
|
|
||||||
// 定义命令分类
|
export { commandCategories } from "./commands";
|
||||||
export const commandCategories = [
|
|
||||||
{
|
|
||||||
label: "文件操作",
|
|
||||||
icon: "folder",
|
|
||||||
commands: [
|
|
||||||
{
|
|
||||||
value: "open",
|
|
||||||
label: "打开文件/文件夹/软件",
|
|
||||||
desc: "文件、文件夹或软件的绝对路径",
|
|
||||||
icon: "folder_open",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "locate",
|
|
||||||
label: "在文件管理器中定位文件",
|
|
||||||
desc: "要在文件管理器里显示的文件路径",
|
|
||||||
icon: "location_on",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "网络操作",
|
|
||||||
icon: "language",
|
|
||||||
commands: [
|
|
||||||
{
|
|
||||||
value: "visit",
|
|
||||||
label: "用默认浏览器打开网址",
|
|
||||||
desc: "要访问的网址链接",
|
|
||||||
icon: "language",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "utools.ubrowser.goto",
|
|
||||||
label: "用ubrowser打开网址",
|
|
||||||
desc: "要访问的网址链接",
|
|
||||||
isAsync: true,
|
|
||||||
icon: "public",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "ubrowser",
|
|
||||||
label: "ubrowser浏览器操作",
|
|
||||||
desc: "配置ubrowser浏览器操作",
|
|
||||||
hasUBrowserEditor: true,
|
|
||||||
isAsync: true,
|
|
||||||
icon: "public",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "axios",
|
|
||||||
label: "HTTP请求(Axios)",
|
|
||||||
desc: "使用Axios发送HTTP请求",
|
|
||||||
hasAxiosEditor: true,
|
|
||||||
isAsync: true,
|
|
||||||
icon: "http",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "系统操作",
|
|
||||||
icon: "computer",
|
|
||||||
commands: [
|
|
||||||
{
|
|
||||||
value: "system",
|
|
||||||
label: "执行系统命令",
|
|
||||||
desc: "要执行的命令行",
|
|
||||||
icon: "terminal",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "copyTo",
|
|
||||||
label: "将内容写入剪贴板",
|
|
||||||
desc: "要写入剪切板的内容",
|
|
||||||
icon: "content_copy",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "electron.clipboard.readText",
|
|
||||||
label: "获取剪贴板内容",
|
|
||||||
desc: "获取剪贴板内容",
|
|
||||||
icon: "content_copy",
|
|
||||||
hasNoArgs: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "消息通知",
|
|
||||||
icon: "notifications",
|
|
||||||
commands: [
|
|
||||||
{
|
|
||||||
value: "console.log",
|
|
||||||
label: "打印消息",
|
|
||||||
desc: "要打印的消息文本",
|
|
||||||
icon: "info",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "message",
|
|
||||||
label: "发送系统消息",
|
|
||||||
desc: "要发送的系统消息文本",
|
|
||||||
icon: "message",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "send",
|
|
||||||
label: "发送文本到活动窗口",
|
|
||||||
desc: "要发送到窗口的文本内容",
|
|
||||||
icon: "send",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "编码解码",
|
|
||||||
icon: "code",
|
|
||||||
commands: [
|
|
||||||
{
|
|
||||||
value: "(text=>Buffer.from(text).toString('base64'))",
|
|
||||||
label: "Base64编码",
|
|
||||||
desc: "将文本编码为Base64",
|
|
||||||
icon: "lock",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "(text=>Buffer.from(text,'base64').toString())",
|
|
||||||
label: "Base64解码",
|
|
||||||
desc: "将Base64解码为文本",
|
|
||||||
icon: "lock_open",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "(text=>Buffer.from(text).toString('hex'))",
|
|
||||||
label: "十六进制编码",
|
|
||||||
desc: "将文本编码为十六进制",
|
|
||||||
icon: "lock",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "(text=>Buffer.from(text,'hex').toString())",
|
|
||||||
label: "十六进制解码",
|
|
||||||
desc: "将十六进制解码为文本",
|
|
||||||
icon: "lock_open",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "encodeURIComponent",
|
|
||||||
label: "URL编码",
|
|
||||||
desc: "将文本进行URL编码",
|
|
||||||
icon: "link",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "decodeURIComponent",
|
|
||||||
label: "URL解码",
|
|
||||||
desc: "将URL编码解码为文本",
|
|
||||||
icon: "link_off",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "其他功能",
|
|
||||||
icon: "more_horiz",
|
|
||||||
commands: [
|
|
||||||
{
|
|
||||||
value: "utools.redirect",
|
|
||||||
label: "转至指定插件",
|
|
||||||
desc: "要跳转至的插件名称",
|
|
||||||
icon: "alt_route",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "quickcommand.sleep",
|
|
||||||
label: "添加延时",
|
|
||||||
desc: "延迟的毫秒数",
|
|
||||||
inputType: "number",
|
|
||||||
icon: "schedule",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "按键操作",
|
|
||||||
icon: "keyboard",
|
|
||||||
commands: [
|
|
||||||
{
|
|
||||||
value: "keyTap",
|
|
||||||
label: "模拟按键",
|
|
||||||
desc: "模拟键盘按键",
|
|
||||||
hasKeyRecorder: true,
|
|
||||||
icon: "keyboard",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
@ -12,12 +12,12 @@ export function generateCode(commandFlow) {
|
|||||||
line += `let ${cmd.outputVariable} = `;
|
line += `let ${cmd.outputVariable} = `;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd.value === "ubrowser") {
|
let awaitCmd = cmd.isAsync ? "await " : "";
|
||||||
line += `await ${cmd.argv}`;
|
|
||||||
} else if (cmd.value === "axios" || cmd.value === "fetch") {
|
if (!!cmd.component) {
|
||||||
line += `await ${cmd.argv}`;
|
line += `${awaitCmd}${cmd.argv}`;
|
||||||
} else {
|
} else {
|
||||||
line += `${cmd.isAsync ? "await " : ""}${cmd.value}(${cmd.argv})`;
|
line += `${awaitCmd}${cmd.value}(${cmd.argv})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
code.push(line);
|
code.push(line);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user