From f284d5666f6b9a3606205a8bb301aa75d7d3a6b3 Mon Sep 17 00:00:00 2001 From: shaw Date: Mon, 8 Sep 2025 12:19:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=99=BB=E5=BD=95=E5=85=A5=E5=8F=A3=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/admin.js | 4 +- web/admin-spa/src/stores/settings.js | 2 + web/admin-spa/src/views/ApiStatsView.vue | 2 + web/admin-spa/src/views/SettingsView.vue | 191 ++++++++++++++++++++++- 4 files changed, 196 insertions(+), 3 deletions(-) diff --git a/src/routes/admin.js b/src/routes/admin.js index 90024d0a..b8db9666 100644 --- a/src/routes/admin.js +++ b/src/routes/admin.js @@ -5396,6 +5396,7 @@ router.get('/oem-settings', async (req, res) => { siteName: 'Claude Relay Service', siteIcon: '', siteIconData: '', // Base64编码的图标数据 + showAdminButton: true, // 是否显示管理后台按钮 updatedAt: new Date().toISOString() } @@ -5425,7 +5426,7 @@ router.get('/oem-settings', async (req, res) => { // 更新OEM设置 router.put('/oem-settings', authenticateAdmin, async (req, res) => { try { - const { siteName, siteIcon, siteIconData } = req.body + const { siteName, siteIcon, siteIconData, showAdminButton } = req.body // 验证输入 if (!siteName || typeof siteName !== 'string' || siteName.trim().length === 0) { @@ -5456,6 +5457,7 @@ router.put('/oem-settings', authenticateAdmin, async (req, res) => { siteName: siteName.trim(), siteIcon: (siteIcon || '').trim(), siteIconData: (siteIconData || '').trim(), // Base64数据 + showAdminButton: showAdminButton !== false, // 默认为true updatedAt: new Date().toISOString() } diff --git a/web/admin-spa/src/stores/settings.js b/web/admin-spa/src/stores/settings.js index a6d0ebfc..986ce327 100644 --- a/web/admin-spa/src/stores/settings.js +++ b/web/admin-spa/src/stores/settings.js @@ -8,6 +8,7 @@ export const useSettingsStore = defineStore('settings', () => { siteName: 'Claude Relay Service', siteIcon: '', siteIconData: '', + showAdminButton: true, // 控制管理后台按钮的显示 updatedAt: null }) @@ -64,6 +65,7 @@ export const useSettingsStore = defineStore('settings', () => { siteName: 'Claude Relay Service', siteIcon: '', siteIconData: '', + showAdminButton: true, updatedAt: null } diff --git a/web/admin-spa/src/views/ApiStatsView.vue b/web/admin-spa/src/views/ApiStatsView.vue index 3d4a4cf9..f26df4e5 100644 --- a/web/admin-spa/src/views/ApiStatsView.vue +++ b/web/admin-spa/src/views/ApiStatsView.vue @@ -17,6 +17,7 @@
@@ -31,6 +32,7 @@ diff --git a/web/admin-spa/src/views/SettingsView.vue b/web/admin-spa/src/views/SettingsView.vue index 689f7fa5..3fd7b3ad 100644 --- a/web/admin-spa/src/views/SettingsView.vue +++ b/web/admin-spa/src/views/SettingsView.vue @@ -147,6 +147,41 @@ + + + +
+
+ +
+
+
+ 管理入口 +
+
登录按钮显示
+
+
+ + +
+ +
+

+ 隐藏后,用户需要直接访问 /admin/login 页面登录 +

+ + + @@ -189,7 +224,148 @@
- + +
+
+
+ +
+
+

站点名称

+

自定义您的站点品牌名称

+
+
+ +
+ + +
+
+
+ +
+
+

站点图标

+

+ 上传自定义图标或输入图标URL +

+
+
+
+ +
+ 图标预览 + 当前图标 + +
+ + +
+ + +

+ 支持 .ico, .png, .jpg, .svg 格式,最大 350KB +

+
+
+
+ + +
+
+
+ +
+
+

管理入口

+

控制登录按钮在首页的显示

+
+
+
+ +

+ 隐藏后,用户需要直接访问 /admin/login 页面登录 +

+
+
+ + +
+
+ + + + +
+ + 上次更新: {{ formatDateTime(oemSettings.updatedAt) }} +
+
+
@@ -791,6 +967,16 @@ const isMounted = ref(true) // API请求取消控制器 const abortController = ref(new AbortController()) +// 计算属性:隐藏管理后台按钮(反转 showAdminButton 的值) +const hideAdminButton = computed({ + get() { + return !oemSettings.value.showAdminButton + }, + set(value) { + oemSettings.value.showAdminButton = !value + } +}) + // URL 验证状态 const urlError = ref(false) const urlValid = ref(false) @@ -1286,7 +1472,8 @@ const saveOemSettings = async () => { const settings = { siteName: oemSettings.value.siteName, siteIcon: oemSettings.value.siteIcon, - siteIconData: oemSettings.value.siteIconData + siteIconData: oemSettings.value.siteIconData, + showAdminButton: oemSettings.value.showAdminButton } const result = await settingsStore.saveOemSettings(settings) if (result && result.success) {