feat: add version and updatedAt fields with export check and display
This commit is contained in:
+17
-2
@@ -253,7 +253,10 @@ body {
|
||||
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1 id="configName">PC装机配置表</h1>
|
||||
<div>
|
||||
<h1 id="configName">PC装机配置表</h1>
|
||||
<div id="configMeta" style="font-size:12px;color:#999;margin-top:4px"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contentArea"></div>
|
||||
@@ -286,13 +289,25 @@ function loadFromURL() {
|
||||
if (configURL) {
|
||||
fetch(configURL)
|
||||
.then(r => { if (!r.ok) throw new Error(`HTTP ${r.status}`); return r.json(); })
|
||||
.then(data => { config = data; document.getElementById('configName').textContent = config.configName || 'PC装机配置表'; render(); })
|
||||
.then(data => { config = data; document.getElementById('configName').textContent = config.configName || 'PC装机配置表'; updateMeta(); render(); })
|
||||
.catch(err => { console.error('加载配置失败:', err); render(); });
|
||||
} else {
|
||||
render();
|
||||
}
|
||||
}
|
||||
|
||||
// ========== Meta ==========
|
||||
function updateMeta() {
|
||||
const meta = document.getElementById('configMeta');
|
||||
const parts = [];
|
||||
if (config.version) parts.push('v' + config.version);
|
||||
if (config.updatedAt) {
|
||||
const d = new Date(config.updatedAt);
|
||||
parts.push('更新于 ' + d.toLocaleDateString('zh-CN') + ' ' + d.toLocaleTimeString('zh-CN', {hour:'2-digit', minute:'2-digit'}));
|
||||
}
|
||||
meta.textContent = parts.join(' · ');
|
||||
}
|
||||
|
||||
// ========== Render ==========
|
||||
function render() {
|
||||
const area = document.getElementById('contentArea');
|
||||
|
||||
Reference in New Issue
Block a user