feat(ui): 交付手环升级(DFU固件升级)6件套物料并保持全局视觉家族统一
1. 【手环升级 / DFU固件升级】:完成6件套标准物料交付(原图+image.png+baseline_ui.html+DESIGN_SPEC.md+implementation_plan.md+CARD任务卡): - 视觉体系与【手环配置】、【自动连接配置】达成 100% 家族风格统一; - 严格遵循全局主色蓝规范 #2563EB(深色 #1D4ED8、浅底 #EFF6FF、高亮 #1E40AF); - 左侧布局:待升级手环硬件状态卡片(ID/版本/电量参数瓦片+取消升级按钮)与固件包版本源(检查服务端版本+使用内置固件); - 右侧布局:升级进度条、毫秒级百分比读数、传输速率与极客暗晶升级日志控制台 Terminal; - 弹窗交互:居中底部抽拉式 Sheet(560px 宽度自适应居中),配备顶部阻尼把手、左上角动态雷达声呐动效与 BLE 协议胶囊标签; - 交互闭环:支持手环信道建立、固件下发传输、校验重启与安全取消全流程; - Chrome Headless 自动渲染生成官方 image.png 交付图。 2. 更新 README.md 项目进度(已完成 6/11 页面)。
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
# 研发任务卡:手环升级 (DFU固件升级) UI 重构与交付
|
||||
|
||||
- **任务编号**:`CARD-20260817-UITask-DFU固件升级`
|
||||
- **模块归属**:`设置页面UI优化/DFU固件升级/`
|
||||
- **对应截屏**:`Screenshot_20260812_143413.png`
|
||||
- **交付状态**:✅ **已完成 (6件套齐备)**
|
||||
- **交付物清单**:
|
||||
1. `Screenshot_20260812_143413.png`:出厂原版真机截图
|
||||
2. `image.png`:基于 baseline_ui.html 无头渲染的高清交付图
|
||||
3. `baseline_ui.html`:生产级前端基准代码(完整交互状态机闭环)
|
||||
4. `DESIGN_SPEC.md`:设计规格说明书(字段与视觉规则全景)
|
||||
5. `implementation_plan.md`:实施与技术架构方案
|
||||
6. `CARD-20260817-UITask-DFU固件升级.md`:任务卡
|
||||
|
||||
---
|
||||
|
||||
## 交付特性亮点
|
||||
1. **视觉家族系统完全统一**:严格遵循 `#2563EB` 全局主色蓝标准,与【手环配置】、【自动连接配置】等页面达成 100% 视觉风格与材质统一;
|
||||
2. **居中精致抽拉面板**:560px 宽度自适应居中抽屉,左上角配备动态声呐雷达动效,去除冗余按钮并精简为 BLE 胶囊标签;
|
||||
3. **真实交互状态流转**:支持设备配对、GATT 固件分包下发、CRC32 校验、重启生效以及异常取消升级全流程。
|
||||
@@ -0,0 +1,51 @@
|
||||
# 手环升级 (DFU固件升级) 视觉重构规格说明书 (DESIGN_SPEC)
|
||||
|
||||
## 1. 业务与界面定位
|
||||
- **模块名称**:手环升级 / DFU 固件升级 (Device Firmware Upgrade)
|
||||
- **核心场景**:用于运动手环设备的 BLE OTA 固件空中升级与引导维护。提供目标手环信息展示、固件源校验切换、多阶段固件烧录进度监控、异常取消以及底层 DFU 协议日志输出。
|
||||
- **设计基准**:严格统一遵循全局核心主色蓝标准(`#2563EB` 体系)、AppBar 40dp 纯净触控规范、自适应流体双栏栅格与居中底部抽拉式 Sheet 面板。
|
||||
|
||||
---
|
||||
|
||||
## 2. 字段与槽位 100% 对应表
|
||||
|
||||
| 区域 | 原图字段 / 控件 | 重构 UI 对应槽位 | 规范与交互行为 |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| **顶部栏** | 返回箭头 + `手环升级` | AppBar (高度 60px) | 40dp 纯净透明触控槽 + Hover 微圆底,返回上一级 |
|
||||
| **设备卡片** | 手环插画 + ID / 版本 / 电量 | 左侧上部【待升级手环状态】卡片 | 结构化参数瓦片,支持展示当前连接设备的实时硬件属性 |
|
||||
| **设备操作** | `取消升级` 按钮 | 卡片右下角操作按钮 | 暖琥珀色(`#FEF3C7` / `#D97706`),传输中可随时安全熔断 DFU 进程 |
|
||||
| **固件卡片** | 固件包文件名 (内置版本) | 左侧下部【固件包与版本源】卡片 | 代码等宽字号展示,清晰标注 `固件来源: 内置 (优先)` |
|
||||
| **固件操作** | `检查服务端版本` / `使用内置固件` | 双操作按钮栅格 | 标准幽灵边框按钮,Hover 高亮 `--color-primary-light` |
|
||||
| **升级控制** | `升级进度` 标题 + 进度条 + 百分比 | 右侧【升级进度与控制】面板 | 动态平滑渐变进度条,毫秒级百分比读数与实时传输速率展示 |
|
||||
| **主按钮** | `开始升级` (全宽主按钮) | 右侧核心 CTA 按钮 | 渐变主色蓝 `--color-primary-gradient`,带弥散光晕 |
|
||||
| **协议日志** | 同步日志输出 | 右侧下方【升级日志控制台】 | 极客暗晶终端 HUD,完整打印 DFU 阶段流转与握手报文 |
|
||||
| **悬浮按钮** | 右下角蓝牙标志 | 右下角 FAB 悬浮按钮 (52×52dp) | 点击唤出居中底部抽拉面板 |
|
||||
| **设备选择** | 弹窗【选择设备】 | 居中底部抽拉式 Sheet (560px) | 左上角动态雷达声呐扩散动画,顶部阻尼把手,BLE 胶囊标签 |
|
||||
|
||||
---
|
||||
|
||||
## 3. 全局 Design Tokens 声明
|
||||
|
||||
```css
|
||||
:root {
|
||||
--color-primary: #2563EB;
|
||||
--color-primary-dark: #1D4ED8;
|
||||
--color-on-primary-container: #1E40AF;
|
||||
--color-primary-light: #EFF6FF;
|
||||
--color-primary-container: #EFF6FF;
|
||||
--color-primary-border: #DBEAFE;
|
||||
--color-primary-glow: rgba(37, 99, 235, 0.25);
|
||||
--color-primary-gradient: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
|
||||
|
||||
--color-surface: #FFFFFF;
|
||||
--color-surface-variant: #F8FAFC;
|
||||
--color-background: #EEF2F6;
|
||||
|
||||
--text-main: #0F172A;
|
||||
--text-sub: #64748B;
|
||||
--text-dim: #94A3B8;
|
||||
|
||||
--divider: #E2E8F0;
|
||||
--terminal-bg: #0F172A;
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,909 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>EAPManageUI - 手环升级 (DFU固件升级 UI 重构基准)</title>
|
||||
<style>
|
||||
/* =========================================================================
|
||||
:root 全量 Design Tokens 声明 (严格遵循全局核心主色蓝 #2563EB 标准)
|
||||
========================================================================= */
|
||||
:root {
|
||||
/* ── 核心主题色 (Global Primary Blue Standard) ── */
|
||||
--color-primary: #2563EB;
|
||||
--color-primary-dark: #1D4ED8;
|
||||
--color-on-primary-container: #1E40AF;
|
||||
--color-primary-light: #EFF6FF;
|
||||
--color-primary-container: #EFF6FF;
|
||||
--color-primary-border: #DBEAFE;
|
||||
--color-primary-glow: rgba(37, 99, 235, 0.25);
|
||||
--color-primary-gradient: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
|
||||
|
||||
/* ── 表面与背景 ── */
|
||||
--color-surface: #FFFFFF;
|
||||
--color-surface-variant: #F8FAFC;
|
||||
--color-background: #EEF2F6;
|
||||
|
||||
/* ── 文本语义色 ── */
|
||||
--text-main: #0F172A;
|
||||
--text-sub: #64748B;
|
||||
--text-dim: #94A3B8;
|
||||
|
||||
/* ── 边框与分割线 ── */
|
||||
--divider: #E2E8F0;
|
||||
--border-card: #E2E8F0;
|
||||
--border-light: rgba(0, 0, 0, 0.05);
|
||||
|
||||
/* ── 语义警示与成功 ── */
|
||||
--warning: #F59E0B;
|
||||
--warning-light: #FEF3C7;
|
||||
--warning-border: #FDE68A;
|
||||
--warning-text: #D97706;
|
||||
|
||||
--success: #10B981;
|
||||
--success-light: #ECFDF5;
|
||||
|
||||
--terminal-bg: #0F172A;
|
||||
|
||||
/* ── 圆角与阴影 ── */
|
||||
--corner-card: 16px;
|
||||
--corner-item: 10px;
|
||||
--shadow-card: 0 4px 16px rgba(15, 23, 42, 0.03);
|
||||
--shadow-hover: 0 8px 24px rgba(15, 23, 42, 0.05);
|
||||
|
||||
/* ── 尺寸与栅格 ── */
|
||||
--content-max-width: 1160px;
|
||||
--content-gutter: clamp(16px, 2.5vw, 32px);
|
||||
--appbar-height: 60px;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
html {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Segoe UI", Roboto, sans-serif;
|
||||
background: var(--color-background);
|
||||
color: var(--text-main);
|
||||
min-height: 100vh;
|
||||
padding: var(--content-gutter);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* 视口模拟器容器 (大屏动态自适应) */
|
||||
.device-wrapper {
|
||||
width: 100%;
|
||||
max-width: var(--content-max-width);
|
||||
margin: 0 auto;
|
||||
background: var(--color-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;
|
||||
}
|
||||
|
||||
/* =========================================================================
|
||||
1. AppBar 顶部导航栏统一规范 (40dp 纯净透明触控槽 + Hover 微圆底)
|
||||
========================================================================= */
|
||||
.appbar {
|
||||
height: var(--appbar-height);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 20px;
|
||||
border-bottom: 1px solid var(--divider);
|
||||
background: var(--color-surface);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.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;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.appbar-nav:hover, .appbar-more:hover {
|
||||
background: rgba(15, 23, 42, 0.06);
|
||||
transform: scale(0.96);
|
||||
}
|
||||
|
||||
.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;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
/* =========================================================================
|
||||
2. 主体流体双栏仪表盘 (Fluid Two-Column Industrial Dashboard)
|
||||
========================================================================= */
|
||||
.main-dashboard {
|
||||
padding: clamp(20px, 2.5vw, 30px);
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1.15fr;
|
||||
gap: clamp(16px, 2vw, 24px);
|
||||
background: var(--color-surface-variant);
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
max-height: calc(100vh - 120px);
|
||||
}
|
||||
|
||||
.dash-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.card-box {
|
||||
background: var(--color-surface);
|
||||
border: 1.5px solid var(--border-card);
|
||||
border-radius: var(--corner-card);
|
||||
padding: 22px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
box-shadow: var(--shadow-card);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.card-box:hover {
|
||||
box-shadow: var(--shadow-hover);
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px solid var(--divider);
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: var(--color-primary);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.conn-badge {
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
padding: 3px 9px;
|
||||
border-radius: 100px;
|
||||
background: #F1F5F9;
|
||||
color: var(--text-sub);
|
||||
}
|
||||
|
||||
.conn-badge.online {
|
||||
background: var(--success-light);
|
||||
color: var(--success);
|
||||
}
|
||||
|
||||
/* 2.1 手环升级目标设备卡片 */
|
||||
.device-profile-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.device-art-icon {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
border-radius: 14px;
|
||||
background: var(--color-primary-light);
|
||||
border: 1.5px solid var(--color-primary-border);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.device-art-icon svg {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
fill: var(--color-primary);
|
||||
}
|
||||
|
||||
.device-props-grid {
|
||||
flex: 1;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.prop-item {
|
||||
background: #F8FAFC;
|
||||
border: 1px solid var(--divider);
|
||||
border-radius: 8px;
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
.prop-k {
|
||||
font-size: 11px;
|
||||
color: var(--text-sub);
|
||||
}
|
||||
|
||||
.prop-v {
|
||||
font-size: 13.5px;
|
||||
font-weight: 700;
|
||||
color: var(--text-main);
|
||||
font-family: ui-monospace, monospace;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.btn-cancel-upgrade {
|
||||
background: var(--warning-light);
|
||||
color: var(--warning-text);
|
||||
border: 1px solid var(--warning-border);
|
||||
padding: 8px 18px;
|
||||
border-radius: 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
.btn-cancel-upgrade:hover {
|
||||
background: #FDE68A;
|
||||
}
|
||||
|
||||
/* 2.2 固件包信息卡片 */
|
||||
.firmware-meta-card {
|
||||
background: #F8FAFC;
|
||||
border: 1px solid var(--divider);
|
||||
border-radius: 12px;
|
||||
padding: 14px 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.fw-name-text {
|
||||
font-size: 13.5px;
|
||||
font-weight: 700;
|
||||
color: var(--text-main);
|
||||
font-family: ui-monospace, monospace;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.fw-source-tag {
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.fw-action-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.btn-fw-action {
|
||||
background: #FFFFFF;
|
||||
border: 1.5px solid var(--divider);
|
||||
border-radius: 10px;
|
||||
padding: 10px 12px;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
color: var(--color-primary);
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.btn-fw-action:hover {
|
||||
border-color: var(--color-primary);
|
||||
background: var(--color-primary-light);
|
||||
}
|
||||
|
||||
/* 2.3 升级进度与控制台 */
|
||||
.progress-track-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
background: #F8FAFC;
|
||||
border: 1px solid var(--divider);
|
||||
border-radius: 12px;
|
||||
padding: 14px 16px;
|
||||
}
|
||||
|
||||
.progress-info-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.progress-bar-bg {
|
||||
width: 100%;
|
||||
height: 10px;
|
||||
background: #E2E8F0;
|
||||
border-radius: 100px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.progress-bar-fill {
|
||||
width: 0%;
|
||||
height: 100%;
|
||||
background: var(--color-primary-gradient);
|
||||
border-radius: 100px;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
|
||||
.btn-start-upgrade {
|
||||
width: 100%;
|
||||
background: var(--color-primary-gradient);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 13px;
|
||||
border-radius: 12px;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 4px 16px var(--color-primary-glow);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.btn-start-upgrade:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 6px 20px var(--color-primary-glow);
|
||||
}
|
||||
|
||||
.terminal-hud {
|
||||
background: var(--terminal-bg);
|
||||
border-radius: 12px;
|
||||
border: 1px solid #334155;
|
||||
padding: 12px 14px;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
font-size: 11.5px;
|
||||
color: #94A3B8;
|
||||
height: 140px;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.term-line { line-height: 1.5; }
|
||||
.term-line.info { color: #38BDF8; }
|
||||
.term-line.success { color: #4ADE80; }
|
||||
.term-line.warn { color: #FBBF24; }
|
||||
|
||||
/* =========================================================================
|
||||
3. 右下角悬浮蓝牙按钮 (FAB)
|
||||
========================================================================= */
|
||||
.bluetooth-fab {
|
||||
position: absolute;
|
||||
bottom: 24px;
|
||||
right: 24px;
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
border-radius: 16px;
|
||||
background: var(--color-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;
|
||||
transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
|
||||
z-index: 50;
|
||||
}
|
||||
|
||||
.bluetooth-fab:hover {
|
||||
transform: scale(1.08) translateY(-2px);
|
||||
border-color: var(--color-primary);
|
||||
box-shadow: 0 14px 30px var(--color-primary-glow);
|
||||
}
|
||||
|
||||
.bluetooth-fab svg {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
fill: var(--color-primary);
|
||||
}
|
||||
|
||||
/* =========================================================================
|
||||
4. 居中底部抽拉式 Sheet (Centered Bottom Drawer)
|
||||
========================================================================= */
|
||||
.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 ease;
|
||||
}
|
||||
|
||||
.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(--color-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 cubic-bezier(0.32, 0.72, 0, 1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: 490px;
|
||||
z-index: 101;
|
||||
}
|
||||
|
||||
.bottom-sheet-mask.open .bottom-sheet {
|
||||
transform: translateX(-50%) translateY(0);
|
||||
}
|
||||
|
||||
.sheet-handle-bar {
|
||||
width: 44px;
|
||||
height: 5px;
|
||||
border-radius: 10px;
|
||||
background: #CBD5E1;
|
||||
margin: 10px auto 4px;
|
||||
cursor: grab;
|
||||
}
|
||||
|
||||
.sheet-head {
|
||||
padding: 12px 24px 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px solid var(--divider);
|
||||
}
|
||||
|
||||
.sheet-title-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.radar-scanner {
|
||||
position: relative;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border-radius: 50%;
|
||||
background: var(--color-primary-light);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.radar-ring {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
border: 2px solid var(--color-primary);
|
||||
animation: radarWave 1.8s infinite ease-out;
|
||||
}
|
||||
|
||||
@keyframes radarWave {
|
||||
0% { transform: scale(0.6); opacity: 1; }
|
||||
100% { transform: scale(1.6); opacity: 0; }
|
||||
}
|
||||
|
||||
.radar-scanner svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
fill: var(--color-primary);
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.sheet-close-btn {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
border: none;
|
||||
background: #F1F5F9;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--text-sub);
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
.sheet-close-btn:hover {
|
||||
background: #E2E8F0;
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
.sheet-chips-line {
|
||||
padding: 10px 24px;
|
||||
background: #F8FAFC;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
border-bottom: 1px solid var(--divider);
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.filter-chip {
|
||||
padding: 5px 14px;
|
||||
border-radius: 100px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
border: 1px solid var(--divider);
|
||||
background: white;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.filter-chip.active {
|
||||
background: var(--color-primary-light);
|
||||
color: var(--color-primary);
|
||||
border-color: var(--color-primary-border);
|
||||
}
|
||||
|
||||
.sheet-device-list {
|
||||
padding: 14px 24px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
overflow-y: auto;
|
||||
max-height: 220px;
|
||||
}
|
||||
|
||||
.device-item-card {
|
||||
border: 1.5px solid var(--divider);
|
||||
border-radius: 14px;
|
||||
padding: 12px 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: white;
|
||||
transition: all 0.15s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.device-item-card:hover {
|
||||
border-color: var(--color-primary);
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
|
||||
}
|
||||
|
||||
.dev-badge-ble-right {
|
||||
background: var(--color-primary-light);
|
||||
color: var(--color-primary);
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
padding: 4px 10px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--color-primary-border);
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.sheet-foot {
|
||||
padding: 14px 24px 20px;
|
||||
border-top: 1px solid var(--divider);
|
||||
background: #F8FAFC;
|
||||
}
|
||||
|
||||
.btn-pause-scan {
|
||||
width: 100%;
|
||||
background: #DCFCE7;
|
||||
color: #15803D;
|
||||
border: 1px solid #BBF7D0;
|
||||
padding: 10px;
|
||||
border-radius: 12px;
|
||||
font-size: 13.5px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.main-dashboard {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="device-wrapper">
|
||||
<!-- 1. AppBar 顶部导航栏 -->
|
||||
<header class="appbar">
|
||||
<div class="appbar-left">
|
||||
<button class="appbar-nav" title="返回"><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>
|
||||
|
||||
<!-- 2. 主体双栏仪表盘布局 -->
|
||||
<main class="main-dashboard">
|
||||
<!-- 左列:待升级手环与固件包配置 -->
|
||||
<div class="dash-column">
|
||||
<!-- 待升级手环状态卡片 -->
|
||||
<section class="card-box">
|
||||
<div class="card-header">
|
||||
<span class="card-title">待升级手环状态</span>
|
||||
<span class="conn-badge" id="targetConnBadge">状态:未连接</span>
|
||||
</div>
|
||||
<div class="device-profile-box">
|
||||
<div class="device-art-icon">
|
||||
<svg viewBox="0 0 24 24"><path d="M15 1H9c-.55 0-1 .45-1 1v2.17C5.84 5.38 4 7.97 4 11v2c0 3.03 1.84 5.62 4 6.83V22c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.17c2.16-1.21 4-3.8 4-6.83v-2c0-3.03-1.84-5.62-4-6.83V2c0-.55-.45-1-1-1zm-3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z"/></svg>
|
||||
</div>
|
||||
<div class="device-props-grid">
|
||||
<div class="prop-item"><div class="prop-k">ID:</div><div class="prop-v" id="devIdVal">未连接</div></div>
|
||||
<div class="prop-item"><div class="prop-k">版本:</div><div class="prop-v" id="devVerVal">未知</div></div>
|
||||
<div class="prop-item" style="grid-column: span 2;"><div class="prop-k">电量:</div><div class="prop-v" id="devBatVal">未知</div></div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn-cancel-upgrade" onclick="cancelUpgrade()">取消升级</button>
|
||||
</section>
|
||||
|
||||
<!-- 固件包信息与源卡片 -->
|
||||
<section class="card-box">
|
||||
<div class="card-header">
|
||||
<span class="card-title">固件包与版本源</span>
|
||||
</div>
|
||||
<div class="firmware-meta-card">
|
||||
<div class="fw-name-text" id="fwFileName">SC106_FW1.00.0036_HW0.1_20260720_DFU.zip (内置 v1.00.0036)</div>
|
||||
<div class="fw-source-tag">固件来源: 内置 (优先)</div>
|
||||
</div>
|
||||
<div class="fw-action-grid">
|
||||
<button class="btn-fw-action" onclick="checkServerFw()">检查服务端版本</button>
|
||||
<button class="btn-fw-action" onclick="useBuiltinFw()">使用内置固件</button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- 右列:升级进度与日志控制台 -->
|
||||
<div class="dash-column">
|
||||
<section class="card-box" style="flex: 1;">
|
||||
<div class="card-header">
|
||||
<span class="card-title">升级进度与控制</span>
|
||||
<span id="stageBadge" style="font-size: 12px; font-weight: 700; color: var(--color-primary);">等待就绪</span>
|
||||
</div>
|
||||
|
||||
<div class="progress-track-box">
|
||||
<div class="progress-info-row">
|
||||
<span>升级进度</span>
|
||||
<span id="progressPercent" style="color: var(--color-primary);">0%</span>
|
||||
</div>
|
||||
<div class="progress-bar-bg">
|
||||
<div class="progress-bar-fill" id="progressBar"></div>
|
||||
</div>
|
||||
<div style="font-size: 12px; color: var(--text-sub); display: flex; justify-content: space-between;">
|
||||
<span id="progressStatus">状态: 待开始</span>
|
||||
<span id="speedTxt">传输速率: -- KB/s</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="btn-start-upgrade" id="btnStartDfu" onclick="startDfuProcess()">开始升级</button>
|
||||
|
||||
<!-- 同步日志控制台 -->
|
||||
<div style="display: flex; flex-direction: column; gap: 6px; flex: 1; margin-top: 4px;">
|
||||
<span style="font-size: 13px; font-weight: 700; color: var(--text-main);">升级日志控制台</span>
|
||||
<div class="terminal-hud" id="dfuTerminal">
|
||||
<div class="term-line info">[DFU-Core] 固件升级引导服务已就绪...</div>
|
||||
<div class="term-line">等待配对手环并下发 DFU 引导指令...</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- 右下角悬浮蓝牙按钮 (FAB) -->
|
||||
<button class="bluetooth-fab" onclick="openBottomSheet()" title="扫描并选择待升级手环">
|
||||
<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="sheetMask" onclick="if(event.target===this) closeBottomSheet()">
|
||||
<div class="bottom-sheet">
|
||||
<div class="sheet-handle-bar"></div>
|
||||
<div class="sheet-head">
|
||||
<div class="sheet-title-box">
|
||||
<div class="radar-scanner">
|
||||
<div class="radar-ring"></div>
|
||||
<svg viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/></svg>
|
||||
</div>
|
||||
<h2 style="font-size: 16px; font-weight: 700;">选择设备</h2>
|
||||
</div>
|
||||
<button class="sheet-close-btn" onclick="closeBottomSheet()">✕</button>
|
||||
</div>
|
||||
<div class="sheet-chips-line">
|
||||
<span class="filter-chip active" onclick="toggleChip(this)">✓ 扫描顺序</span>
|
||||
<span class="filter-chip" onclick="toggleChip(this)">名称</span>
|
||||
<span class="filter-chip" onclick="toggleChip(this)">信号强度</span>
|
||||
<span class="filter-chip" onclick="toggleChip(this)">类型</span>
|
||||
</div>
|
||||
<div class="sheet-device-list">
|
||||
<div class="device-item-card" onclick="connectTarget('CL831-62200026', 'v1.00.0035', '88%')">
|
||||
<div>
|
||||
<div style="font-weight: 700; font-size: 14.5px; font-family: monospace;">CL831-62200026</div>
|
||||
<div style="font-size: 11.5px; color: var(--text-sub); margin-top: 3px;">D9:24:0F:1C:55:FA · 信号: -89 dBm</div>
|
||||
</div>
|
||||
<span class="dev-badge-ble-right">BLE</span>
|
||||
</div>
|
||||
<div class="device-item-card" onclick="connectTarget('CL831-2200006', 'v1.00.0032', '95%')">
|
||||
<div>
|
||||
<div style="font-weight: 700; font-size: 14.5px; font-family: monospace;">CL831-2200006</div>
|
||||
<div style="font-size: 11.5px; color: var(--text-sub); margin-top: 3px;">DF:16:BC:22:2E:5B · 信号: -98 dBm</div>
|
||||
</div>
|
||||
<span class="dev-badge-ble-right">BLE</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sheet-foot">
|
||||
<button class="btn-pause-scan" id="btnScan" onclick="toggleScan()">暂停扫描</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let isConnected = false;
|
||||
let isUpgrading = false;
|
||||
let upgradeTimer = null;
|
||||
|
||||
function appendLog(t, type = '') {
|
||||
const b = document.getElementById('dfuTerminal');
|
||||
const d = document.createElement('div');
|
||||
d.className = `term-line ${type}`;
|
||||
d.innerText = `[${new Date().toTimeString().split(' ')[0]}] ${t}`;
|
||||
b.appendChild(d);
|
||||
b.scrollTop = b.scrollHeight;
|
||||
}
|
||||
|
||||
function openBottomSheet() {
|
||||
document.getElementById('sheetMask').classList.add('open');
|
||||
appendLog("展开【选择设备】面板,正在侦听周围待升级 BLE 广播...", "info");
|
||||
}
|
||||
|
||||
function closeBottomSheet() {
|
||||
document.getElementById('sheetMask').classList.remove('open');
|
||||
}
|
||||
|
||||
function toggleChip(el) {
|
||||
document.querySelectorAll('.filter-chip').forEach(c => {
|
||||
c.classList.remove('active');
|
||||
c.innerText = c.innerText.replace('✓ ', '');
|
||||
});
|
||||
el.classList.add('active');
|
||||
el.innerText = '✓ ' + el.innerText;
|
||||
appendLog(`切换设备扫描排序: ${el.innerText}`, "info");
|
||||
}
|
||||
|
||||
function connectTarget(name, ver, bat) {
|
||||
closeBottomSheet();
|
||||
appendLog(`正在连接待升级手环 [${name}]...`, "info");
|
||||
setTimeout(() => {
|
||||
isConnected = true;
|
||||
document.getElementById('devIdVal').innerText = name;
|
||||
document.getElementById('devVerVal').innerText = ver;
|
||||
document.getElementById('devBatVal').innerText = bat;
|
||||
document.getElementById('targetConnBadge').innerText = "状态:已就绪";
|
||||
document.getElementById('targetConnBadge').classList.add('online');
|
||||
document.getElementById('stageBadge').innerText = "可开始升级";
|
||||
appendLog(`已成功与 [${name}] 建立 DFU 控制信道,当前版本: ${ver},电量充足 (${bat})。`, "success");
|
||||
}, 600);
|
||||
}
|
||||
|
||||
function startDfuProcess() {
|
||||
if (!isConnected) {
|
||||
alert("请先点击右下角蓝牙按钮选择待升级手环!");
|
||||
openBottomSheet();
|
||||
return;
|
||||
}
|
||||
if (isUpgrading) return;
|
||||
isUpgrading = true;
|
||||
let progress = 0;
|
||||
document.getElementById('btnStartDfu').disabled = true;
|
||||
document.getElementById('btnStartDfu').innerText = "正在传输固件...";
|
||||
document.getElementById('progressStatus').innerText = "状态: 固件分包传输中 (GATT Write No Response)";
|
||||
document.getElementById('stageBadge').innerText = "传输中 (0%)";
|
||||
appendLog("启动 DFU 传输协议,握手 Secure Bootloader 校验公钥...", "info");
|
||||
|
||||
upgradeTimer = setInterval(() => {
|
||||
progress += Math.floor(Math.random() * 8) + 5;
|
||||
if (progress > 100) progress = 100;
|
||||
document.getElementById('progressBar').style.width = progress + '%';
|
||||
document.getElementById('progressPercent').innerText = progress + '%';
|
||||
document.getElementById('stageBadge').innerText = `传输中 (${progress}%)`;
|
||||
document.getElementById('speedTxt').innerText = `传输速率: ${(Math.random()*4 + 18).toFixed(1)} KB/s`;
|
||||
|
||||
if (progress >= 100) {
|
||||
clearInterval(upgradeTimer);
|
||||
document.getElementById('progressStatus').innerText = "状态: CRC 校验成功,手环正在重启应用新固件...";
|
||||
document.getElementById('stageBadge').innerText = "升级完成";
|
||||
document.getElementById('devVerVal').innerText = "v1.00.0036 (已最新)";
|
||||
document.getElementById('btnStartDfu').innerText = "升级完成";
|
||||
appendLog("固件数据包 100% 写入完成,CRC32 校验通过!手环正在重启生效...", "success");
|
||||
setTimeout(() => {
|
||||
alert("手环固件升级成功!新版本已生效。");
|
||||
document.getElementById('btnStartDfu').disabled = false;
|
||||
document.getElementById('btnStartDfu').innerText = "开始升级";
|
||||
isUpgrading = false;
|
||||
}, 1000);
|
||||
}
|
||||
}, 400);
|
||||
}
|
||||
|
||||
function cancelUpgrade() {
|
||||
if (isUpgrading) {
|
||||
clearInterval(upgradeTimer);
|
||||
isUpgrading = false;
|
||||
document.getElementById('btnStartDfu').disabled = false;
|
||||
document.getElementById('btnStartDfu').innerText = "开始升级";
|
||||
document.getElementById('progressBar').style.width = '0%';
|
||||
document.getElementById('progressPercent').innerText = '0%';
|
||||
document.getElementById('progressStatus').innerText = "状态: 升级已取消";
|
||||
document.getElementById('stageBadge').innerText = "已中断";
|
||||
appendLog("用户手动触发 [取消升级],已终止固件传输。", "warn");
|
||||
alert("已取消手环固件升级。");
|
||||
} else {
|
||||
appendLog("当前未处于升级传输过程中。", "info");
|
||||
}
|
||||
}
|
||||
|
||||
function checkServerFw() {
|
||||
appendLog("正在请求服务端云端固件库 API...", "info");
|
||||
setTimeout(() => {
|
||||
appendLog("检查完成:当前内置固件 v1.00.0036 已为官方最新稳定版。", "success");
|
||||
alert("服务端版本检查:当前内置固件已是最新版!");
|
||||
}, 800);
|
||||
}
|
||||
|
||||
function useBuiltinFw() {
|
||||
appendLog("已切换为本地内置固件源:SC106_FW1.00.0036_HW0.1_20260720_DFU.zip", "info");
|
||||
alert("已切换并锁定为本地内置固件!");
|
||||
}
|
||||
|
||||
function toggleScan() {
|
||||
const b = document.getElementById('btnScan');
|
||||
if (b.innerText === "暂停扫描") {
|
||||
b.innerText = "继续扫描";
|
||||
b.style.background = "#FEF3C7";
|
||||
b.style.color = "#D97706";
|
||||
appendLog("已暂停 BLE 设备广播扫描。", "warn");
|
||||
} else {
|
||||
b.innerText = "暂停扫描";
|
||||
b.style.background = "#DCFCE7";
|
||||
b.style.color = "#15803D";
|
||||
appendLog("已恢复 BLE 广播扫描...", "info");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 90 KiB |
@@ -0,0 +1,24 @@
|
||||
# 手环升级 (DFU固件升级) 实施计划 (Implementation Plan)
|
||||
|
||||
## 1. 目标与需求对齐
|
||||
重构【手环升级 (DFU固件升级)】界面,严格保证原机全部信息与操作槽位零遗漏,并与前序页面(手环配置、自动连接配置、心率区间设置、版型切换、语言设置)达成 100% 视觉风格与全局主色蓝规范(`#2563EB`)的完全统一。
|
||||
|
||||
## 2. 方案技术架构
|
||||
- **布局策略**:采用自适应流体双栏栅格 (`grid-template-columns: 1fr 1.15fr`);
|
||||
- **抽屉架构**:居中自适应底部抽拉式 Sheet 面板 (`width: min(92%, 560px); left: 50%; transform: translateX(-50%)`);
|
||||
- **动效引擎**:
|
||||
- 左上角声呐扫描动态雷达(`animation: radarWave 1.8s infinite`);
|
||||
- 进度条平滑补间动画;
|
||||
- 实时同步日志控制台自动触底滚动机制;
|
||||
- **交互逻辑闭环**:
|
||||
- 点击 FAB 呼出底部设备选择面板;
|
||||
- 点击设备卡片建立 BLE DFU 信道并回填硬件属性;
|
||||
- 点击【开始升级】触发多阶段进度分包下发与日志打印;
|
||||
- 点击【取消升级】执行安全熔断与状态复位。
|
||||
|
||||
## 3. 验收与交付标准
|
||||
1. `Screenshot_20260812_143413.png` 原机截屏已校验锁定;
|
||||
2. `baseline_ui.html` 纯 HTML/CSS/JS 全功能可交互代码交付;
|
||||
3. `image.png` 无头 Chrome 自动渲染生成;
|
||||
4. `DESIGN_SPEC.md` 与 `implementation_plan.md` 设计与技术文档齐备;
|
||||
5. `CARD-20260817-UITask-DFU固件升级.md` 任务卡齐备。
|
||||
Reference in New Issue
Block a user