diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 79eb0a0..234bb17 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -35,6 +35,7 @@ watch( + diff --git a/frontend/src/admin/SettingsView.vue b/frontend/src/admin/SettingsView.vue index 840bbc2..26d1555 100644 --- a/frontend/src/admin/SettingsView.vue +++ b/frontend/src/admin/SettingsView.vue @@ -11,6 +11,30 @@ const error = ref('') const saving = ref(false) const savedAt = ref('') +// ---------- 社交链接(settings.social_links <-> 多行文本) ---------- +// 文本框里每行一条「名称 | 链接」;数组存后端,文本框给人编辑。 +const socialText = ref('') + +function socialToText(ls) { + return (Array.isArray(ls) ? ls : []) + .filter((l) => l && l.label && l.url) + .map((l) => `${l.label} | ${l.url}`) + .join('\n') +} + +function textToSocial(text) { + return String(text || '') + .split('\n') + .map((line) => { + const i = line.indexOf('|') + if (i < 0) return null + const label = line.slice(0, i).trim() + const url = line.slice(i + 1).trim() + return label && url ? { label, url } : null + }) + .filter(Boolean) +} + // 这里只能选亮色皮肤(paper / sage / rose)。暗色端固定 ink,由访客在前台 // 右下角 ThemeSwitcher 切到「深色」或「自动 + 系统暗」时启用。 const lightSkins = [ @@ -122,6 +146,7 @@ async function load() { if (!UI_CONSTANTS.UIS.includes(settings.value.ui_id)) { settings.value.ui_id = UI_CONSTANTS.DEFAULT } + socialText.value = socialToText(settings.value.social_links) // 服务端保证非 null,这里再兜一层,并预建分区键, // 这样 v-model 绑定的文本框一开始就有值可写。 if (!settings.value.custom_css || typeof settings.value.custom_css !== 'object') { @@ -145,8 +170,10 @@ async function save() { saving.value = true error.value = '' try { + settings.value.social_links = textToSocial(socialText.value) const s = await adminApi.saveSettings(settings.value) settings.value = s + socialText.value = socialToText(s.social_links) // 保存后服务端会丢掉空的/超长的分区,重新补齐本地键,免得输入框失焦 if (!settings.value.custom_css || typeof settings.value.custom_css !== 'object') { settings.value.custom_css = {} @@ -355,6 +382,34 @@ async function save() { +
+ + +

+ 显示在经典版左栏「社交账号」和右栏页脚小字区。链接按域名自动配图标 + (GitHub / Telegram / X / 邮箱等),没有图标的显示名称文字。 +

+
+
+ + +

+ 贴完整的 <script> 片段(Google Analytics / Plausible / Umami 等), + 会在前台每个页面的 <head> 里执行,后台不注入。保存后刷新前台生效。 +

+
@@ -433,4 +488,11 @@ async function save() { font-size: 12px; color: var(--admin-muted); } + +.field-hint { + margin: 6px 0 0; + font-size: 12px; + line-height: 1.7; + color: var(--admin-muted); +} \ No newline at end of file diff --git a/frontend/src/components/LeftNav.vue b/frontend/src/components/LeftNav.vue index 0480320..37a8975 100644 --- a/frontend/src/components/LeftNav.vue +++ b/frontend/src/components/LeftNav.vue @@ -1,24 +1,14 @@