4 Commits

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

配置存储在 data/config.json
2026-04-11 02:27:21 +08:00
7a2b1da9ff fix: 后台管理显示全部数据,包括隐藏的
- 分类API添加all=1参数
- 动态分类数据API添加all=1参数
- 动态分类表格增加显示开关列
- 所有表格的眼睛按钮添加title提示
- 隐藏数据用灰色背景/透明度区分
- showRawData支持动态分类数据
2026-04-11 02:12:55 +08:00
dfd7234fd6 fix: 修复模型排序错误,改名为大模型管理
- 修复智能添加创建的不完整数据导致排序错误
- 添加安全排序函数处理缺失字段
- 改名:模型管理 → 大模型管理
- 清理测试数据
2026-04-11 02:06:06 +08:00
22b1a78132 fix: 修复后台管理页面JS语法错误(getCategoryForm重复) 2026-04-11 02:00:20 +08:00
6 changed files with 208 additions and 38 deletions

54
app.py
View File

@@ -25,6 +25,7 @@ GPUS_FILE = DATA_DIR / 'gpus.json'
CPUS_FILE = DATA_DIR / 'cpus.json'
CATEGORIES_FILE = DATA_DIR / 'categories.json'
KNOWLEDGE_FILE = DATA_DIR / 'knowledge.json'
CONFIG_FILE = DATA_DIR / 'config.json'
# 大模型配置
LLM_CONFIG = {
@@ -33,6 +34,27 @@ LLM_CONFIG = {
'model': 'auto',
}
# 默认网站配置
DEFAULT_CONFIG = {
'site_name': 'ParamHub',
'site_subtitle': '参数百科',
'footer_text': 'ParamHub - AI大模型与硬件参数速查平台',
'icp_number': '',
'copyright_year': '2024',
'contact_email': '',
'github_url': '',
}
def load_config():
"""加载网站配置"""
if CONFIG_FILE.exists():
return json.loads(CONFIG_FILE.read_text(encoding='utf-8'))
return DEFAULT_CONFIG.copy()
def save_config(config):
"""保存网站配置"""
CONFIG_FILE.write_text(json.dumps(config, ensure_ascii=False, indent=2), encoding='utf-8')
def load_data(file_path):
"""加载JSON数据"""
if file_path.exists():
@@ -245,11 +267,18 @@ def api_models():
keyword in m.get('organization', '').lower()]
# 排序
sort_by = request.args.get('sort', 'name')
sort_by = request.args.get('sort', 'created_at')
reverse = request.args.get('order', 'asc') == 'desc'
if sort_by in ['name', 'parameters', 'context_length', 'mmlu']:
models = sorted(models, key=lambda x: x.get(sort_by, 0) or 0, reverse=reverse)
# 安全排序处理可能的None/缺失值
def safe_sort_key(x, key):
val = x.get(key)
if val is None:
return 0 if key in ['parameters', 'context_length', 'mmlu'] else ''
return val
if sort_by in ['name', 'parameters', 'context_length', 'mmlu', 'created_at']:
models = sorted(models, key=lambda x: safe_sort_key(x, sort_by), reverse=reverse)
return jsonify(models)
@@ -856,9 +885,26 @@ def api_toggle_item_visible(category_id, item_id):
return jsonify({'success': True, 'visible': item['visible']})
# ============ 网站配置API ============
@app.route('/api/config')
def api_get_config():
"""获取网站配置"""
return jsonify(load_config())
@app.route('/api/config', methods=['PUT'])
def api_update_config():
"""更新网站配置"""
data = request.get_json()
config = load_config()
config.update(data)
config['updated_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
save_config(config)
return jsonify(config)
if __name__ == '__main__':
print("=" * 50)
print("ParamHub - 参数百科 v1.1.0")
print("ParamHub - 参数百科 v1.2.0")
print("=" * 50)
print(f"访问地址: http://localhost:19010")
print(f"后台管理: http://localhost:19010/admin")

View File

@@ -29,7 +29,8 @@
"icon": "ri-smartphone-line",
"color": "orange",
"description": "各品牌手机参数规格",
"order": 4
"order": 4,
"visible": false
},
{
"id": "laptops",

View File

@@ -7,5 +7,28 @@
"category_id": "021dc76d36be",
"id": "3d20dbcd4bdd",
"created_at": "2026-04-09 10:09:56"
},
{
"name": "秦PLUS",
"brand": "比亚迪",
"price": 5.98,
"specs": {
"长宽高": "4780*1837*1515mm",
"轴距": "2718mm",
"前轮距": "1580mm",
"后轮距": "1590mm",
"轮胎规格": "225/60 R16",
"发动机": "1.5L 101马力 L4",
"最大功率": "74kW",
"最大扭矩": "126N·m",
"变速器": "E-CVT无级变速器",
"中控屏幕尺寸": "10.1英寸"
},
"description": "秦PLUS是一款外观设计极具现代感和运动气息的车型采用家族化设计语言配备大尺寸进气格栅和锐利LED大灯。车身线条流畅内饰简洁大气配备10.1英寸中控屏和语音识别系统。搭载1.5L发动机和E-CVT变速器提供平稳动力输出和低油耗。内部空间宽敞座椅舒适支持多种调节功能。",
"id": "b78fc7983a70",
"category_id": "021dc76d36be",
"created_at": "2026-04-11 02:03:45",
"visible": true,
"raw_text": "秦PLUS的外观设计极具现代感和运动气息前脸采用了家族化设计语言标志性的大尺寸进气格栅占据了前脸的大部分空间搭配锐利的LED大灯组营造出强烈的视觉冲击力。车身线条流畅腰线从车头贯穿至车尾增强了整车的运动感。车尾部分简洁大方的设计与前脸相呼应整体风格时尚而不失稳重。\n\n上海秦PLUS优惠促销最新报价5.98万!轻松开新车\n\n秦PLUS拥有4780*1837*1515mm的长宽高尺寸和2718mm的轴距赋予其宽敞的内部空间。车侧线条流畅且动感十足从前轮距1580mm到后轮距1590mm车轮布局合理增强了车辆的稳定性和操控性。配备的225/60 R16轮胎规格匹配独特风格的轮圈为车辆增添了一抹动感与时尚的气息。\n\n上海秦PLUS优惠促销最新报价5.98万!轻松开新车\n\n秦PLUS的内饰风格简洁大气给人以科技感和舒适感。中控台布局合理配备了10.1英寸的中控屏幕支持语音识别控制系统可轻松操作多媒体系统、导航、电话和空调等功能。方向盘采用皮质材料手感舒适支持手动上下和前后调节方便驾驶员调整到最佳驾驶姿势。座椅采用仿皮材质主驾驶座椅具备前后调节、靠背调节和高低调节功能而副驾驶座椅则支持前后调节和靠背调节确保了乘客的舒适度。后排座椅可以按比例放倒增加储物空间同时车内还配备了USB和Type-C接口方便乘客为电子设备充电。\n\n上海秦PLUS优惠促销最新报价5.98万!轻松开新车\n\n秦PLUS搭载了一台1.5L 101马力的L4发动机最大功率为74kW最大扭矩为126N·m。与之匹配的是E-CVT无级变速器这使得车辆在提供平稳的动力输出的同时还能有效降低油耗。\n\n汽车之家车主@天艺风云 表示外观设计是他当初选择秦PLUS的原因之一。他赞赏整体造型时尚大气龙脸设计搭配犀利的大灯辨识度极高。车身线条流畅溜背式造型增添了几分运动感。全新的“龙鳞辉熠”格栅精致又霸气每次停车都有人问这是什么车外观确实很吸引人。"
}
]

View File

@@ -189,12 +189,7 @@
"is_open_source": false,
"license": "Proprietary",
"description": "智谱AI大模型中文能力强",
"created_at": "2024-01-01"
},
{
"id": "15246152c91e",
"created_at": "2026-04-11 01:54:26",
"visible": true,
"raw_text": "test"
"created_at": "2024-01-01",
"visible": true
}
]

View File

@@ -5,7 +5,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ParamHub - 参数百科</title>
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg">
<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">
<style>
@@ -53,6 +52,49 @@
</div>
</section>
<!-- 网站配置 -->
<section id="section-config" class="hidden">
<h1 class="text-2xl font-bold text-gray-800 mb-6">网站配置</h1>
<div class="bg-white rounded-xl shadow-sm p-6">
<form id="configForm" class="space-y-6">
<div class="grid grid-cols-2 gap-6">
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">网站名称</label>
<input type="text" name="site_name" id="config_site_name" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="ParamHub">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">网站副标题</label>
<input type="text" name="site_subtitle" id="config_site_subtitle" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="参数百科">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">备案号</label>
<input type="text" name="icp_number" id="config_icp_number" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="如京ICP备12345678号">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">联系邮箱</label>
<input type="email" name="contact_email" id="config_contact_email" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="admin@example.com">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">GitHub地址</label>
<input type="url" name="github_url" id="config_github_url" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="https://github.com/...">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">版权年份</label>
<input type="text" name="copyright_year" id="config_copyright_year" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="2024">
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">页脚文字</label>
<textarea name="footer_text" id="config_footer_text" rows="3" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="网站底部的版权信息等"></textarea>
</div>
<div class="flex justify-end gap-4">
<button type="button" onclick="loadSiteConfig()" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300"><i class="ri-refresh-line mr-1"></i>重置</button>
<button type="button" onclick="saveSiteConfig()" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700"><i class="ri-save-line mr-1"></i>保存配置</button>
</div>
</form>
</div>
</section>
<!-- 分类管理 -->
<section id="section-categories" class="hidden">
<div class="flex justify-between items-center mb-6">
@@ -90,10 +132,10 @@
</div>
</section>
<!-- 模型管理 -->
<!-- 模型管理 -->
<section id="section-models" class="hidden">
<div class="flex justify-between items-center mb-6">
<h1 class="text-2xl font-bold text-gray-800">模型管理</h1>
<h1 class="text-2xl font-bold text-gray-800">模型管理</h1>
<div class="flex gap-2">
<button onclick="openSmartAddModal('model')" class="px-4 py-2 bg-orange-600 text-white rounded-lg hover:bg-orange-700"><i class="ri-magic-line mr-2"></i>智能添加</button>
<button onclick="openAddModal('model')" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700"><i class="ri-add-line mr-2"></i>手动添加</button>
@@ -327,12 +369,13 @@ GPT-4是OpenAI发布的大语言模型参数量约1.8万亿支持128K上
function renderSidebar() {
const fixedItems = [
{id: 'overview', name: '概览', icon: 'ri-home-4-line'},
{id: 'config', name: '网站配置', icon: 'ri-settings-3-line'},
{id: 'categories', name: '分类管理', icon: 'ri-folder-line'},
];
// 内置分类映射
const builtinMap = {
'ai-models': {id: 'models', name: '模型管理', icon: 'ri-robot-line'},
'ai-models': {id: 'models', name: '模型管理', icon: 'ri-robot-line'},
'gpus': {id: 'gpus', name: 'GPU管理', icon: 'ri-cpu-line'},
'cpus': {id: 'cpus', name: 'CPU管理', icon: 'ri-cpu-line'}
};
@@ -396,21 +439,28 @@ GPT-4是OpenAI发布的大语言模型参数量约1.8万亿支持128K上
document.getElementById('dynamic-title').textContent = cat.name + '管理';
// 加载该分类的数据
const res = await fetch(`/api/items/${categoryId}`);
// 加载该分类的数据(后台显示全部,包括隐藏的)
const res = await fetch(`/api/items/${categoryId}?all=1`);
const items = await res.json();
if (items.length === 0) {
document.getElementById('admin-dynamic-table').innerHTML = '<tr><td class="text-center text-gray-400 py-8">暂无数据,点击上方"添加数据"按钮添加</td></tr>';
} else {
const keys = Object.keys(items[0]).filter(k => !['id', 'created_at', 'updated_at'].includes(k));
const keys = Object.keys(items[0]).filter(k => !['id', 'created_at', 'updated_at', 'visible', 'raw_text'].includes(k));
let html = `<thead class="bg-gray-50 border-b"><tr>`;
keys.forEach(k => { html += `<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">${k}</th>`; });
html += `<th class="px-4 py-3 text-center text-sm font-medium text-gray-600">显示</th>`;
html += `<th class="px-4 py-3 text-center text-sm font-medium text-gray-600">操作</th></tr></thead><tbody>`;
items.forEach(item => {
html += `<tr class="border-b hover:bg-gray-50">`;
html += `<tr class="border-b hover:bg-gray-50 ${item.visible === false ? 'bg-gray-100 opacity-60' : ''}">`;
keys.forEach(k => { html += `<td class="px-4 py-3 text-gray-600">${item[k] || '-'}</td>`; });
html += `<td class="px-4 py-3 text-center">
<button onclick="toggleVisible('dynamic', '${item.id}')" class="${item.visible === false ? 'text-gray-400' : 'text-green-600'} hover:opacity-80" title="${item.visible === false ? '点击显示' : '点击隐藏'}">
<i class="${item.visible === false ? 'ri-eye-off-line' : 'ri-eye-line'}"></i>
</button>
${item.raw_text ? `<button onclick="showRawData('${item.id}', 'dynamic')" class="text-gray-400 hover:text-gray-600 ml-1" title="查看原始数据"><i class="ri-file-text-line"></i></button>` : ''}
</td>`;
html += `<td class="px-4 py-3 text-center">
<button onclick="editDynamicItem('${item.id}')" class="text-blue-600 hover:text-blue-800 mr-2"><i class="ri-edit-line"></i></button>
<button onclick="deleteDynamicItem('${item.id}')" class="text-red-600 hover:text-red-800"><i class="ri-delete-bin-line"></i></button>
@@ -437,12 +487,53 @@ GPT-4是OpenAI发布的大语言模型参数量约1.8万亿支持128K上
}
if (section === 'categories') loadAdminCategories();
if (section === 'config') loadSiteConfig();
if (section === 'models') loadAdminModels();
if (section === 'gpus') loadAdminGpus();
if (section === 'cpus') loadAdminCpus();
if (section === 'knowledge') loadAdminKnowledge();
}
// 加载网站配置
async function loadSiteConfig() {
const res = await fetch('/api/config');
const config = await res.json();
document.getElementById('config_site_name').value = config.site_name || '';
document.getElementById('config_site_subtitle').value = config.site_subtitle || '';
document.getElementById('config_icp_number').value = config.icp_number || '';
document.getElementById('config_contact_email').value = config.contact_email || '';
document.getElementById('config_github_url').value = config.github_url || '';
document.getElementById('config_copyright_year').value = config.copyright_year || '';
document.getElementById('config_footer_text').value = config.footer_text || '';
}
// 保存网站配置
async function saveSiteConfig() {
const config = {
site_name: document.getElementById('config_site_name').value,
site_subtitle: document.getElementById('config_site_subtitle').value,
icp_number: document.getElementById('config_icp_number').value,
contact_email: document.getElementById('config_contact_email').value,
github_url: document.getElementById('config_github_url').value,
copyright_year: document.getElementById('config_copyright_year').value,
footer_text: document.getElementById('config_footer_text').value,
};
try {
const res = await fetch('/api/config', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(config)
});
const data = await res.json();
alert('配置已保存!');
} catch (e) {
alert('保存失败: ' + e.message);
}
}
// 加载概览统计
async function loadOverview() {
const res = await fetch('/api/stats');
@@ -500,7 +591,7 @@ GPT-4是OpenAI发布的大语言模型参数量约1.8万亿支持128K上
// 加载分类列表
async function loadAdminCategories() {
const res = await fetch('/api/categories');
const res = await fetch('/api/categories?all=1');
categories = await res.json();
if (categories.length === 0) {
@@ -515,7 +606,7 @@ GPT-4是OpenAI发布的大语言模型参数量约1.8万亿支持128K上
<td class="px-4 py-3 font-medium text-gray-800">${c.name}</td>
<td class="px-4 py-3 text-gray-600 text-sm">${c.description || '-'}</td>
<td class="px-4 py-3 text-center">
<button onclick="toggleVisible('category', '${c.id}')" class="${c.visible === false ? 'text-gray-400' : 'text-green-600'} hover:opacity-80">
<button onclick="toggleVisible('category', '${c.id}')" class="${c.visible === false ? 'text-gray-400' : 'text-green-600'} hover:opacity-80" title="${c.visible === false ? '点击显示' : '点击隐藏'}">
<i class="${c.visible === false ? 'ri-eye-off-line' : 'ri-eye-line'}"></i>
</button>
</td>
@@ -540,7 +631,7 @@ GPT-4是OpenAI发布的大语言模型参数量约1.8万亿支持128K上
<td class="px-4 py-3 text-gray-600">${m.context_length || '-'}</td>
<td class="px-4 py-3">${m.is_open_source ? '<span class="text-green-600">开源</span>' : '<span class="text-gray-600">商业</span>'}</td>
<td class="px-4 py-3 text-center">
<button onclick="toggleVisible('model', '${m.id}')" class="${m.visible === false ? 'text-gray-400' : 'text-green-600'} hover:opacity-80">
<button onclick="toggleVisible('model', '${m.id}')" class="${m.visible === false ? 'text-gray-400' : 'text-green-600'} hover:opacity-80" title="${m.visible === false ? '点击显示' : '点击隐藏'}">
<i class="${m.visible === false ? 'ri-eye-off-line' : 'ri-eye-line'}"></i>
</button>
${m.raw_text ? `<button onclick="showRawData('${m.id}', 'model')" class="text-gray-400 hover:text-gray-600 ml-1" title="查看原始数据"><i class="ri-file-text-line"></i></button>` : ''}
@@ -566,7 +657,7 @@ GPT-4是OpenAI发布的大语言模型参数量约1.8万亿支持128K上
<td class="px-4 py-3 text-gray-600">${g.architecture || '-'}</td>
<td class="px-4 py-3 text-gray-600">${formatPrice(g)}</td>
<td class="px-4 py-3 text-center">
<button onclick="toggleVisible('gpu', '${g.id}')" class="${g.visible === false ? 'text-gray-400' : 'text-green-600'} hover:opacity-80">
<button onclick="toggleVisible('gpu', '${g.id}')" class="${g.visible === false ? 'text-gray-400' : 'text-green-600'} hover:opacity-80" title="${g.visible === false ? '点击显示' : '点击隐藏'}">
<i class="${g.visible === false ? 'ri-eye-off-line' : 'ri-eye-line'}"></i>
</button>
${g.raw_text ? `<button onclick="showRawData('${g.id}', 'gpu')" class="text-gray-400 hover:text-gray-600 ml-1" title="查看原始数据"><i class="ri-file-text-line"></i></button>` : ''}
@@ -592,7 +683,7 @@ GPT-4是OpenAI发布的大语言模型参数量约1.8万亿支持128K上
<td class="px-4 py-3 text-gray-600">${c.base_clock_ghz || '-'}-${c.boost_clock_ghz || '-'}GHz</td>
<td class="px-4 py-3 text-gray-600">${formatPrice(c)}</td>
<td class="px-4 py-3 text-center">
<button onclick="toggleVisible('cpu', '${c.id}')" class="${c.visible === false ? 'text-gray-400' : 'text-green-600'} hover:opacity-80">
<button onclick="toggleVisible('cpu', '${c.id}')" class="${c.visible === false ? 'text-gray-400' : 'text-green-600'} hover:opacity-80" title="${c.visible === false ? '点击显示' : '点击隐藏'}">
<i class="${c.visible === false ? 'ri-eye-off-line' : 'ri-eye-line'}"></i>
</button>
${c.raw_text ? `<button onclick="showRawData('${c.id}', 'cpu')" class="text-gray-400 hover:text-gray-600 ml-1" title="查看原始数据"><i class="ri-file-text-line"></i></button>` : ''}
@@ -757,12 +848,6 @@ GPT-4是OpenAI发布的大语言模型参数量约1.8万亿支持128K上
<div><label class="text-sm text-gray-600 mb-1 block">描述</label><textarea name="description" rows="2" class="w-full px-3 py-2 border rounded-lg">${data.description || ''}</textarea></div>
</form>`;
}
</select></div>
<div><label class="text-sm text-gray-600 mb-1 block">排序</label><input type="number" name="order" value="${data.order || 0}" class="w-full px-3 py-2 border rounded-lg"></div>
</div>
<div><label class="text-sm text-gray-600 mb-1 block">描述</label><textarea name="description" rows="2" class="w-full px-3 py-2 border rounded-lg">${data.description || ''}</textarea></div>
</form>`;
}
function getKnowledgeForm(data = {}) {
return `<form id="itemForm" class="space-y-4">
@@ -965,6 +1050,7 @@ GPT-4是OpenAI发布的大语言模型参数量约1.8万亿支持128K上
if (type === 'model') endpoint = `/api/models/${id}`;
else if (type === 'gpu') endpoint = `/api/gpus/${id}`;
else if (type === 'cpu') endpoint = `/api/cpus/${id}`;
else if (type === 'dynamic') endpoint = `/api/items/${dynamicCategoryId}/${id}`;
try {
const res = await fetch(endpoint);

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();