From b9e38a85f8f108eb63fade45e106cf47f8eb2cbc Mon Sep 17 00:00:00 2001 From: lijiahangmax Date: Fri, 8 Dec 2023 22:23:13 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/store/modules/terminal/index.ts | 14 +- .../src/store/modules/terminal/types.ts | 7 - .../terminal/assets/styles/layout.less | 13 +- .../components/layout/terminal-content.vue | 7 +- .../components/layout/terminal-header.vue | 4 +- .../theme-setting/terminal-example.vue | 2 +- .../theme-setting/terminal-font-block.vue | 74 ++++++ .../theme-setting/terminal-theme-block.vue | 157 +++++++++++++ .../theme-setting/terminal-theme-setting.vue | 214 ------------------ .../theme-setting/terminal-view-setting.vue | 32 +++ .../src/views/host-ops/terminal/index.vue | 26 +-- .../host-ops/terminal/types/terminal.const.ts | 10 - 12 files changed, 292 insertions(+), 268 deletions(-) create mode 100644 orion-ops-ui/src/views/host-ops/terminal/components/theme-setting/terminal-font-block.vue create mode 100644 orion-ops-ui/src/views/host-ops/terminal/components/theme-setting/terminal-theme-block.vue delete mode 100644 orion-ops-ui/src/views/host-ops/terminal/components/theme-setting/terminal-theme-setting.vue create mode 100644 orion-ops-ui/src/views/host-ops/terminal/components/theme-setting/terminal-view-setting.vue diff --git a/orion-ops-ui/src/store/modules/terminal/index.ts b/orion-ops-ui/src/store/modules/terminal/index.ts index ad43bae7..ef158d43 100644 --- a/orion-ops-ui/src/store/modules/terminal/index.ts +++ b/orion-ops-ui/src/store/modules/terminal/index.ts @@ -1,11 +1,17 @@ import type { TerminalPreference, TerminalState, TerminalTheme } from './types'; -import { DarkTheme } from './types'; import { defineStore } from 'pinia'; import { getPreference, updatePreferencePartial } from '@/api/user/preference'; import { Message } from '@arco-design/web-vue'; import { useDark } from '@vueuse/core'; import { DEFAULT_SCHEMA } from '@/views/host-ops/terminal/types/terminal.theme'; +// 暗色主题 +export const DarkTheme = { + DARK: 'dark', + LIGHT: 'light', + AUTO: 'auto' +}; + export default defineStore('terminal', { state: (): TerminalState => ({ isDarkTheme: useDark({ @@ -50,15 +56,13 @@ export default defineStore('terminal', { }, // 更新终端偏好 - async updatePreference(preference: TerminalPreference) { + async updatePreference() { try { // 修改配置 await updatePreferencePartial({ type: 'TERMINAL', - config: preference + config: this.preference }); - this.preference = preference; - Message.success('同步成功'); } catch (e) { Message.error('同步失败'); } diff --git a/orion-ops-ui/src/store/modules/terminal/types.ts b/orion-ops-ui/src/store/modules/terminal/types.ts index da6409a3..d74015b2 100644 --- a/orion-ops-ui/src/store/modules/terminal/types.ts +++ b/orion-ops-ui/src/store/modules/terminal/types.ts @@ -11,13 +11,6 @@ export interface TerminalPreference { terminalTheme: TerminalTheme, } -// 暗色主题 -export const DarkTheme = { - DARK: 'dark', - LIGHT: 'light', - AUTO: 'auto' -}; - // 终端主题 export interface TerminalTheme { name: string; diff --git a/orion-ops-ui/src/views/host-ops/terminal/assets/styles/layout.less b/orion-ops-ui/src/views/host-ops/terminal/assets/styles/layout.less index b60852aa..907dc805 100644 --- a/orion-ops-ui/src/views/host-ops/terminal/assets/styles/layout.less +++ b/orion-ops-ui/src/views/host-ops/terminal/assets/styles/layout.less @@ -222,8 +222,19 @@ body[terminal-theme='dark'] .host-layout { margin-bottom: 18px; } + .terminal-setting-subtitle-wrapper { + display: flex; + justify-content: space-between; + align-items: flex-start; + } + .terminal-setting-subtitle { - margin: 0 0 16px 0; + margin: 0; color: var(--color-content-text-3); } + + .terminal-setting-body { + margin: 16px 0 24px 0; + } + } diff --git a/orion-ops-ui/src/views/host-ops/terminal/components/layout/terminal-content.vue b/orion-ops-ui/src/views/host-ops/terminal/components/layout/terminal-content.vue index c026a4b5..aad9e1ef 100644 --- a/orion-ops-ui/src/views/host-ops/terminal/components/layout/terminal-content.vue +++ b/orion-ops-ui/src/views/host-ops/terminal/components/layout/terminal-content.vue @@ -7,8 +7,8 @@ :title="tab.title">