From fef0a08940d608a22650128e1e6f5a482455044b Mon Sep 17 00:00:00 2001 From: fofolee Date: Mon, 4 Apr 2022 21:58:01 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=8F=9C=E5=8D=95=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CommandCard.vue | 4 +- src/components/ConfigurationMenu.vue | 215 +++++++++++++++++++++++++++ src/pages/ConfigurationPage.vue | 185 ++++------------------- 3 files changed, 251 insertions(+), 153 deletions(-) create mode 100644 src/components/ConfigurationMenu.vue diff --git a/src/components/CommandCard.vue b/src/components/CommandCard.vue index a49c295..df3100c 100644 --- a/src/components/CommandCard.vue +++ b/src/components/CommandCard.vue @@ -22,6 +22,7 @@ - + 导出 @@ -55,6 +56,7 @@ v-if="canCommandEdit" flat round + dense color="red" icon="close" @click="removeCommand" diff --git a/src/components/ConfigurationMenu.vue b/src/components/ConfigurationMenu.vue new file mode 100644 index 0000000..9397dee --- /dev/null +++ b/src/components/ConfigurationMenu.vue @@ -0,0 +1,215 @@ + + + diff --git a/src/pages/ConfigurationPage.vue b/src/pages/ConfigurationPage.vue index 28f79f1..a702f70 100644 --- a/src/pages/ConfigurationPage.vue +++ b/src/pages/ConfigurationPage.vue @@ -145,129 +145,20 @@ + /> - - - - - - - - - 导入 - - - - - - - 从文件导入 - - - - - - 从剪贴板导入 - - - - - - - - - - 全部导出 - - - - - - - 批处理 - - - - - - - 启用本页所有命令 - - - - - - 禁用本页所有命令 - - - - - - - - - - 取消收藏 - - - - - - 收藏标签 - 收藏后,会将当前标签名作为全局关键字,可在 uTools - 的主输入框进行搜索
- 搜索进入后,默认进入当前标签的面板视图
- 类似于旧版本的「快捷面板」
-
- - - - - - 帮助 - - - - - - 清空数据 - -
+ + @@ -324,9 +215,10 @@ import quickcommandParser from "../js/quickcommandParser.js"; import CommandCard from "components/CommandCard"; import CommandEditor from "components/CommandEditor.vue"; +import ConfigurationMenu from "components/ConfigurationMenu.vue"; export default { - components: { CommandCard, CommandEditor }, + components: { CommandCard, CommandEditor, ConfigurationMenu }, data() { return { currentTag: "默认", @@ -336,7 +228,7 @@ export default { allQuickCommands: [], commandSearchKeyword: "", isCommandEditorShow: false, - maximizedToggle:true, + maximizedToggle: true, commandEditorAction: {}, footerBarHeight: "40px", commandCardStyle: "normal", @@ -528,32 +420,27 @@ export default { data: "导入未完成!", success: false, }; - let dataToPushed = quickcommandParser(quickCommandInfo); - if (!dataToPushed) + let parsedData = quickcommandParser(quickCommandInfo); + if (!parsedData) return { data: "格式错误", success: false, }; // 单个命令导入 - if (dataToPushed.single) { - this.$utools.putDB( - dataToPushed.qc, - this.$utools.DBPRE.QC + dataToPushed.qc.features.code - ); - this.allQuickCommands[dataToPushed.qc.features.code] = dataToPushed.qc; - // 多个命令导入 + let dataToPushed = {}; + if (parsedData.single) { + dataToPushed[parsedData.qc.features.code] = parsedData.qc; + // 多个 } else { - for (var code of Object.keys(dataToPushed.qc)) { - this.$utools.putDB( - dataToPushed.qc[code], - this.$utools.DBPRE.QC + code - ); - } - Object.assign(this.allQuickCommands, dataToPushed.qc); + dataToPushed = parsedData.qc; } + for (var code of Object.keys(dataToPushed)) { + this.$utools.putDB(dataToPushed[code], this.$utools.DBPRE.QC + code); + } + Object.assign(this.allQuickCommands, dataToPushed); return { success: true, - data: dataToPushed, + data: parsedData, }; }, // 导入命令且定位 @@ -570,7 +457,15 @@ export default { this.currentTag = !tags || !tags.length ? "未分类" : tags[0]; // 等待 dom 渲染 this.$nextTick(() => { - document.getElementById(code).scrollIntoViewIfNeeded(); + let el = document.getElementById(code); + el.scrollIntoViewIfNeeded(); + // 闪一下 + el.style.filter = "invert(1) drop-shadow(1px 1px 5px #0000008e)"; + el.style.transform = "translateY(-5px)"; + setTimeout(() => { + el.style.filter = ""; + el.style.transform = ""; + }, 500); }); }, // 全部导出 @@ -649,20 +544,6 @@ export default { if (this.currentTag !== this.lastTag) this.currentTag = this.lastTag; } }, - // 启用全部 - enableAllCommands() { - // dom 操作 - document - .querySelectorAll(".q-toggle[aria-checked='false']") - .forEach((x) => x.click()); - }, - // 禁用全部 - disableAllCommands() { - // dom 操作 - document - .querySelectorAll(".q-toggle[aria-checked='true']") - .forEach((x) => x.click()); - }, // 新建命令 addNewCommand() { this.commandEditorAction = {