Files
EAP_Interface_html/.preview/dfu_upgrade/option_2_neo_bento.html
T
zhy200308 221fa34250 feat(ui): 交付手环升级(DFU固件升级)方案5落地物料并严格统一1:1双栏等比占比
1. 【手环升级 / DFU固件升级】:根据用户选定方案5(Master-Detail Inset Pro)完成6件套标准物料全量交付:
   - 左右两大板块严格统一为 1:1 双栏等比均衡占比,与【手环配置】板块占比完全一致;
   - 视觉体系严格对齐全局主色蓝规范 #2563EB(深色 #1D4ED8、浅底 #EFF6FF、高亮 #1E40AF);
   - 左侧布局:待升级手环硬件状态卡片(采用方案5 Inset 经典属性胶囊条:手环 ID/当前版本/剩余电量 + 取消升级暖黄按钮)与固件包版本源;
   - 右侧布局:升级进度条、毫秒级百分比读数、传输速率与极客暗晶升级日志控制台 Terminal;
   - 弹窗交互:居中底部抽拉式 Sheet(560px 宽度自适应居中),配备顶部阻尼把手、左上角动态雷达声呐动效与 BLE 协议胶囊标签;
   - 交互闭环:支持手环信道建立、固件下发传输、校验重启与安全取消全流程;
   - Chrome Headless 自动渲染生成官方 image.png 交付图。
2. 更新 README.md 项目进度(已完成 6/11 页面)。
2026-08-17 17:36:00 +08:00

215 lines
12 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>方案 2:Neo-Bento 固件工控工作台</title>
<style>
:root {
--color-primary: #2563EB;
--color-primary-dark: #1D4ED8;
--color-primary-light: #EFF6FF;
--color-primary-border: #DBEAFE;
--color-primary-glow: rgba(37, 99, 235, 0.25);
--color-primary-gradient: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
--bg: #EEF2F6;
--surface: #FFFFFF;
--text-main: #0F172A;
--text-sub: #64748B;
--divider: #E2E8F0;
--terminal-bg: #0F172A;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: var(--bg); color: var(--text-main); min-height: 100vh;
padding: clamp(16px, 2.5vw, 32px); display: flex; flex-direction: column;
}
.device-wrapper {
width: 100%; max-width: min(100%, 1160px); margin: 0 auto; background: var(--surface);
border-radius: 20px; border: 1px solid var(--divider); box-shadow: 0 16px 40px -10px rgba(15, 23, 42, 0.08);
overflow: hidden; position: relative; min-height: 640px; display: flex; flex-direction: column;
}
.appbar {
height: 60px; display: flex; align-items: center; justify-content: space-between;
padding: 0 20px; border-bottom: 1px solid var(--divider); background: var(--surface);
}
.appbar-left { display: flex; align-items: center; }
.appbar-nav, .appbar-more {
width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
cursor: pointer; background: transparent; border: none;
}
.appbar-nav:hover, .appbar-more:hover { background: rgba(15, 23, 42, 0.06); }
.appbar-nav svg, .appbar-more svg { width: 22px; height: 22px; fill: var(--text-main); }
.appbar-title { font-size: 19px; font-weight: 700; margin-left: 10px; }
.bento-dash {
padding: clamp(20px, 2.5vw, 30px); display: grid; grid-template-columns: 1fr 1fr;
gap: 18px; background: #F8FAFC; flex: 1; overflow-y: auto; max-height: calc(100vh - 120px);
}
.bento-card {
background: var(--surface); border: 1.5px solid var(--divider); border-radius: 16px;
padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.b-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--divider); padding-bottom: 10px; }
.b-title { font-size: 15.5px; font-weight: 700; color: var(--color-primary); }
.param-grid-4 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.p-tile { background: #F8FAFC; border: 1px solid var(--divider); border-radius: 8px; padding: 8px 12px; }
.btn-wide-blue {
width: 100%; padding: 12px; border-radius: 10px; font-size: 14px; font-weight: 700;
background: var(--color-primary-gradient); color: white; border: none; cursor: pointer;
box-shadow: 0 4px 14px var(--color-primary-glow);
}
.terminal-box {
background: var(--terminal-bg); border-radius: 10px; padding: 10px 12px; font-family: monospace; font-size: 11.5px;
color: #38BDF8; height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
}
/* FAB */
.bluetooth-fab {
position: absolute; bottom: 24px; right: 24px; width: 52px; height: 52px; border-radius: 16px;
background: var(--surface); border: 1.5px solid var(--divider); box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 50;
}
.bluetooth-fab svg { width: 24px; height: 24px; fill: var(--color-primary); }
/* Sheet */
.bottom-sheet-mask {
position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.45);
backdrop-filter: blur(4px); z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.bottom-sheet-mask.open { opacity: 1; pointer-events: auto; }
.bottom-sheet {
position: absolute; bottom: 0; left: 50%; transform: translateX(-50%) translateY(100%);
width: min(92%, 560px); background: var(--surface); border-radius: 24px 24px 0 0; border: 1.5px solid var(--divider);
border-bottom: none; box-shadow: 0 -16px 45px rgba(15, 23, 42, 0.2); transition: transform 0.35s ease;
display: flex; flex-direction: column; max-height: 480px; z-index: 101;
}
.bottom-sheet-mask.open .bottom-sheet { transform: translateX(-50%) translateY(0); }
</style>
</head>
<body>
<div class="device-wrapper">
<header class="appbar">
<div class="appbar-left">
<button class="appbar-nav"><svg viewBox="0 0 24 24"><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/></svg></button>
<h1 class="appbar-title">手环升级</h1>
</div>
<button class="appbar-more"><svg viewBox="0 0 24 24"><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/></svg></button>
</header>
<main class="bento-dash">
<div style="display: flex; flex-direction: column; gap: 16px;">
<section class="bento-card">
<div class="b-head">
<span class="b-title">待升级手环状态</span>
<span id="bConnTag" style="font-size: 11.5px; color: var(--text-sub);">状态:未连接</span>
</div>
<div class="param-grid-4">
<div class="p-tile"><div style="font-size: 11px; color: var(--text-sub);">ID:</div><div style="font-weight: 700; font-family: monospace;" id="bId">未连接</div></div>
<div class="p-tile"><div style="font-size: 11px; color: var(--text-sub);">版本:</div><div style="font-weight: 700; font-family: monospace;" id="bVer">未知</div></div>
<div class="p-tile" style="grid-column: span 2;"><div style="font-size: 11px; color: var(--text-sub);">电量:</div><div style="font-weight: 700; font-family: monospace;" id="bBat">未知</div></div>
</div>
<button style="align-self: flex-end; background: #FEF3C7; color: #D97706; border: 1px solid #FDE68A; padding: 6px 14px; border-radius: 6px; font-weight: 700; cursor: pointer;" onclick="bCancel()">取消升级</button>
</section>
<section class="bento-card">
<div class="b-head"><span class="b-title">固件包与版本源</span></div>
<div style="background: #F8FAFC; border: 1px solid var(--divider); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; font-family: monospace; font-weight: 700;">
SC106_FW1.00.0036_HW0.1_20260720_DFU.zip (内置 v1.00.0036)
<div style="color: var(--color-primary); font-size: 11.5px; margin-top: 4px;">固件来源: 内置 (优先)</div>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 8px;">
<button style="background: white; border: 1.5px solid var(--divider); padding: 8px; border-radius: 8px; font-weight: 700; color: var(--color-primary); cursor: pointer;" onclick="bCheck()">检查服务端版本</button>
<button style="background: white; border: 1.5px solid var(--divider); padding: 8px; border-radius: 8px; font-weight: 700; color: var(--color-primary); cursor: pointer;" onclick="bUse()">使用内置固件</button>
</div>
</section>
</div>
<div style="display: flex; flex-direction: column; gap: 16px;">
<section class="bento-card" style="flex: 1;">
<div class="b-head"><span class="b-title">升级进度与控制</span></div>
<div style="background: #F8FAFC; border: 1px solid var(--divider); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px;">
<div style="display: flex; justify-content: space-between; font-size: 13px; font-weight: 700;">
<span>升级进度</span><span id="bPct" style="color: var(--color-primary);">0%</span>
</div>
<div style="width: 100%; height: 8px; background: #E2E8F0; border-radius: 10px; overflow: hidden;">
<div id="bBar" style="width: 0%; height: 100%; background: var(--color-primary-gradient); transition: width 0.3s;"></div>
</div>
</div>
<button class="btn-wide-blue" id="bStartBtn" onclick="bStart()">开始升级</button>
<span style="font-size: 12.5px; font-weight: 700;">升级日志控制台</span>
<div class="terminal-box" id="bLog">
<div>[INIT] DFU 引导核心就绪...</div>
</div>
</section>
</div>
</main>
<!-- FAB -->
<button class="bluetooth-fab" onclick="openBSheet()"><svg viewBox="0 0 24 24"><path d="M17.71 7.71L12 2h-1v7.59L6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 11 14.41V22h1l5.71-5.71-4.3-4.29 4.3-4.29zM13 5.83l1.88 1.88L13 9.59V5.83zm1.88 10.46L13 18.17v-3.76l1.88 1.88z"/></svg></button>
<!-- Sheet -->
<div class="bottom-sheet-mask" id="bSheet" onclick="if(event.target===this) closeBSheet()">
<div class="bottom-sheet">
<div style="width: 44px; height: 4px; border-radius: 4px; background: #CBD5E1; margin: 10px auto 4px;"></div>
<div style="padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--divider);">
<div style="display: flex; align-items: center; gap: 8px;"><span style="font-size: 16px;">📡</span><h2 style="font-size: 15.5px; font-weight: 700;">选择设备</h2></div>
<span style="cursor: pointer;" onclick="closeBSheet()">✕</span>
</div>
<div style="padding: 14px 20px; display: flex; flex-direction: column; gap: 8px;">
<div style="border: 1.5px solid var(--divider); padding: 12px; border-radius: 10px; display: flex; justify-content: space-between; align-items: center; cursor: pointer;" onclick="bPick('CL831-62200026', 'v1.00.0035', '88%')">
<div>
<div style="font-weight: 700; font-family: monospace;">CL831-62200026</div>
<div style="font-size: 11px; color: var(--text-sub);">D9:24:0F:1C:55:FA · -89 dBm</div>
</div>
<span style="background: var(--color-primary-light); color: var(--color-primary); font-size: 11px; font-weight: 800; padding: 4px 8px; border-radius: 4px; border: 1px solid var(--color-primary-border);">BLE</span>
</div>
</div>
</div>
</div>
</div>
<script>
function bLog(t) {
const b = document.getElementById('bLog');
const d = document.createElement('div');
d.innerText = `[${new Date().toTimeString().split(' ')[0]}] ${t}`;
b.appendChild(d); b.scrollTop = b.scrollHeight;
}
function openBSheet() { document.getElementById('bSheet').classList.add('open'); bLog("展开【选择设备】面板..."); }
function closeBSheet() { document.getElementById('bSheet').classList.remove('open'); }
function bPick(n, v, bat) {
closeBSheet();
bLog(`连接目标手环 [${n}]...`);
setTimeout(() => {
document.getElementById('bId').innerText = n;
document.getElementById('bVer').innerText = v;
document.getElementById('bBat').innerText = bat;
document.getElementById('bConnTag').innerText = "状态:已就绪";
document.getElementById('bConnTag').style.color = "#10B981";
bLog(`手环 [${n}] DFU 握手成功!`);
}, 500);
}
function bStart() {
bLog("开始下发固件分包...");
let p = 0;
const tm = setInterval(() => {
p += 15;
if (p > 100) p = 100;
document.getElementById('bBar').style.width = p + '%';
document.getElementById('bPct').innerText = p + '%';
if (p >= 100) { clearInterval(tm); bLog("固件升级完成!手环重启中...", "success"); alert("固件升级成功!"); }
}, 300);
}
function bCancel() { bLog("取消固件升级。"); alert("升级已取消"); }
function bCheck() { bLog("检查服务端最新版本..."); alert("当前为最新版本!"); }
function bUse() { bLog("锁定使用内置固件。"); alert("已选择内置固件!"); }
</script>
</body>
</html>