feat: v1.2.0 新增网站配置管理功能

新功能:
- 后台管理新增'网站配置'菜单
- 支持配置:网站名称、副标题、备案号、联系邮箱、GitHub、页脚文字
- 前台页面自动读取配置显示
- 页脚支持备案号链接

配置存储在 data/config.json
This commit is contained in:
2026-04-11 02:27:21 +08:00
parent 7a2b1da9ff
commit 74be7688c9
4 changed files with 153 additions and 9 deletions

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ParamHub - 参数百科</title>
<title id="pageTitle">ParamHub - 参数百科</title>
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg">
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdn.jsdelivr.net/npm/remixicon@3.5.0/fonts/remixicon.css" rel="stylesheet">
@@ -14,8 +14,8 @@
<div class="max-w-7xl mx-auto px-4 py-3 flex justify-between items-center">
<div class="flex items-center gap-2">
<i class="ri-dashboard-3-line text-2xl text-indigo-600"></i>
<span class="text-xl font-bold text-gray-800">ParamHub</span>
<span class="text-sm text-gray-500">参数百科</span>
<span class="text-xl font-bold text-gray-800" id="navSiteName">ParamHub</span>
<span class="text-sm text-gray-500" id="navSiteSubtitle">参数百科</span>
</div>
<div class="flex gap-4 text-sm" id="navLinks">
<!-- 动态加载 -->
@@ -70,7 +70,7 @@
<!-- 页脚 -->
<footer class="bg-white border-t mt-8 py-6 text-center text-gray-500 text-sm">
ParamHub - 参数百科 | AI模型与硬件参数速查平台
<span id="footerText">ParamHub - 参数百科 | AI模型与硬件参数速查平台</span>
</footer>
<script>
@@ -121,13 +121,32 @@
// 加载分类和数据统计
async function loadData() {
// 并行加载分类统计
const [catRes, statsRes] = await Promise.all([
// 并行加载分类统计、配置
const [catRes, statsRes, configRes] = await Promise.all([
fetch('/api/categories'),
fetch('/api/stats')
fetch('/api/stats'),
fetch('/api/config')
]);
categories = await catRes.json();
const stats = await statsRes.json();
const config = await configRes.json();
// 更新网站名称等
if (config.site_name) {
document.getElementById('navSiteName').textContent = config.site_name;
}
if (config.site_subtitle) {
document.getElementById('navSiteSubtitle').textContent = config.site_subtitle;
}
if (config.site_name && config.site_subtitle) {
document.getElementById('pageTitle').textContent = `${config.site_name} - ${config.site_subtitle}`;
}
if (config.footer_text) {
document.getElementById('footerText').textContent = config.footer_text;
}
if (config.icp_number) {
document.getElementById('footerText').innerHTML += ` | <a href="https://beian.miit.gov.cn/" target="_blank" class="hover:text-gray-700">${config.icp_number}</a>`;
}
// 渲染导航栏
renderNavBar();