From 4231928f9f33fd3a3e8b9bda461f9de2940fc0e1 Mon Sep 17 00:00:00 2001 From: anghunk Date: Mon, 2 Feb 2026 16:42:03 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E6=B7=BB=E5=8A=A0=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E6=98=BE=E7=A4=BA=E8=AE=BE=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增后台显示设置页面,允许自定义布局标题 - 在布局组件中动态显示自定义标题 - 在后端添加对应的 API 端点用于获取和保存显示配置 - 移除无用的 Demo.vue 组件文件 --- cwd-admin/src/api/admin.ts | 14 ++++ cwd-admin/src/styles/components/setting.less | 4 + cwd-admin/src/views/LayoutView/index.vue | 15 +++- .../views/SettingsView/components/Demo.vue | 0 cwd-admin/src/views/SettingsView/index.vue | 75 ++++++++++++++++--- cwd-api/src/index.ts | 66 ++++++++++++++++ 6 files changed, 161 insertions(+), 13 deletions(-) delete mode 100644 cwd-admin/src/views/SettingsView/components/Demo.vue diff --git a/cwd-admin/src/api/admin.ts b/cwd-admin/src/api/admin.ts index 5e7afc8..2ed5d92 100644 --- a/cwd-admin/src/api/admin.ts +++ b/cwd-admin/src/api/admin.ts @@ -128,6 +128,10 @@ export type FeatureSettingsResponse = { enableArticleLike: boolean; }; +export type AdminDisplaySettingsResponse = { + layoutTitle: string | null; +}; + export async function loginAdmin(name: string, password: string): Promise { const res = await post('/admin/login', { name, password }); const key = res.data.key; @@ -327,6 +331,16 @@ export function saveFeatureSettings(data: { enableCommentLike?: boolean; enableA return put<{ message: string }>('/admin/settings/features', data); } +export function fetchAdminDisplaySettings(): Promise { + return get('/admin/settings/admin-display'); +} + +export function saveAdminDisplaySettings(data: { + layoutTitle?: string; +}): Promise<{ message: string }> { + return put<{ message: string }>('/admin/settings/admin-display', data); +} + export type TelegramSettingsResponse = { botToken: string | null; chatId: string | null; diff --git a/cwd-admin/src/styles/components/setting.less b/cwd-admin/src/styles/components/setting.less index 2e52f6d..e142f84 100644 --- a/cwd-admin/src/styles/components/setting.less +++ b/cwd-admin/src/styles/components/setting.less @@ -1,3 +1,7 @@ +h1 { + color: red; +} + .page { display: flex; flex-direction: column; diff --git a/cwd-admin/src/views/LayoutView/index.vue b/cwd-admin/src/views/LayoutView/index.vue index aff4103..8195515 100644 --- a/cwd-admin/src/views/LayoutView/index.vue +++ b/cwd-admin/src/views/LayoutView/index.vue @@ -9,7 +9,7 @@ > -
CWD 评论系统
+
{{ layoutTitle }}