16e3a2e698
【已完成优化与色彩统一的页面清单】: 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
850 lines
27 KiB
HTML
850 lines
27 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>手环配置</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>
|