diff --git a/web/dashboard.html b/web/dashboard.html index 9467b9f..1c05c43 100644 --- a/web/dashboard.html +++ b/web/dashboard.html @@ -49,7 +49,38 @@ .footer { color: var(--muted); font-size: 12px; text-align: center; padding: 10px 0 30px; } .scroll { max-height: 460px; overflow-y: auto; } .empty { color: var(--muted); padding: 20px 0; text-align: center; } - @media (max-width: 640px) { body { padding: 10px; } table { font-size: 12px; } } + @media (max-width: 720px) { + body { padding: 12px 10px; } + h1 { font-size: 18px; } + .top { gap: 10px; } + /* 站点栏横向滚动 */ + .sitebar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; margin: 0 -10px; padding-left: 10px; padding-right: 10px; } + .sitebtn { flex-shrink: 0; padding: 7px 12px; } + /* 统计卡片 2x2 */ + .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; } + .stat { padding: 10px 12px; } + .stat .num { font-size: 22px; } + /* 设备表 → 卡片列表 */ + .card { padding: 12px; margin-bottom: 16px; } + table { display: block; font-size: 13px; } + thead { display: none; } + tbody { display: block; } + tr { display: block; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; } + tr:hover td { background: transparent; } + td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; border-bottom: 1px solid rgba(51,65,85,.25); white-space: normal; } + td:last-child { border-bottom: none; } + td::before { content: attr(data-label); color: var(--muted); font-size: 12px; flex-shrink: 0; } + td:first-child { display: inline-flex; justify-content: flex-start; border-bottom: 1px solid rgba(51,65,85,.25); } + td:first-child::before { content: none; } + td .badge { font-size: 11px; padding: 2px 8px; } + /* 时间信息用紧凑小字,但值自身换行 */ + td:not(:first-child) { font-size: 12.5px; } + .mac { word-break: break-all; text-align: right; } + /* 紧凑事件 */ + .evt { flex-wrap: wrap; gap: 4px 8px; padding: 8px 0; font-size: 12.5px; } + .evt .time { width: 100%; font-size: 12px; } + .evt .detail { flex-basis: 100%; padding-left: 16px; } + } @@ -159,14 +190,14 @@ async function loadSite() { $('devices').innerHTML = (data.devices || []).map(d => ` ${d.status === 'online' ? '在线' : '离线'} - ${esc(d.name || '-')} - ${esc(d.mac)} - ${esc(d.last_ip || '-')} - ${fmtTime(d.first_seen)} - ${fmtTime(d.last_online)} - ${fmtTime(d.last_offline)} - ${d.online_count ?? 0} - ${fmtDur(d.total_online_seconds)} + ${esc(d.name || '-')} + ${esc(d.mac)} + ${esc(d.last_ip || '-')} + ${fmtTime(d.first_seen)} + ${fmtTime(d.last_online)} + ${fmtTime(d.last_offline)} + ${d.online_count ?? 0} + ${fmtDur(d.total_online_seconds)} `).join('') || '暂无设备'; $('events').innerHTML = (data.events || []).map(e => { diff --git a/web/index.html b/web/index.html index 46f63e7..d7b5c33 100644 --- a/web/index.html +++ b/web/index.html @@ -39,7 +39,35 @@ .evt .detail { color: var(--muted); font-size: 12px; } .footer { color: var(--muted); font-size: 12px; text-align: center; padding: 10px 0 30px; } .scroll { max-height: 480px; overflow-y: auto; } - @media (max-width: 640px) { body { padding: 10px; } table { font-size: 12px; } } + .empty { color: var(--muted); padding: 20px 0; text-align: center; } + @media (max-width: 720px) { + body { padding: 12px 10px; } + h1 { font-size: 18px; } + .sub { margin-bottom: 14px; } + /* 统计卡片 2x2 */ + .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; } + .stat { padding: 10px 12px; } + .stat .num { font-size: 22px; } + /* 设备表 → 卡片列表 */ + .card { padding: 12px; margin-bottom: 16px; } + table { display: block; font-size: 13px; } + thead { display: none; } + tbody { display: block; } + tr { display: block; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; } + tr:hover td { background: transparent; } + td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; border-bottom: 1px solid rgba(51,65,85,.25); white-space: normal; } + td:last-child { border-bottom: none; } + td::before { content: attr(data-label); color: var(--muted); font-size: 12px; flex-shrink: 0; } + td:first-child { display: inline-flex; justify-content: flex-start; border-bottom: 1px solid rgba(51,65,85,.25); } + td:first-child::before { content: none; } + td .badge { font-size: 11px; padding: 2px 8px; } + td:not(:first-child) { font-size: 12.5px; } + .mac { word-break: break-all; text-align: right; } + /* 紧凑事件 */ + .evt { flex-wrap: wrap; gap: 4px 8px; padding: 8px 0; font-size: 12.5px; } + .evt .time { width: 100%; font-size: 12px; } + .evt .detail { flex-basis: 100%; padding-left: 16px; } + } @@ -111,14 +139,14 @@ async function load() { const rows = (devs.devices || []).map(d => ` ${d.status === 'online' ? '在线' : '离线'} - ${esc(d.name || '-')} - ${esc(d.mac)} - ${esc(d.last_ip || '-')} - ${fmtTime(d.first_seen)} - ${fmtTime(d.last_online)} - ${fmtTime(d.last_offline)} - ${d.online_count ?? 0} - ${fmtDur(d.total_online_seconds)} + ${esc(d.name || '-')} + ${esc(d.mac)} + ${esc(d.last_ip || '-')} + ${fmtTime(d.first_seen)} + ${fmtTime(d.last_online)} + ${fmtTime(d.last_offline)} + ${d.online_count ?? 0} + ${fmtDur(d.total_online_seconds)} `).join(''); $('devices').innerHTML = rows || '暂无数据';