fix: 管理后台连接状态 + 修复按钮无响应

连接状态(正式):
- /api/display/state 扩展:screens_online(大屏心跳统计,opc/display/heartbeat)+ last_command(最近指令与发布结果)
- 前端大屏每 10s 上报心跳(稳定 client_id),后端 30s TTL 统计在线大屏数
- 管理台新增「连接状态」卡片:后端/MQTT/在线大屏/最近指令,3s 轮询刷新

按钮无响应根治:
- admin.js 改为 document 事件委托(data-nav/data-control/data-action/复制/预览),不再依赖逐个绑定
- /static 与 /admin 响应加 no-cache 头,杜绝旧 JS/CSS 缓存导致的按钮失效
- SSE 不再自动重载页面(避免与操作回调双重重载清掉反馈);立即播放改为 toast 不重载
This commit is contained in:
Pine
2026-08-17 21:54:23 +08:00
parent 1a95ecbacb
commit c55835fb7d
10 changed files with 297 additions and 86 deletions
+54
View File
@@ -1187,3 +1187,57 @@ button { font-family: "Poppins", "PingFang SC", sans-serif; cursor: pointer; tra
@media (max-width: 900px) {
.page-switch-grid { grid-template-columns: repeat(2, 1fr); }
}
/* =========================================================
连接状态卡片
========================================================= */
.conn-status {
display: flex;
flex-direction: column;
gap: 6px;
}
.conn-row {
display: flex;
align-items: center;
gap: 8px;
padding: 7px 10px;
background: rgba(0, 189, 125, 0.04);
border: 1px solid rgba(0, 189, 125, 0.12);
border-radius: 8px;
}
.conn-dot {
width: 8px;
height: 8px;
flex-shrink: 0;
border-radius: 50%;
background: #d1d5db;
}
.conn-dot.on {
background: #16A34A;
box-shadow: 0 0 6px rgba(22, 163, 74, 0.7);
animation: connPulse 1.6s ease-in-out infinite;
}
.conn-dot.off {
background: #DC2626;
box-shadow: 0 0 6px rgba(220, 38, 38, 0.6);
}
@keyframes connPulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.4; }
}
.conn-label {
flex-shrink: 0;
font-size: 12px;
color: var(--text-secondary, #4b5563);
width: 72px;
}
.conn-value {
flex: 1;
min-width: 0;
font-size: 12px;
font-weight: 600;
color: var(--text, #111827);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}