From 924885e0387fa0ed8ae55c9e73f3aba50a0be2f2 Mon Sep 17 00:00:00 2001 From: jayhgq Date: Wed, 10 Jun 2026 14:49:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=A1=B5=E8=84=9A?= =?UTF-8?q?=E5=92=8CICP=E5=A4=87=E6=A1=88=E4=BF=A1=E6=81=AF=E5=88=B0?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE=E5=92=8C=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 新增页脚信息和ICP备案信息的系统配置项 2. 开放公开接口获取新增的系统设置项 3. 在管理端布局添加页脚和ICP备案展示 --- backend/auth/apps/settings/urls.py | 11 +++-- backend/auth/init_data.py | 12 +++++ .../src/modules/admin/layout/AdminLayout.vue | 44 +++++++++++++++++++ 3 files changed, 63 insertions(+), 4 deletions(-) diff --git a/backend/auth/apps/settings/urls.py b/backend/auth/apps/settings/urls.py index f2385c8..2ccab61 100644 --- a/backend/auth/apps/settings/urls.py +++ b/backend/auth/apps/settings/urls.py @@ -73,18 +73,21 @@ async def get_public_setting( key: str = None, db: AsyncSession = Depends(get_db), ): - """公开接口:获取系统设置(仅允许获取id为1或key为"系统标题"的内容)""" + """公开接口:获取系统设置(允许获取id为1/2或key为"系统标题"/"IPC内容"的内容)""" + ALLOWED_IDS = {1, 2, 3} + ALLOWED_KEYS = {"系统标题", "页脚信息", "IPC信息"} + if setting_id is not None: - if setting_id != 1: + if setting_id not in ALLOWED_IDS: raise HTTPException(status_code=403, detail="无权访问该设置项") result = await db.execute(select(SystemSetting).filter(SystemSetting.id == setting_id)) elif key is not None: - if key != "系统标题": + if key not in ALLOWED_KEYS: raise HTTPException(status_code=403, detail="无权访问该设置项") result = await db.execute(select(SystemSetting).filter(SystemSetting.key == key)) else: raise HTTPException(status_code=400, detail="必须提供setting_id或key参数") - + setting = result.scalar_one_or_none() if not setting: raise HTTPException(status_code=404, detail="设置项不存在") diff --git a/backend/auth/init_data.py b/backend/auth/init_data.py index e29ac0c..d5e648b 100644 --- a/backend/auth/init_data.py +++ b/backend/auth/init_data.py @@ -349,6 +349,18 @@ async def init_system_settings(db: AsyncSession): "type": "string", "description": "系统显示标题" }, + { + "key": "页脚信息", + "value": "© 2026 图书管理系统 版权所有 | 技术支持:强蕊科技", + "type": "string", + "description": "页脚信息" + }, + { + "key": "ICP信息", + "value": "京ICP备2023000000号", + "type": "string", + "description": "ICP备案信息" + } ] # 检查现有系统设置 diff --git a/frontend/src/modules/admin/layout/AdminLayout.vue b/frontend/src/modules/admin/layout/AdminLayout.vue index 0bdab64..5d151bb 100644 --- a/frontend/src/modules/admin/layout/AdminLayout.vue +++ b/frontend/src/modules/admin/layout/AdminLayout.vue @@ -53,6 +53,13 @@
+ + @@ -70,6 +77,8 @@ const route = useRoute(); const router = useRouter(); const auth = useAuthStore(); const sysTitle = ref(""); +const footerInfo = ref(""); +const ipcContent = ref(""); const active = computed(() => route.path); const pageTitle = computed(() => (route.meta.title as string) || ""); @@ -98,9 +107,35 @@ async function getSysTitle() { } } +async function getfooterInfo() { + try { + const baseURL = import.meta.env.VITE_API_BASE || "/api"; + let res = await axios.get(`${baseURL}/settings/public?setting_id=2`) + if (res.data) { + footerInfo.value = res.data.value; + } + } catch { + // 脚注内容加载失败不影响页面正常显示 + } +} + +async function getipcContent() { + try { + const baseURL = import.meta.env.VITE_API_BASE || "/api"; + let res = await axios.get(`${baseURL}/settings/public?setting_id=3`) + if (res.data) { + ipcContent.value = res.data.value; + } + } catch { + // IPC内容加载失败不影响页面正常显示 + } +} + onMounted(async () => { try { await getSysTitle(); + await getfooterInfo(); + await getipcContent(); if (!auth.user) { await auth.fetchProfile(); } @@ -166,4 +201,13 @@ async function onLogout() { flex-direction: column; min-width: 0; } +.footer { + flex-shrink: 0; + margin-top: auto; + padding: 12px 0; + text-align: center; + font-size: 13px; + color: #94a3b8; + border-top: 1px solid #e2e8f0; +}