From ffdb737750f128320ed2c28727cbcc11c711834e Mon Sep 17 00:00:00 2001 From: fofolee Date: Fri, 20 Dec 2024 23:01:26 +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 | 20 +- src/components/ConfigurationMenu.vue | 765 -------------------- src/components/card/CommandCardContent.vue | 4 +- src/components/card/ControlButtons.vue | 14 +- src/components/menu/CommandManageMenu.vue | 87 +++ src/components/menu/EnvConfigMenu.vue | 77 ++ src/components/menu/PersonalizeMenu.vue | 208 ++++++ src/components/menu/UtilityFeaturesMenu.vue | 136 ++++ src/components/menu/index.vue | 152 ++++ src/css/app.css | 72 +- src/pages/ConfigurationPage.vue | 25 +- 11 files changed, 755 insertions(+), 805 deletions(-) delete mode 100644 src/components/ConfigurationMenu.vue create mode 100644 src/components/menu/CommandManageMenu.vue create mode 100644 src/components/menu/EnvConfigMenu.vue create mode 100644 src/components/menu/PersonalizeMenu.vue create mode 100644 src/components/menu/UtilityFeaturesMenu.vue create mode 100644 src/components/menu/index.vue diff --git a/src/components/CommandCard.vue b/src/components/CommandCard.vue index a58dd2b..d7c7698 100644 --- a/src/components/CommandCard.vue +++ b/src/components/CommandCard.vue @@ -16,15 +16,15 @@ v-model:isVisible="isWarpperHover" v-show="cardStyleVars.showButtons" :isActivated="isCommandActivated" + :isRunButtonVisible="canRunInConfigurationPage" :commandInfo="commandInfo" - :canRunAtCurrentOS="canRunAtCurrentOS" @commandChanged="$emit('commandChanged', $event)" /> @@ -57,17 +57,25 @@ export default { this.cardStyle.code > 1 ? "justify-start" : "justify-center", fontPosition: this.cardStyle.code > 1 ? "justify-end" : "justify-center", - hideCard: - this.cardStyle.code === 1 && - (!this.isCommandActivated || !this.$refs.controlButtons?.canRun), + hideCard: this.cardStyle.code === 1 && !this.canRunInConfigurationPage, }; }, - canRunAtCurrentOS() { + isPlatformSupported() { let { platform } = this.commandInfo.features; return !_.isEmpty(platform) && !platform.includes(window.processPlatform) ? false : true; }, + canRunInConfigurationPage() { + // 未启用 + if (!this.isCommandActivated) return false; + // 平台不支持 + if (!this.isPlatformSupported) return false; + let { cmds } = this.commandInfo.features; + // 窗口模式 + if (cmds[0].type && cmds[0].type === "window") return false; + return true; + }, }, props: { commandInfo: Object, diff --git a/src/components/ConfigurationMenu.vue b/src/components/ConfigurationMenu.vue deleted file mode 100644 index f37bca8..0000000 --- a/src/components/ConfigurationMenu.vue +++ /dev/null @@ -1,765 +0,0 @@ - - - - - diff --git a/src/components/card/CommandCardContent.vue b/src/components/card/CommandCardContent.vue index f59a9cd..b23a9da 100644 --- a/src/components/card/CommandCardContent.vue +++ b/src/components/card/CommandCardContent.vue @@ -41,7 +41,7 @@ @@ -81,7 +81,7 @@ export default { commandInfo: Object, isActivated: Boolean, cardStyleVars: Object, - canRunAtCurrentOS: Boolean, + isPlatformSupported: Boolean, isHovered: Boolean, }, emits: ["click"], diff --git a/src/components/card/ControlButtons.vue b/src/components/card/ControlButtons.vue index a8f4969..0e44d13 100644 --- a/src/components/card/ControlButtons.vue +++ b/src/components/card/ControlButtons.vue @@ -22,7 +22,7 @@ dense color="green" icon="play_arrow" - v-show="canRun" + v-show="isRunButtonVisible" @click="runCommand" > 运行 @@ -120,7 +120,7 @@ export default { isVisible: Boolean, isActivated: Boolean, commandInfo: Object, - canRunAtCurrentOS: Boolean, + isRunButtonVisible: Boolean, }, emits: ["update:isVisible", "commandChanged"], data() { @@ -134,16 +134,6 @@ export default { cronExp() { return this.$root.nativeProfile.crontabs[this.featureCode]; }, - // 命令是否可直接运行 - canRun() { - // 未启用 - if (!this.isActivated) return false; - if (!this.canRunAtCurrentOS) return false; - let { cmds } = this.commandInfo.features; - // 窗口模式 - if (cmds[0].type && cmds[0].type === "window") return false; - return true; - }, // 命令未启用可以添加计划任务 canAddCron() { return !!this.commandInfo.features.cmds[0].length; diff --git a/src/components/menu/CommandManageMenu.vue b/src/components/menu/CommandManageMenu.vue new file mode 100644 index 0000000..b1f0b37 --- /dev/null +++ b/src/components/menu/CommandManageMenu.vue @@ -0,0 +1,87 @@ + + + diff --git a/src/components/menu/EnvConfigMenu.vue b/src/components/menu/EnvConfigMenu.vue new file mode 100644 index 0000000..57cd94a --- /dev/null +++ b/src/components/menu/EnvConfigMenu.vue @@ -0,0 +1,77 @@ + + + diff --git a/src/components/menu/PersonalizeMenu.vue b/src/components/menu/PersonalizeMenu.vue new file mode 100644 index 0000000..de4d98e --- /dev/null +++ b/src/components/menu/PersonalizeMenu.vue @@ -0,0 +1,208 @@ + + + + + diff --git a/src/components/menu/UtilityFeaturesMenu.vue b/src/components/menu/UtilityFeaturesMenu.vue new file mode 100644 index 0000000..9ca39b1 --- /dev/null +++ b/src/components/menu/UtilityFeaturesMenu.vue @@ -0,0 +1,136 @@ + + + diff --git a/src/components/menu/index.vue b/src/components/menu/index.vue new file mode 100644 index 0000000..27b7baf --- /dev/null +++ b/src/components/menu/index.vue @@ -0,0 +1,152 @@ + + + diff --git a/src/css/app.css b/src/css/app.css index 846a176..0e95073 100644 --- a/src/css/app.css +++ b/src/css/app.css @@ -144,22 +144,6 @@ body { height: 100vh; } -.config-page-container { - position: relative; - height: 100vh; - width: 100%; - overflow: hidden; -} - -.background-layer { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - z-index: 0; -} - /* 毛玻璃效果叠加 */ body.glass-effect-menu .q-card.command { background: rgba(255, 255, 255, calc(0.3 + var(--glass-effect-strength) * 0.01)) !important; @@ -181,3 +165,59 @@ body.body--dark.glass-effect-menu .q-tabs { background: rgba(0, 0, 0, calc(0.2 + var(--glass-effect-strength) * 0.02)) !important; border-right: 1px solid rgba(255, 255, 255, 0.05); } + +/* 基础菜单样式 - 始终保持最小毛玻璃效果 */ +.q-menu { + background: rgba(255, 255, 255, 0.15) !important; + backdrop-filter: blur(5px) !important; + -webkit-backdrop-filter: blur(5px) !important; + border: 1px solid rgba(255, 255, 255, 0.1); + box-shadow: 0 4px 16px 0 rgba(31, 38, 135, 0.07); +} + +.body--dark .q-menu { + background: rgba(0, 0, 0, 0.2) !important; + border: 1px solid rgba(255, 255, 255, 0.05); +} + +/* 毛玻璃菜单效果 - 叠加用户设置的效果 */ +body.glass-effect-menu .q-menu { + background: rgba(255, + 255, + 255, + calc(0.15 + var(--glass-effect-strength) * 0.01)) !important; + backdrop-filter: blur(calc(5px + var(--glass-effect-strength) * 1px)) !important; + -webkit-backdrop-filter: blur(calc(5px + var(--glass-effect-strength) * 1px)) !important; +} + +/* 暗色模式菜单 */ +body.body--dark.glass-effect-menu .q-menu { + background: rgba(0, + 0, + 0, + calc(0.2 + var(--glass-effect-strength) * 0.02)) !important; +} + +/* 菜单列表透明背景 */ +.q-menu .q-list { + background: transparent !important; +} + +/* 菜单项浮效果 */ +.q-menu .q-item:hover { + background: rgba(255, 255, 255, 0.1) !important; +} + +.body--dark .q-menu .q-item:hover { + background: rgba(255, 255, 255, 0.05) !important; +} + +/* 输入框样式 */ +.q-menu .q-field__control { + background: rgba(255, 255, 255, 0.15) !important; + border-radius: 4px; +} + +.body--dark .q-menu .q-field__control { + background: rgba(0, 0, 0, 0.3) !important; +} diff --git a/src/pages/ConfigurationPage.vue b/src/pages/ConfigurationPage.vue index 119d2d0..e7da790 100644 --- a/src/pages/ConfigurationPage.vue +++ b/src/pages/ConfigurationPage.vue @@ -244,13 +244,11 @@ import changeLog from "js/options/changeLog.js"; import pinyinMatch from "pinyin-match"; import CommandCard from "components/CommandCard"; import CommandEditor from "components/CommandEditor"; +import ConfigurationMenu from "components/menu"; const CommandRunResult = defineAsyncComponent(() => import("components/CommandRunResult.vue") ); // Performance Rendering > 300ms -const ConfigurationMenu = defineAsyncComponent(() => - import("components/ConfigurationMenu.vue") -); // 默认命令 let defaultCommands = importAll(require.context("../json/", false, /\.json$/)); @@ -568,7 +566,10 @@ export default { this.getAllQuickCommandTags(); this.changeCurrentTag("默认"); quickcommand.showMessageBox( - "清空完毕,为防止误操作,已将所有命令复制到剪贴板,可通过导入命令恢复" + "清空完毕,为防止误操作,已将所有命令复制到剪贴板,可通过导入命令恢复", + "success", + 2000, + "bottom-right" ); }); }, @@ -655,6 +656,22 @@ export default {