fix: cache-bust workspace assets (?v=4) + guard empty entry IDs in editor links

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-10-28 14:18:30 +08:00
parent adcb1cc157
commit 8fbe638b15
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -128,7 +128,7 @@ function content(){if(!currentSite())return noSite();let arr=state.entries.filte
const pagination=totalPages>1?`<div class=”pagination”><button class=”page-btn” data-action=”page-prev” ${state.page<=1?'disabled':''}>‹ 上一页</button><span class=”page-info”>第 <strong>${state.page}</strong> / ${totalPages} 页 · 共 ${arr.length} 条</span><button class=”page-btn primary” data-action=”page-next” ${state.page>=totalPages?'disabled':''}>下一页 ›</button></div>`:'';
return htmlHeading('内容与页面','所有网页、产品、车型和新闻都在这里维护,保存后重新构建即可更新网站。',actionButton('+ 添加内容','new-entry'))+
`<div class=”panel”><div class=”panel-head”><div><h2>内容列表</h2><p>共 ${state.entries.length} 条内容。点击”设计页面”可进行可视化排版。</p></div></div><div style=”margin-bottom:12px”>${tabHtml}</div><div class=”toolbar”><input id=”contentSearch” aria-label=”搜索内容” placeholder=”搜索标题或页面路径…” value=”${esc(state.search)}”></div>`+
(pageItems.length?`<div class=”table-wrap”><table class=”data-table content-table”><thead><tr><th style=”min-width:200px”>名称</th><th>类型</th><th style=”min-width:180px”>页面地址</th><th>状态</th><th style=”min-width:220px”>操作</th></tr></thead><tbody>${pageItems.map(e=>`<tr><td><strong>${esc(e.title)}</strong></td><td><span class=”type-badge ${e.type}”>${esc(typeName[e.type]||e.type)}</span></td><td><span class=”route-code”>${esc(e.route)}</span></td><td><span class=”status-dot ${e.status==='draft'?'draft':'published'}”>${e.status==='draft'?'草稿':'已发布'}</span></td><td class=”action-cell”><button class=”action-btn” data-action=”edit-entry” data-id=”${esc(e.id)}”>✎ 修改内容</button> <a class=”action-btn design” href=”/editor/${encodeURIComponent(state.site.id)}/${encodeURIComponent(e.id)}”>▤ 设计页面</a></td></tr>`).join('')}</tbody></table></div>${pagination}`:emptyState('没有找到内容','可以清除筛选条件,或者添加新内容。',actionButton('+ 添加内容','new-entry')))+
(pageItems.length?`<div class=”table-wrap”><table class=”data-table content-table”><thead><tr><th style=”min-width:200px”>名称</th><th>类型</th><th style=”min-width:180px”>页面地址</th><th>状态</th><th style=”min-width:220px”>操作</th></tr></thead><tbody>${pageItems.map(e=>`<tr><td><strong>${esc(e.title)}</strong></td><td><span class=”type-badge ${e.type}”>${esc(typeName[e.type]||e.type)}</span></td><td><span class=”route-code”>${esc(e.route)}</span></td><td><span class=”status-dot ${e.status==='draft'?'draft':'published'}”>${e.status==='draft'?'草稿':'已发布'}</span></td><td class=”action-cell”><button class=”action-btn” data-action=”edit-entry” data-id=”${esc(e.id)}”>✎ 修改内容</button>${e.id?` <a class=”action-btn design” href=”/editor/${encodeURIComponent(state.site.id)}/${encodeURIComponent(e.id)}”>▤ 设计页面</a>`:''}</td></tr>`).join('')}</tbody></table></div>${pagination}`:emptyState('没有找到内容','可以清除筛选条件,或者添加新内容。',actionButton('+ 添加内容','new-entry')))+
`</div>`;
}
function design(){if(!currentSite())return noSite();const s=state.site;const cards=Object.entries(themeName).map(([id,name])=>`<div class="theme-card"><div class="theme-preview ${id}">${name}</div><div class="theme-desc"><h3>${name} ${s.theme===id?'<span class="pill success">当前使用</span>':''}</h3><p>${({automotive:'适合汽车出口、车型及品牌展示',industrial:'适合制造业、产品与技术参数',corporate:'适合集团公司、服务和案例',minimal:'适合作品展示和品牌形象','trade-pro':'适合外贸 B2B 英文站点与询盘'})[id]}</p><button class="btn btn-tiny ${s.theme===id?'btn-muted':'btn-primary'}" ${s.theme===id?'disabled':''} data-action="set-theme" data-theme="${id}">${s.theme===id?'正在使用':'使用此主题'}</button><a class="btn btn-tiny btn-muted" href="/theme-gallery?theme=${encodeURIComponent(id)}" target="_blank" rel="noopener">预览页面效果</a></div></div>`).join('');
+1 -1
View File
@@ -1,7 +1,7 @@
<!doctype html>
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>SiteForge · 网站工作台</title><meta name="description" content="统一管理网站、内容、设计、迁移和构建。">
<link rel="icon" href="/favicon.ico"><link rel="stylesheet" href="/ui/workspace.css"><script defer src="/ui/workspace-guide.js"></script><script defer src="/ui/workspace-launch.js"></script><script defer src="/ui/workspace.js"></script></head>
<link rel="icon" href="/favicon.ico"><link rel="stylesheet" href="/ui/workspace.css?v=4"><script defer src="/ui/workspace-guide.js"></script><script defer src="/ui/workspace-launch.js"></script><script defer src="/ui/workspace.js?v=4"></script></head>
<body>
<div class="app-shell">
<aside class="nav-side" id="sideMenu">