feat(ui): 交付手环配置并完成已修改页面的主色蓝统一优化(语言设置、版型切换、心率区间设置、自动连接配置、手环配置)

【已完成优化与色彩统一的页面清单】:
1. 语言设置(完成主色蓝统一 #2563EB,单选框/指示条/文字/图标底色对齐,重新渲染 image.png)
2. 版型切换(完成主色蓝统一 #2563EB,消除偏紫杂色,选中边框/单选框/标题对齐,重新渲染 image.png)
3. 心率区间设置(完成主色蓝统一 #2563EB,年龄数值与Slider滑块对齐,重新渲染 image.png)
4. 自动连接配置(完成主色蓝统一 #2563EB,重新渲染 image.png)
5. 手环配置(全新交付6件套标准物料,采用流体双栏架构、居中底部抽拉式Sheet、动态雷达声呐、右下角蓝牙FAB、BLE直连标签与实时同步日志控制台,主色蓝统一 #2563EB)

【全局规范更新】:
- README.md 固化《全局核心主色蓝统一规范》,所有蓝色元素 100% 严格收敛为 #2563EB
This commit is contained in:
zhy200308
2026-08-17 17:15:54 +08:00
parent c50d6f00f5
commit 16e3a2e698
24 changed files with 2866 additions and 18 deletions
@@ -0,0 +1,28 @@
# UI 交付任务卡 (CARD-20260817-UITask-手环配置)
- **页面名称**:手环配置
- **原机截屏**:`Screenshot_20260812_143405.png`
- **中选方案**:方案 5 (Fluid Modern Studio 双栏 + 底部抽拉 Sheet + 实时日志控制台)
- **交付状态**:`COMPLETED (6 件齐)`
- **交付日期**:2026-08-17
---
## 交付文件清单
1. 📷 **原厂截屏**:[`Screenshot_20260812_143405.png`](file:///Users/z/source/repos/kmcc/EAP_Interface_html/设置页面UI优化/手环配置/Screenshot_20260812_143405.png)
2. 🖼️ **高保真渲染图**:[`image.png`](file:///Users/z/source/repos/kmcc/EAP_Interface_html/设置页面UI优化/手环配置/image.png)
3. 💻 **标准交互前端**:[`baseline_ui.html`](file:///Users/z/source/repos/kmcc/EAP_Interface_html/设置页面UI优化/手环配置/baseline_ui.html)
4. 📐 **设计规格文档**:[`DESIGN_SPEC.md`](file:///Users/z/source/repos/kmcc/EAP_Interface_html/设置页面UI优化/手环配置/DESIGN_SPEC.md)
5. 📝 **工程实施计划**:[`implementation_plan.md`](file:///Users/z/source/repos/kmcc/EAP_Interface_html/设置页面UI优化/手环配置/implementation_plan.md)
6. 🗂️ **UI 任务卡片**:[`CARD-20260817-UITask-手环配置.md`](file:///Users/z/source/repos/kmcc/EAP_Interface_html/设置页面UI优化/手环配置/CARD-20260817-UITask-手环配置.md)
---
## 核心设计与交互指标
- **版面布局**:1:1 流体双栏自适应体系,左侧承载设备信息与心率预警,右侧承载离线数据同步与全高度日志控制台;
- **抽拉面板**:从底部向上抽拉的 Bottom Sheet 面板,配备拖拽把手、左上角动态雷达声呐波纹、排序/过滤 Chips 与设备发现列表;
- **悬浮按钮**:右下角常驻 52dp 悬浮蓝牙 FAB;
- **控制台终端**:深色 Terminal 实时打印带时间戳的蓝牙操作日志;
- **规范遵循**:40dp 纯净透明 AppBar 触控槽 + `clamp(16px, 2.5vw, 32px)` 动态响应式页边距。
@@ -0,0 +1,49 @@
# 【手环配置】设计规格规范 (DESIGN_SPEC.md)
## 1. 业务功能与信息架构
- **页面定位**:心率手环 BLE 连接管理、运行参数遥测、心率预警区间阈值下发与离线运动历史数据拉取终端。
- **页面形态**:现代流体双栏仪表盘架构(左侧硬件参数与心率预警核心栈 + 右侧离线同步与实时日志控制台) + 底部平滑抽拉式设备选择面板(Bottom Sheet Drawer)。
---
## 2. 字段与槽位 100% 完整度对照
| 区域 / 组件 | 字段 / 控件名称 | 视觉与默认值 | 交互响应 |
| :--- | :--- | :--- | :--- |
| **AppBar** | 返回按键 `(←)` | 40dp 纯净圆形透明触控槽 | 点击返回上一级菜单 |
| | 页面标题 | `手环配置` (19px 粗体) | 居左对齐 |
| | 更多操作 `(⋮)` | 40dp 纯净圆形透明触控槽 | 点击展开辅助菜单 |
| **手环设备信息** | 标题与状态 | `手环设备信息` + `状态:未连接` / `状态:已连接` | 实时根据连接状态点亮绿色徽章 |
| | 设备名称 | `设备名称: 未连接` / `CL831-62200026` | 动态绑定 GATT 配对设备名 |
| | MAC 地址 | `MAC 地址: 设备ID: 未知` / `D9:24:0F:1C:55:FA` | 等宽字体展示 MAC |
| | 设备电量 | `设备电量: 电量: 未知` / `88% (正常)` | 实时电量遥测数值 |
| | 固件版本 | `固件版本: 固件版本: 未知` / `v2.1.04-BLE` | 固件版本号 |
| | 重置手环 | `重置手环` (红色危险文字按钮) | 点击下发 Factory Reset 并在控制台打印 |
| | 断开连接 | `断开连接` (主控胶囊按钮) | 点击断开释放链路或唤起底部抽拉面板 |
| **心率预警设置** | 标题与开关 | `心率预警设置` + Switch 滑动开关 | 开启/关闭心率预警监控 |
| | 最低心率 (Min) | `最低心率 (Min):` + 下拉选择 (`40`, `50`, `60`) | 调整最低心率阈值 |
| | 最高心率 (Max) | `最高心率 (Max):` + 下拉选择 (`40`, `160`, `180`, `200`) | 调整最高心率阈值 |
| | 心率目标 (Goal) | `心率目标 (Goal):` + 下拉选择 (`40`, `130`, `140`, `150`) | 调整目标心率阈值 |
| | 保存警报阈值 | `保存警报阈值` (宽卡片按钮) | 点击下发寄存器,弹出 Toast 并在控制台记录 |
| | 状态指示文本 | `● 正在主动断开连接...` / `● 设备已在线` | 实时连接状态文字指示 |
| **历史离线数据同步** | 同步时间段选择 | `选择同步的时间段:` + 下拉框 (`过去 1 小时`, `过去 6 小时`...) | 选择拉取的时间跨度 |
| | 一键同步动作 | `一键同步历史心率/运动` (渐变主色宽按钮) | 触发离线数据包拉取动效与校验 |
| | 同步日志控制台 | `同步日志控制台` + 深色终端 HUD | 实时滚屏追加带时间戳的彩色日志流 |
| **右下角悬浮按钮** | 蓝牙 FAB 按钮 | 52dp 悬浮胶囊 `ᛒ` 图标 | 点击平滑从屏幕底部向上抽拉【选择设备】面板 |
| **底部抽拉面板** | 顶部阻尼把手 | 44×5dp 居中灰色圆角把手 | 抽屉把手 |
| | 左上角动态雷达 | 动态声呐扩散脉冲动画波纹 + `选择设备` | 实时声呐波纹旋转与扩散 |
| | 排序/过滤 Chips | `✓ 扫描顺序`, `名称`, `信号强度`, `类型` | 点击切换列表排序策略 |
| | 扫描设备列表 | `CL831-62200026`, `CL831-2200006` 等 (右侧展示 `BLE` 协议标签,移除冗余连接按钮) | 点击设备条目整行直连手环并自动收起面板 |
| | 暂停/继续扫描 | `暂停扫描` / `继续扫描` 切换按钮 | 控制蓝牙广播扫描启停 |
---
## 3. 设计 Token 与视觉规范
- **全局响应式页边距**:`padding: clamp(16px, 2.5vw, 32px);`
- **容器最大宽度**:`max-width: min(100%, 1160px);`
- **双栏栅格间距**:`gap: clamp(16px, 2vw, 24px);`
- **主色调**:`#2563EB` (Primary), `linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%)` (Gradient)
- **控制台终端背景**:`#0F172A` (Slate Dark), 终端文字 `#94A3B8` / `#38BDF8`
- **圆角体系**:外层容器 20px,主卡片 16px,参数块 10px,底部抽拉 Sheet 28px。
@@ -0,0 +1,849 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>手环配置</title>
<style>
:root {
--primary: #2563EB;
--primary-hover: #1D4ED8;
--primary-light: #EFF6FF;
--primary-glow: rgba(37, 99, 235, 0.25);
--primary-gradient: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
--bg: #EEF2F6;
--surface: #FFFFFF;
--surface-sub: #F8FAFC;
--text-main: #0F172A;
--text-sub: #64748B;
--text-dim: #94A3B8;
--divider: #E2E8F0;
--danger: #EF4444;
--danger-light: #FEF2F2;
--success: #10B981;
--success-light: #ECFDF5;
--terminal-bg: #0F172A;
--terminal-text: #38BDF8;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "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;
-webkit-font-smoothing: antialiased;
}
.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;
}
/* =========================================================================
1. AppBar 统一全局规范
========================================================================= */
.appbar {
height: 60px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
border-bottom: 1px solid var(--divider);
background: var(--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; }
/* =========================================================================
2. 主界面流体双栏仪表盘 (Fluid Studio Dual-Column)
========================================================================= */
.main-dashboard {
padding: clamp(20px, 2.5vw, 30px);
display: grid;
grid-template-columns: 1fr 1fr;
gap: clamp(16px, 2vw, 24px);
background: #F8FAFC;
flex: 1;
overflow-y: auto;
max-height: calc(100vh - 120px);
}
.dash-column {
display: flex;
flex-direction: column;
gap: 18px;
}
.card-box {
background: var(--surface);
border: 1.5px solid var(--divider);
border-radius: 16px;
padding: 22px;
display: flex;
flex-direction: column;
gap: 16px;
box-shadow: 0 4px 16px rgba(15, 23, 42, 0.03);
transition: all 0.2s ease;
}
.card-box:hover { box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05); }
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid var(--divider);
padding-bottom: 12px;
}
.card-title-group {
display: flex;
align-items: center;
gap: 8px;
}
.card-title {
font-size: 16px;
font-weight: 700;
color: var(--primary);
}
.conn-tag {
font-size: 12px;
font-weight: 700;
color: var(--text-sub);
background: #F1F5F9;
padding: 3px 9px;
border-radius: 100px;
transition: all 0.2s ease;
}
.conn-tag.online {
background: var(--success-light);
color: var(--success);
}
/* 2.1 手环设备信息 4格网格 */
.device-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
}
.param-tile {
background: #F8FAFC;
border: 1px solid var(--divider);
border-radius: 10px;
padding: 10px 14px;
}
.param-label { font-size: 11.5px; color: var(--text-sub); margin-bottom: 2px; }
.param-value {
font-size: 13.5px;
font-weight: 700;
color: var(--text-main);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.device-action-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 4px;
}
.btn-text-danger {
background: transparent;
color: var(--danger);
border: none;
font-size: 13.5px;
font-weight: 700;
cursor: pointer;
padding: 6px 10px;
border-radius: 6px;
transition: background 0.15s;
}
.btn-text-danger:hover { background: var(--danger-light); }
.btn-disconnect {
background: #E2E8F0;
color: var(--text-sub);
border: none;
font-size: 13px;
font-weight: 700;
padding: 8px 20px;
border-radius: 9px;
cursor: pointer;
transition: all 0.2s ease;
}
.btn-disconnect.active {
background: var(--primary-gradient);
color: white;
box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-disconnect.active:hover { transform: translateY(-1px); }
/* 2.2 心率预警设置 */
.switch { position: relative; width: 46px; height: 25px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
background-color: #CBD5E1; transition: .25s; border-radius: 25px;
}
.slider:before {
position: absolute; content: ""; height: 19px; width: 19px; left: 3px; bottom: 3px;
background-color: white; transition: .25s; border-radius: 50%;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(21px); }
.hr-control-stack {
display: flex;
flex-direction: column;
gap: 8px;
}
.hr-control-row {
display: flex;
align-items: center;
justify-content: space-between;
background: #F8FAFC;
border: 1px solid var(--divider);
border-radius: 10px;
padding: 10px 14px;
}
.hr-row-label { font-size: 13px; font-weight: 600; color: var(--text-main); }
.custom-select {
background: white;
border: 1.5px solid var(--divider);
border-radius: 8px;
padding: 5px 28px 5px 12px;
font-size: 13.5px;
font-weight: 700;
color: var(--primary);
appearance: none;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2364748B' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 8px center;
cursor: pointer;
transition: border-color 0.15s;
}
.custom-select:hover, .custom-select:focus { border-color: var(--primary); outline: none; }
.btn-wide-action {
width: 100%;
background: #E2E8F0;
color: #334155;
border: none;
padding: 11px;
border-radius: 10px;
font-size: 13.5px;
font-weight: 700;
cursor: pointer;
transition: all 0.2s;
}
.btn-wide-action:hover { background: #CBD5E1; color: var(--text-main); }
.status-hint-text {
font-size: 12px;
color: var(--success);
font-weight: 600;
display: flex;
align-items: center;
gap: 6px;
}
/* 2.3 历史离线数据同步与控制台 */
.sync-time-row {
display: flex;
align-items: center;
justify-content: space-between;
background: #F8FAFC;
border: 1px solid var(--divider);
border-radius: 10px;
padding: 10px 14px;
}
.btn-sync-primary {
width: 100%;
background: var(--primary-gradient);
color: white;
border: none;
padding: 11px;
border-radius: 10px;
font-size: 13.5px;
font-weight: 700;
cursor: pointer;
box-shadow: 0 4px 14px var(--primary-glow);
transition: all 0.2s;
}
.btn-sync-primary:hover {
transform: translateY(-1px);
box-shadow: 0 6px 18px var(--primary-glow);
}
.terminal-container {
display: flex;
flex-direction: column;
gap: 8px;
flex: 1;
margin-top: 4px;
}
.terminal-title { font-size: 13px; font-weight: 700; color: var(--text-main); }
.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: 150px;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 4px;
}
.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(--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(--primary);
box-shadow: 0 14px 30px var(--primary-glow);
}
.bluetooth-fab svg { width: 24px; height: 24px; fill: var(--primary); }
/* =========================================================================
4. 底部抽拉式 Sheet (Bottom Sheet 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(--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(--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(--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(--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); }
/* 排序与过滤 Chips */
.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(--primary-light);
color: var(--primary);
border-color: #BFDBFE;
}
/* 扫描设备列表 */
.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(--primary);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}
.dev-badge-ble-right {
background: #EFF6FF;
color: var(--primary);
font-size: 12px;
font-weight: 800;
padding: 4px 10px;
border-radius: 6px;
border: 1px solid #DBEAFE;
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;
}
.btn-pause-scan:hover { background: #BBF7D0; }
/* Toast 提示 */
.toast-msg {
position: absolute;
top: 70px;
left: 50%;
transform: translateX(-50%) translateY(-20px);
background: rgba(15, 23, 42, 0.9);
color: white;
padding: 8px 20px;
border-radius: 30px;
font-size: 13px;
font-weight: 600;
opacity: 0;
pointer-events: none;
transition: all 0.25s ease;
z-index: 200;
}
.toast-msg.show { opacity: 1; transform: translateX(-50%) translateY(0); }
</style>
</head>
<body>
<div class="device-wrapper">
<div id="toast" class="toast-msg">提示消息</div>
<!-- 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>
<!-- 主体流体双栏布局 -->
<main class="main-dashboard">
<!-- 左列:手环设备信息与心率预警 -->
<div class="dash-column">
<!-- 1. 手环设备信息 -->
<section class="card-box">
<div class="card-header">
<div class="card-title-group">
<span class="card-title">手环设备信息</span>
</div>
<span class="conn-tag" id="connStatusBadge">状态:未连接</span>
</div>
<div class="device-grid">
<div class="param-tile">
<div class="param-label">设备名称:</div>
<div class="param-value" id="valDevName">未连接</div>
</div>
<div class="param-tile">
<div class="param-label">MAC 地址:</div>
<div class="param-value" id="valMac">设备ID: 未知</div>
</div>
<div class="param-tile">
<div class="param-label">设备电量:</div>
<div class="param-value" id="valBattery">电量: 未知</div>
</div>
<div class="param-tile">
<div class="param-label">固件版本:</div>
<div class="param-value" id="valFirmware">固件版本: 未知</div>
</div>
</div>
<div class="device-action-row">
<button class="btn-text-danger" onclick="triggerReset()">重置手环</button>
<button class="btn-disconnect" id="btnDisconnect" onclick="toggleDisconnect()">断开连接</button>
</div>
</section>
<!-- 2. 心率预警设置 -->
<section class="card-box">
<div class="card-header">
<div class="card-title-group">
<span class="card-title">心率预警设置</span>
</div>
<label class="switch"><input type="checkbox" id="swHrAlert" checked onchange="toggleHrSwitch()"><span class="slider"></span></label>
</div>
<div class="hr-control-stack">
<div class="hr-control-row">
<span class="hr-row-label">最低心率 (Min):</span>
<select class="custom-select" id="selMinHr"><option>40</option><option>50</option><option>60</option></select>
</div>
<div class="hr-control-row">
<span class="hr-row-label">最高心率 (Max):</span>
<select class="custom-select" id="selMaxHr"><option>40</option><option>160</option><option selected>180</option><option>200</option></select>
</div>
<div class="hr-control-row">
<span class="hr-row-label">心率目标 (Goal):</span>
<select class="custom-select" id="selGoalHr"><option>40</option><option>130</option><option selected>140</option><option>150</option></select>
</div>
</div>
<button class="btn-wide-action" onclick="saveHrThresholds()">保存警报阈值</button>
<div class="status-hint-text" id="statusHintText">● 正在主动断开连接...</div>
</section>
</div>
<!-- 右列:历史离线数据同步与日志控制台 -->
<div class="dash-column">
<section class="card-box" style="flex: 1;">
<div class="card-header">
<div class="card-title-group">
<span class="card-title">历史离线数据同步</span>
</div>
</div>
<div class="sync-time-row">
<span style="font-size: 13.5px; font-weight: 600; color: var(--text-main);">选择同步的时间段:</span>
<select class="custom-select" id="selSyncDuration" style="min-width: 140px;">
<option>过去 1 小时</option>
<option>过去 6 小时</option>
<option>过去 24 小时</option>
<option>全部离线历史</option>
</select>
</div>
<button class="btn-sync-primary" onclick="startSyncOfflineData()">一键同步历史心率/运动</button>
<!-- 同步日志控制台 -->
<div class="terminal-container">
<span class="terminal-title">同步日志控制台</span>
<div class="terminal-hud" id="logTerminal">
<div class="term-line info">[系统就绪] 手环管理服务已启动,等待指令...</div>
<div class="term-line">正在主动断开连接...</div>
</div>
</div>
</section>
</div>
</main>
<!-- 右下角悬浮蓝牙按钮 (FAB) -->
<button class="bluetooth-fab" id="btFab" title="扫描并选择手环" onclick="openBottomSheet()">
<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 (Bottom 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="connectDevice('CL831-62200026', 'D9:24:0F:1C:55:FA', '88%')">
<div>
<div style="font-weight: 700; font-size: 14.5px; font-family: ui-monospace, SFMono-Regular, monospace; color: var(--text-main);">
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="connectDevice('CL831-2200006', 'DF:16:BC:22:2E:5B', '95%')">
<div>
<div style="font-weight: 700; font-size: 14.5px; font-family: ui-monospace, SFMono-Regular, monospace; color: var(--text-main);">
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="btnScanToggle" onclick="toggleScanState()">暂停扫描</button>
</div>
</div>
</div>
</div>
<script>
let isScanning = true;
let isConnected = false;
function showToast(msg) {
const t = document.getElementById('toast');
t.innerText = msg;
t.classList.add('show');
setTimeout(() => t.classList.remove('show'), 2000);
}
function appendLog(text, type = '') {
const box = document.getElementById('logTerminal');
const time = new Date().toTimeString().split(' ')[0];
const div = document.createElement('div');
div.className = `term-line ${type}`;
div.innerText = `[${time}] ${text}`;
box.appendChild(div);
box.scrollTop = box.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 toggleScanState() {
const btn = document.getElementById('btnScanToggle');
if (isScanning) {
isScanning = false;
btn.innerText = "继续扫描";
btn.style.background = "#FEF3C7";
btn.style.color = "#D97706";
btn.style.borderColor = "#FDE68A";
appendLog("已暂停 BLE 广播扫描。", "warn");
} else {
isScanning = true;
btn.innerText = "暂停扫描";
btn.style.background = "#DCFCE7";
btn.style.color = "#15803D";
btn.style.borderColor = "#BBF7D0";
appendLog("已恢复 BLE 广播扫描...", "info");
}
}
function connectDevice(name, mac, battery) {
closeBottomSheet();
showToast(`正在连接手环 ${name}...`);
appendLog(`正在尝试与设备 [${name} | ${mac}] 建立 GATT 连接...`, "info");
setTimeout(() => {
isConnected = true;
document.getElementById('valDevName').innerText = name;
document.getElementById('valMac').innerText = mac;
document.getElementById('valBattery').innerText = `${battery} (正常)`;
document.getElementById('valFirmware').innerText = "v2.1.04-BLE";
document.getElementById('connStatusBadge').innerText = "状态:已连接";
document.getElementById('connStatusBadge').classList.add('online');
document.getElementById('btnDisconnect').classList.add('active');
document.getElementById('statusHintText').innerText = `● 设备已在线 [${name}]`;
document.getElementById('statusHintText').style.color = "var(--success)";
appendLog(`成功连接到手环 [${name}]!设备电量: ${battery},固件: v2.1.04-BLE`, "success");
showToast(`已成功连接 ${name}`);
}, 700);
}
function toggleDisconnect() {
if (!isConnected) {
openBottomSheet();
return;
}
isConnected = false;
document.getElementById('valDevName').innerText = "未连接";
document.getElementById('valMac').innerText = "设备ID: 未知";
document.getElementById('valBattery').innerText = "电量: 未知";
document.getElementById('valFirmware').innerText = "固件版本: 未知";
document.getElementById('connStatusBadge').innerText = "状态:未连接";
document.getElementById('connStatusBadge').classList.remove('online');
document.getElementById('btnDisconnect').classList.remove('active');
document.getElementById('statusHintText').innerText = "● 正在主动断开连接...";
document.getElementById('statusHintText').style.color = "#64748B";
appendLog("正在主动断开连接... 设备已释放。", "warn");
showToast("已断开手环连接");
}
function triggerReset() {
appendLog("向手环发送重置指令 (Factory Reset)...", "warn");
showToast("手环重置指令已下发");
}
function toggleHrSwitch() {
const checked = document.getElementById('swHrAlert').checked;
appendLog(`心率预警总开关已切换为: ${checked ? '开启 (ON)' : '关闭 (OFF)'}`, "info");
}
function saveHrThresholds() {
const min = document.getElementById('selMinHr').value;
const max = document.getElementById('selMaxHr').value;
const goal = document.getElementById('selGoalHr').value;
appendLog(`保存警报阈值成功 -> 最低: ${min} BPM | 最高: ${max} BPM | 目标: ${goal} BPM`, "success");
showToast("心率预警阈值保存成功!");
}
function startSyncOfflineData() {
if (!isConnected) {
showToast("请先连接手环后再同步离线数据!");
appendLog("同步失败:未检测到已连接的手环设备。", "warn");
openBottomSheet();
return;
}
const dur = document.getElementById('selSyncDuration').value;
appendLog(`开始同步 [${dur}] 离线历史数据包...`, "info");
showToast(`正在同步 ${dur} 数据...`);
setTimeout(() => {
appendLog(`离线数据包同步完成:共拉取 320 条心率/运动原始帧数据,校验无误。`, "success");
showToast("历史离线数据同步完成!");
}, 1200);
}
</script>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

@@ -0,0 +1,35 @@
# 【手环配置】实施工程计划 (implementation_plan.md)
## 1. 目标与范围
重构手环配置页面,将其从原始单调生硬的上下垂直灰条堆叠,升级为 **高质感现代流体双栏仪表盘架构**,同时将传统的居中设备弹窗重构为 **从底部平滑抽拉的 Bottom Sheet 面板**,并在历史离线数据同步模块下方集成 **实时滚屏日志控制台 Terminal**。
---
## 2. 核心实施模块
1. **结构与布局升级**:
- 顶部统一 40dp 纯净透明圆形触控返回与更多按钮;
- 页面主体采用 `1fr 1fr` 流体响应式双栏:
- 左栏包含:【手环设备信息】4格硬件遥测网格 + 【心率预警设置】三阈值调节与保存;
- 右栏包含:【历史离线数据同步】时段选择 + 同步主按钮 + 高度自适应撑满的【同步日志控制台】。
2. **底部抽拉面板 (Bottom Sheet Drawer)**:
- 采用 `transform: translateY(100%) -> translateY(0)` 贝塞尔平滑过场;
- 左上角集成 CSS Concentric Wave 动态雷达声呐扩散动画;
- 包含 Chips 排序过滤与设备发现列表。
3. **右下角悬浮蓝牙 FAB**:
- 悬浮在页面右下角,点击快速唤起底部抽拉面板,收起后常驻。
4. **JavaScript 真实状态机交互闭环**:
- 具备完整的连接、断开、重置、阈值保存、离线同步、控制台彩色日志追加打印等全套活生生的逻辑。
---
## 3. 验证与交付标准
- [x] 100% 还原真机全部字段与槽位;
- [x] AppBar 40dp 透明无底触控规范落地;
- [x] `clamp(16px, 2.5vw, 32px)` 动态边距与双栏自适应体系落地;
- [x] 底部抽拉式 Sheet 与雷达动画落地;
- [x] 同步日志控制台与全交互状态机落地;
- [x] 无头 Chrome 全自动截图落盘 `image.png`;
- [x] 6 件套交付物齐备。