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:
@@ -0,0 +1,630 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>方案 1:Apple HealthKit 灵动岛屿 + 底部抽拉 Sheet</title>
|
||||
<style>
|
||||
:root {
|
||||
--primary: #2563EB;
|
||||
--primary-light: #EFF6FF;
|
||||
--primary-glow: rgba(37, 99, 235, 0.2);
|
||||
--bg: #EEF2F6;
|
||||
--surface: #FFFFFF;
|
||||
--text-main: #0F172A;
|
||||
--text-sub: #64748B;
|
||||
--divider: #E2E8F0;
|
||||
--danger: #EF4444;
|
||||
--danger-light: #FEF2F2;
|
||||
--success: #10B981;
|
||||
--terminal-bg: #0F172A;
|
||||
}
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Segoe UI", 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: 24px;
|
||||
border: 1px solid var(--divider);
|
||||
box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.08);
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
min-height: 640px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
/* 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列非对称现代仪表盘 */
|
||||
.main-dashboard {
|
||||
flex: 1;
|
||||
padding: clamp(20px, 2.5vw, 28px);
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1.15fr;
|
||||
gap: clamp(16px, 2vw, 24px);
|
||||
background: #F8FAFC;
|
||||
overflow-y: auto;
|
||||
max-height: 660px;
|
||||
}
|
||||
|
||||
.dash-col { display: flex; flex-direction: column; gap: 18px; }
|
||||
|
||||
.health-card {
|
||||
background: var(--surface);
|
||||
border-radius: 18px;
|
||||
border: 1.5px solid var(--divider);
|
||||
padding: 20px 22px;
|
||||
box-shadow: 0 4px 16px rgba(15, 23, 42, 0.03);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px solid var(--divider);
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
.card-title-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.card-icon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.icon-blue { background: #EFF6FF; fill: #2563EB; }
|
||||
.icon-red { background: #FEF2F2; fill: #EF4444; }
|
||||
.icon-green { background: #ECFDF5; fill: #10B981; }
|
||||
|
||||
.card-title-text { font-size: 15.5px; font-weight: 700; color: var(--text-main); }
|
||||
.status-pill {
|
||||
font-size: 11.5px;
|
||||
font-weight: 700;
|
||||
padding: 3px 8px;
|
||||
border-radius: 100px;
|
||||
background: #F1F5F9;
|
||||
color: var(--text-sub);
|
||||
}
|
||||
.status-pill.connected { background: #ECFDF5; color: #10B981; }
|
||||
|
||||
/* 遥测参数流 */
|
||||
.telemetry-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px;
|
||||
}
|
||||
.tele-cell {
|
||||
background: #F8FAFC;
|
||||
border: 1px solid var(--divider);
|
||||
border-radius: 12px;
|
||||
padding: 10px 14px;
|
||||
}
|
||||
.tele-lbl { font-size: 11.5px; color: var(--text-sub); }
|
||||
.tele-val { font-size: 14px; font-weight: 700; color: var(--text-main); margin-top: 3px; font-family: ui-monospace, monospace; }
|
||||
|
||||
.action-line {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.btn-text-danger { color: var(--danger); background: transparent; border: none; font-size: 13px; font-weight: 700; cursor: pointer; padding: 6px; }
|
||||
.btn-action-primary {
|
||||
background: #E2E8F0;
|
||||
color: var(--text-sub);
|
||||
border: none;
|
||||
padding: 8px 18px;
|
||||
border-radius: 10px;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.btn-action-primary.active { background: var(--primary); color: white; box-shadow: 0 4px 12px var(--primary-glow); }
|
||||
|
||||
/* 心率调节卡片 */
|
||||
.hr-stack {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
.hr-row-card {
|
||||
background: #F8FAFC;
|
||||
border: 1px solid var(--divider);
|
||||
border-radius: 12px;
|
||||
padding: 10px 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.hr-row-name { font-size: 13px; font-weight: 600; }
|
||||
.hr-select-pill {
|
||||
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;
|
||||
}
|
||||
|
||||
.btn-wide {
|
||||
width: 100%;
|
||||
padding: 11px;
|
||||
border-radius: 10px;
|
||||
font-size: 13.5px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.btn-wide.secondary { background: #E2E8F0; color: #334155; }
|
||||
.btn-wide.primary { background: var(--primary); color: white; box-shadow: 0 4px 14px var(--primary-glow); }
|
||||
|
||||
/* 控制台终端 */
|
||||
.terminal-hud {
|
||||
background: var(--terminal-bg);
|
||||
border-radius: 12px;
|
||||
border: 1px solid #1E293B;
|
||||
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;
|
||||
}
|
||||
.term-line { line-height: 1.5; }
|
||||
.term-line.info { color: #38BDF8; }
|
||||
.term-line.success { color: #4ADE80; }
|
||||
.term-line.warn { color: #FBBF24; }
|
||||
|
||||
/* Switch 开关 */
|
||||
.switch { position: relative; width: 44px; height: 24px; }
|
||||
.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: 24px;
|
||||
}
|
||||
.slider:before {
|
||||
position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
|
||||
background-color: white; transition: .25s; border-radius: 50%;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
input:checked + .slider { background-color: var(--primary); }
|
||||
input:checked + .slider:before { transform: translateX(20px); }
|
||||
|
||||
/* 右下角悬浮蓝牙按钮 (FAB) */
|
||||
.bt-floating-btn {
|
||||
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: 40;
|
||||
}
|
||||
.bt-floating-btn:hover {
|
||||
transform: scale(1.08) translateY(-2px);
|
||||
border-color: var(--primary);
|
||||
box-shadow: 0 14px 28px var(--primary-glow);
|
||||
}
|
||||
.bt-floating-btn svg { width: 24px; height: 24px; fill: var(--primary); }
|
||||
|
||||
/* =========================================================================
|
||||
【核心升级】从底部滑出的抽拉式 Sheet (Bottom 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 ease;
|
||||
}
|
||||
.bottom-sheet-mask.open { opacity: 1; pointer-events: auto; }
|
||||
|
||||
.bottom-sheet {
|
||||
position: absolute;
|
||||
bottom: 0; left: 0; right: 0;
|
||||
background: var(--surface);
|
||||
border-radius: 28px 28px 0 0;
|
||||
border-top: 1.5px solid var(--divider);
|
||||
box-shadow: 0 -15px 40px rgba(15, 23, 42, 0.2);
|
||||
transform: translateY(100%);
|
||||
transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: 480px;
|
||||
z-index: 101;
|
||||
}
|
||||
.bottom-sheet-mask.open .bottom-sheet { transform: 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);
|
||||
}
|
||||
|
||||
/* 动态雷达声呐图标 */
|
||||
.radar-box {
|
||||
position: relative;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border-radius: 50%;
|
||||
background: #EFF6FF;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.radar-wave-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-box svg { width: 18px; height: 18px; fill: var(--primary); z-index: 2; }
|
||||
|
||||
.sheet-chips-line {
|
||||
padding: 10px 24px;
|
||||
background: #F8FAFC;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
border-bottom: 1px solid var(--divider);
|
||||
overflow-x: auto;
|
||||
}
|
||||
.s-chip {
|
||||
padding: 5px 12px;
|
||||
border-radius: 100px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
border: 1px solid var(--divider);
|
||||
background: white;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.s-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;
|
||||
}
|
||||
.sheet-dev-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;
|
||||
}
|
||||
.sheet-dev-card:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08); }
|
||||
|
||||
.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;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="device-wrapper">
|
||||
<!-- 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-col">
|
||||
<!-- 1. 手环设备信息 -->
|
||||
<section class="health-card">
|
||||
<div class="card-header">
|
||||
<div class="card-title-wrap">
|
||||
<div class="card-icon icon-blue"><svg width="18" height="18" 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 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg></div>
|
||||
<span class="card-title-text">手环设备信息</span>
|
||||
</div>
|
||||
<span class="status-pill" id="connTag">状态:未连接</span>
|
||||
</div>
|
||||
<div class="telemetry-grid">
|
||||
<div class="tele-cell"><div class="tele-lbl">设备名称:</div><div class="tele-val" id="valName">未连接</div></div>
|
||||
<div class="tele-cell"><div class="tele-lbl">MAC 地址:</div><div class="tele-val" id="valMac">设备ID: 未知</div></div>
|
||||
<div class="tele-cell"><div class="tele-lbl">设备电量:</div><div class="tele-val" id="valBat">电量: 未知</div></div>
|
||||
<div class="tele-cell"><div class="tele-lbl">固件版本:</div><div class="tele-val" id="valFw">固件版本: 未知</div></div>
|
||||
</div>
|
||||
<div class="action-line">
|
||||
<button class="btn-text-danger" onclick="triggerReset()">重置手环</button>
|
||||
<button class="btn-action-primary" id="btnDisconnect" onclick="toggleConnect()">断开连接</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 2. 心率预警设置 -->
|
||||
<section class="health-card">
|
||||
<div class="card-header">
|
||||
<div class="card-title-wrap">
|
||||
<div class="card-icon icon-red"><svg width="18" height="18" viewBox="0 0 24 24"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/></svg></div>
|
||||
<span class="card-title-text">心率预警设置</span>
|
||||
</div>
|
||||
<label class="switch"><input type="checkbox" id="swHr" checked onchange="toggleHr()"><span class="slider"></span></label>
|
||||
</div>
|
||||
<div class="hr-stack">
|
||||
<div class="hr-row-card"><span class="hr-row-name">最低心率 (Min):</span><select class="hr-select-pill" id="selMin"><option>40</option><option>50</option><option>60</option></select></div>
|
||||
<div class="hr-row-card"><span class="hr-row-name">最高心率 (Max):</span><select class="hr-select-pill" id="selMax"><option>40</option><option selected>180</option></select></div>
|
||||
<div class="hr-row-card"><span class="hr-row-name">心率目标 (Goal):</span><select class="hr-select-pill" id="selGoal"><option>40</option><option selected>140</option></select></div>
|
||||
</div>
|
||||
<button class="btn-wide secondary" onclick="saveHrThresholds()">保存警报阈值</button>
|
||||
<div style="font-size: 12px; color: #10B981; font-weight: 600;" id="statusHint">● 正在主动断开连接...</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- 右列:历史离线数据同步与终端日志 -->
|
||||
<div class="dash-col">
|
||||
<section class="health-card" style="flex: 1;">
|
||||
<div class="card-header">
|
||||
<div class="card-title-wrap">
|
||||
<div class="card-icon icon-green"><svg width="18" height="18" viewBox="0 0 24 24"><path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"/></svg></div>
|
||||
<span class="card-title-text">历史离线数据同步</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hr-row-card">
|
||||
<span class="hr-row-name">选择同步的时间段:</span>
|
||||
<select class="hr-select-pill" id="selSyncDur"><option>过去 1 小时</option><option>过去 6 小时</option><option>过去 24 小时</option></select>
|
||||
</div>
|
||||
<button class="btn-wide primary" onclick="syncOfflineData()">一键同步历史心率/运动</button>
|
||||
|
||||
<div style="display: flex; flex-direction: column; gap: 8px; margin-top: 6px; flex: 1;">
|
||||
<span style="font-size: 13px; font-weight: 700; color: var(--text-main);">同步日志控制台</span>
|
||||
<div class="terminal-hud" id="termConsole">
|
||||
<div class="term-line info">[SYS] 蓝牙驱动就绪,等待手环连接指令...</div>
|
||||
<div class="term-line">正在主动断开连接...</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- 右下角悬浮蓝牙按钮 (FAB) -->
|
||||
<button class="bt-floating-btn" 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 (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 style="display: flex; align-items: center; gap: 10px;">
|
||||
<div class="radar-box">
|
||||
<div class="radar-wave-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>
|
||||
<span style="cursor: pointer; font-size: 16px; color: var(--text-sub);" onclick="closeBottomSheet()">✕</span>
|
||||
</div>
|
||||
<div class="sheet-chips-line">
|
||||
<span class="s-chip active">✓ 扫描顺序</span>
|
||||
<span class="s-chip">名称</span>
|
||||
<span class="s-chip">信号强度</span>
|
||||
<span class="s-chip">类型</span>
|
||||
</div>
|
||||
<div class="sheet-device-list">
|
||||
<div class="sheet-dev-card" onclick="connectDevice('CL831-62200026', 'D9:24:0F:1C:55:FA', '88%')">
|
||||
<div>
|
||||
<div style="font-weight: 700; font-family: monospace; font-size: 14px;">CL831-62200026 <span style="background: #EFF6FF; color: var(--primary); font-size: 10.5px; padding: 2px 6px; border-radius: 4px;">BLE</span></div>
|
||||
<div style="font-size: 11.5px; color: var(--text-sub); margin-top: 2px;">D9:24:0F:1C:55:FA · 信号: -89 dBm</div>
|
||||
</div>
|
||||
<button style="background: var(--primary); color: white; border: none; padding: 6px 14px; border-radius: 8px; font-weight: 700; font-size: 12.5px; cursor: pointer;">连接</button>
|
||||
</div>
|
||||
<div class="sheet-dev-card" onclick="connectDevice('CL831-2200006', 'DF:16:BC:22:2E:5B', '95%')">
|
||||
<div>
|
||||
<div style="font-weight: 700; font-family: monospace; font-size: 14px;">CL831-2200006 <span style="background: #EFF6FF; color: var(--primary); font-size: 10.5px; padding: 2px 6px; border-radius: 4px;">BLE</span></div>
|
||||
<div style="font-size: 11.5px; color: var(--text-sub); margin-top: 2px;">DF:16:BC:22:2E:5B · 信号: -98 dBm</div>
|
||||
</div>
|
||||
<button style="background: var(--primary); color: white; border: none; padding: 6px 14px; border-radius: 8px; font-weight: 700; font-size: 12.5px; cursor: pointer;">连接</button>
|
||||
</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 isScanning = true;
|
||||
|
||||
function appendLog(t, type = '') {
|
||||
const c = document.getElementById('termConsole');
|
||||
const d = document.createElement('div');
|
||||
d.className = `term-line ${type}`;
|
||||
d.innerText = `[${new Date().toTimeString().split(' ')[0]}] ${t}`;
|
||||
c.appendChild(d);
|
||||
c.scrollTop = c.scrollHeight;
|
||||
}
|
||||
|
||||
function openBottomSheet() {
|
||||
document.getElementById('sheetMask').classList.add('open');
|
||||
appendLog("从底部抽拉展开【选择设备】面板,雷达声呐正在扫描周围 BLE 广播...", "info");
|
||||
}
|
||||
|
||||
function closeBottomSheet() {
|
||||
document.getElementById('sheetMask').classList.remove('open');
|
||||
}
|
||||
|
||||
function toggleScan() {
|
||||
const b = document.getElementById('btnScan');
|
||||
isScanning = !isScanning;
|
||||
if (isScanning) {
|
||||
b.innerText = "暂停扫描";
|
||||
b.style.background = "#DCFCE7";
|
||||
b.style.color = "#15803D";
|
||||
appendLog("已恢复 BLE 设备雷达广播扫描...", "info");
|
||||
} else {
|
||||
b.innerText = "继续扫描";
|
||||
b.style.background = "#FEF3C7";
|
||||
b.style.color = "#D97706";
|
||||
appendLog("已暂停 BLE 广播扫描。", "warn");
|
||||
}
|
||||
}
|
||||
|
||||
function connectDevice(name, mac, bat) {
|
||||
closeBottomSheet();
|
||||
appendLog(`正在尝试连接手环 [${name} | ${mac}]...`, "info");
|
||||
setTimeout(() => {
|
||||
isConnected = true;
|
||||
document.getElementById('valName').innerText = name;
|
||||
document.getElementById('valMac').innerText = mac;
|
||||
document.getElementById('valBat').innerText = `${bat} (正常)`;
|
||||
document.getElementById('valFw').innerText = "v2.1.04-BLE";
|
||||
document.getElementById('connTag').innerText = "状态:已连接";
|
||||
document.getElementById('connTag').classList.add('connected');
|
||||
document.getElementById('btnDisconnect').classList.add('active');
|
||||
document.getElementById('statusHint').innerText = `● 设备已在线 [${name}]`;
|
||||
appendLog(`成功建立 GATT 通信!手环 [${name}] 在线,电量: ${bat}`, "success");
|
||||
}, 600);
|
||||
}
|
||||
|
||||
function toggleConnect() {
|
||||
if (!isConnected) { openBottomSheet(); return; }
|
||||
isConnected = false;
|
||||
document.getElementById('valName').innerText = "未连接";
|
||||
document.getElementById('valMac').innerText = "设备ID: 未知";
|
||||
document.getElementById('valBat').innerText = "电量: 未知";
|
||||
document.getElementById('valFw').innerText = "固件版本: 未知";
|
||||
document.getElementById('connTag').innerText = "状态:未连接";
|
||||
document.getElementById('connTag').classList.remove('connected');
|
||||
document.getElementById('btnDisconnect').classList.remove('active');
|
||||
document.getElementById('statusHint').innerText = "● 正在主动断开连接...";
|
||||
appendLog("正在主动断开连接... 设备已释放。", "warn");
|
||||
}
|
||||
|
||||
function triggerReset() {
|
||||
appendLog("向手环发送恢复出厂设置指令 (Factory Reset)...", "warn");
|
||||
alert("手环重置指令已成功下发!");
|
||||
}
|
||||
|
||||
function toggleHr() {
|
||||
const v = document.getElementById('swHr').checked;
|
||||
appendLog(`心率预警开关切换为: ${v ? '开启' : '关闭'}`, "info");
|
||||
}
|
||||
|
||||
function saveHrThresholds() {
|
||||
const min = document.getElementById('selMin').value;
|
||||
const max = document.getElementById('selMax').value;
|
||||
const goal = document.getElementById('selGoal').value;
|
||||
appendLog(`写入心率预警阈值 -> Min: ${min} BPM | Max: ${max} BPM | Goal: ${goal} BPM`, "success");
|
||||
alert("心率预警阈值已保存生效!");
|
||||
}
|
||||
|
||||
function syncOfflineData() {
|
||||
if (!isConnected) {
|
||||
appendLog("同步中断:请先连接手环设备。", "warn");
|
||||
openBottomSheet();
|
||||
return;
|
||||
}
|
||||
const dur = document.getElementById('selSyncDur').value;
|
||||
appendLog(`正在同步 [${dur}] 历史离线数据包...`, "info");
|
||||
setTimeout(() => {
|
||||
appendLog(`历史离线数据包已同步入库:读取 280 个心率帧,CRC 校验通过。`, "success");
|
||||
alert("历史离线数据同步完成!");
|
||||
}, 1000);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user