From bed448297b517627add2ca9ca4a27a65fa8bbbaf Mon Sep 17 00:00:00 2001 From: anghunk Date: Fri, 6 Feb 2026 17:29:33 +0800 Subject: [PATCH] =?UTF-8?q?refactor(settings):=20=E6=8F=90=E5=8F=96=20TagI?= =?UTF-8?q?nput=20=E7=BB=84=E4=BB=B6=E4=BB=A5=E5=A4=8D=E7=94=A8=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E8=BE=93=E5=85=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将设置页面的允许域名、IP 黑名单和邮箱黑名单的标签输入逻辑提取为独立的 TagInput 组件,消除重复代码并提高可维护性。同时将页面容器类名从 `.page` 重命名为 `.settings-content` 以更语义化。 --- cwd-admin/src/components/TagInput.vue | 157 ++++++++++++++ cwd-admin/src/styles/components/setting.less | 79 +------ cwd-admin/src/views/SettingsView/index.vue | 209 +------------------ 3 files changed, 163 insertions(+), 282 deletions(-) create mode 100644 cwd-admin/src/components/TagInput.vue diff --git a/cwd-admin/src/components/TagInput.vue b/cwd-admin/src/components/TagInput.vue new file mode 100644 index 0000000..5f82b33 --- /dev/null +++ b/cwd-admin/src/components/TagInput.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/cwd-admin/src/styles/components/setting.less b/cwd-admin/src/styles/components/setting.less index e27dcd0..1c78439 100644 --- a/cwd-admin/src/styles/components/setting.less +++ b/cwd-admin/src/styles/components/setting.less @@ -1,4 +1,4 @@ -.page { +.settings-content { max-width: 620px; } @@ -69,83 +69,6 @@ box-shadow: 0 0 0 1px rgba(9, 105, 218, 0.2); } -.tag-input { - padding: 4px 6px; - border-radius: 4px; - border: 1px solid var(--border-color); - background-color: var(--bg-input); -} - -.tag-input-inner { - display: flex; - flex-wrap: wrap; - gap: 6px; -} - -.tag-input-tag { - display: inline-flex; - align-items: center; - max-width: 100%; - padding: 2px 8px; - border-radius: 999px; - background-color: var(--bg-sider); - color: var(--text-primary); - font-size: 13px; - position: relative; -} - -.tag-input-tag-text { - max-width: 180px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.tag-input-tag-remove { - border: none; - padding: 0; - background: none; - cursor: pointer; - color: var(--text-secondary); - font-size: 12px; - opacity: 0; - visibility: hidden; - position: absolute; - left: 50%; - top: 50%; - transform: translate(-50%, -50%); - width: 100%; - height: 100%; - display: inline-flex; - align-items: center; - justify-content: center; -} - -.tag-input-tag-remove:hover { - color: var(--color-danger); -} - -.tag-input-tag:hover .tag-input-tag-text { - opacity: 0; - visibility: hidden; -} - -.tag-input-tag:hover .tag-input-tag-remove { - opacity: 1; - visibility: visible; -} - -.tag-input-input { - flex: 1; - min-width: 120px; - border: none; - outline: none; - background: transparent; - padding: 4px 2px; - font-size: 14px; - color: var(--text-primary); -} - .switch { position: relative; display: inline-flex; diff --git a/cwd-admin/src/views/SettingsView/index.vue b/cwd-admin/src/views/SettingsView/index.vue index b8faf77..e45cdec 100644 --- a/cwd-admin/src/views/SettingsView/index.vue +++ b/cwd-admin/src/views/SettingsView/index.vue @@ -61,7 +61,7 @@ -
+