Files
EAP_Interface_html/设置页面UI优化/数据上传/baseline_ui.html
T
zhy200308 ed877e14ef feat(ui): 交付第9个子页面【数据上传】UI重构与连通性测试联动
- 页面交付清单 (已累计完成 9/11 个页面):
  1. 语言设置 (已完工)
  2. 版型切换 (已完工)
  3. 心率区间设置 (已完工)
  4. 自动连接配置 (已完工)
  5. 手环配置 (已完工)
  6. DFU固件升级 (已完工)
  7. 用户管理 (已完工)
  8. 设备数据库管理 (已完工)
  9. 数据上传 (本次交付·已完工)
- 核心重构亮点:
  1. 采纳 Master-Detail Inset Station 经典双栏比例 (360px 1fr);
  2. 彻底消除点击误导,左侧重构为【自动上传数据】标准开关行与只读【上传通道监控】大盘;
  3. 【测试数据上传】迁移至右侧表单底部实现 100% 贯穿式排版,且支持输入完整性动态校验点亮;
  4. 完善点击测试联动,实时回显 200 OK 连通状态、响应时延与最近测试时间戳;
  5. 集齐 6 件套交付物 (baseline_ui.html, image.png, DESIGN_SPEC.md, implementation_plan.md, CARD 任务卡, README 更新)。
2026-08-17 18:43:32 +08:00

406 lines
18 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>数据上传 - Master-Detail Inset Station (360px 1fr)</title>
<style>
/* =========================================================================
全局统一色彩与 Design Tokens (严格对齐 #2563EB 体系)
========================================================================= */
: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.22);
--color-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;
--border-card: #E2E8F0;
--color-success: #059669;
--color-success-bg: #ECFDF5;
--color-success-border: #A7F3D0;
--color-warning: #D97706;
--color-warning-bg: #FFFBEB;
--color-warning-border: #FDE68A;
--color-danger: #E11D48;
--color-danger-bg: #FFF1F2;
--color-danger-border: #FFE4E6;
--corner-card: 16px;
--corner-item: 10px;
--content-max-width: 1160px;
--content-gutter: clamp(16px, 2.5vw, 32px);
--appbar-height: 60px;
}
* { 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: var(--content-gutter); display: flex; flex-direction: column; -webkit-font-smoothing: antialiased;
}
.device-wrapper {
width: 100%; max-width: var(--content-max-width); 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: 660px; display: flex; flex-direction: column;
}
/* 1. AppBar */
.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(--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. 经典 360px 1fr 双栏布局 */
.split-body {
padding: clamp(20px, 2.5vw, 30px); background: #F8FAFC; flex: 1; overflow-y: auto;
display: grid; grid-template-columns: 360px 1fr; gap: 20px; max-height: calc(100vh - 120px);
}
/* 左侧 360px 控制中心 */
.left-control-panel {
background: white; border: 1.5px solid var(--divider); border-radius: 16px; padding: 22px;
display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
box-shadow: 0 4px 14px rgba(15, 23, 42, 0.03);
}
.panel-header-title { font-size: 17.5px; font-weight: 700; color: var(--color-primary); display: flex; align-items: center; gap: 8px; }
.panel-header-desc { font-size: 12.5px; color: var(--text-sub); margin-top: 4px; }
/* 自动上传数据设置行 */
.switch-setting-row {
background: #F8FAFC; border: 1.5px solid var(--divider); border-radius: 12px; padding: 14px 16px;
display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.switch-info { display: flex; flex-direction: column; gap: 2px; }
.switch-title { font-size: 14.5px; font-weight: 700; color: var(--text-main); }
.switch-sub { font-size: 12px; color: var(--text-sub); }
/* iOS / M3 统一开关 */
.toggle-switch {
position: relative; width: 48px; height: 26px; display: inline-block; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider-round {
position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
background-color: #CBD5E1; transition: .3s cubic-bezier(0.4, 0, 0.2, 1); border-radius: 34px;
}
.slider-round:before {
position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px;
background-color: white; transition: .3s cubic-bezier(0.4, 0, 0.2, 1); border-radius: 50%;
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .slider-round { background-color: var(--color-primary); }
input:checked + .slider-round:before { transform: translateX(22px); }
/* 只读型遥测监控大盘 */
.telemetry-monitor-box {
background: #F8FAFC; border: 1px solid var(--divider); border-radius: 12px; padding: 14px;
display: flex; flex-direction: column; gap: 10px;
}
.monitor-title-bar {
display: flex; align-items: center; justify-content: space-between; padding-bottom: 8px; border-bottom: 1px dashed var(--divider);
}
.monitor-caption { font-size: 12px; font-weight: 700; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.05em; }
.status-pill-live {
display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
padding: 3px 8px; border-radius: 6px; background: #F1F5F9; color: var(--text-sub); border: 1px solid var(--divider);
transition: all 0.2s ease;
}
.status-pill-live.ready {
background: var(--color-success-bg); color: var(--color-success); border-color: var(--color-success-border);
}
.status-pill-live.testing {
background: var(--color-warning-bg); color: var(--color-warning); border-color: var(--color-warning-border);
}
.status-dot {
width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
.monitor-metrics-grid {
display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.metric-sub-item { display: flex; flex-direction: column; gap: 2px; }
.metric-label { font-size: 11px; color: var(--text-sub); }
.metric-val { font-size: 12.5px; font-weight: 700; font-family: ui-monospace, monospace; color: var(--text-main); }
/* 左侧保存/重置操作按钮 */
.side-actions-stack { display: flex; flex-direction: column; gap: 10px; }
.btn-dynamic-full {
width: 100%; height: 44px; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer;
display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.15s ease;
border: 1.5px solid transparent;
}
.btn-primary-gradient {
background: var(--color-primary-gradient); color: white;
box-shadow: 0 4px 12px var(--color-primary-glow);
}
.btn-primary-gradient:hover { transform: translateY(-1px); box-shadow: 0 6px 16px var(--color-primary-glow); }
.btn-secondary-ghost {
background: #FFFFFF; color: var(--text-sub); border-color: #CBD5E1;
}
.btn-secondary-ghost:hover { background: #F1F5F9; color: var(--text-main); }
/* 右侧 1fr 配置表单面板 */
.right-form-panel {
background: white; border: 1.5px solid var(--divider); border-radius: 16px; padding: 24px;
display: flex; flex-direction: column; justify-content: space-between; gap: 20px;
box-shadow: 0 4px 14px rgba(15, 23, 42, 0.03);
}
.form-panel-header {
border-bottom: 1px solid var(--divider); padding-bottom: 12px; display: flex; justify-content: space-between; align-items: center;
}
.form-section-title { font-size: 15px; font-weight: 700; color: var(--text-main); }
.form-group-stack { display: flex; flex-direction: column; gap: 18px; }
.form-field-item { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 13.5px; font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 6px; }
.field-desc { font-size: 12px; color: var(--text-sub); }
.text-input-control {
width: 100%; height: 44px; background: #FFFFFF; border: 1.5px solid #CBD5E1; border-radius: 10px;
padding: 0 14px; font-size: 14px; font-weight: 600; color: var(--text-main); font-family: ui-monospace, monospace;
outline: none; transition: all 0.15s ease;
}
.text-input-control:focus {
border-color: var(--color-primary); box-shadow: 0 0 0 3.5px var(--color-primary-light); background: #FFFFFF;
}
/* 右侧贯穿式测试数据上传操作条 (根据表单填写状态动态点亮) */
.right-test-action-bar {
margin-top: 10px; padding-top: 16px; border-top: 1px dashed var(--divider);
}
.btn-test-full-through {
width: 100%; height: 48px; border-radius: 12px; font-size: 14.5px; font-weight: 700; cursor: pointer;
display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
border: 1.5px solid transparent;
}
/* 填写完整态 (点亮发光) */
.btn-test-full-through.active {
background: var(--color-primary-light); color: var(--color-primary);
border-color: var(--color-primary-border); box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}
.btn-test-full-through.active:hover {
background: #DBEAFE; border-color: var(--color-primary); transform: translateY(-1px);
box-shadow: 0 6px 18px rgba(37, 99, 235, 0.18);
}
/* 未填完整态 (置灰禁用) */
.btn-test-full-through.disabled {
background: #F1F5F9; color: var(--text-dim); border-color: #E2E8F0;
cursor: not-allowed; box-shadow: none; transform: none;
}
</style>
</head>
<body>
<div class="device-wrapper">
<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="split-body">
<!-- 左侧 360px 控制中心 -->
<div class="left-control-panel">
<div style="display: flex; flex-direction: column; gap: 16px;">
<div>
<h2 class="panel-header-title">☁️ 数据上传</h2>
<p class="panel-header-desc">健康指标与传感器原始遥测实时上报</p>
</div>
<!-- 自动上传数据设置项 -->
<div class="switch-setting-row">
<div class="switch-info">
<span class="switch-title">自动上传数据</span>
<span class="switch-sub" id="switchSubText">测量完成后后台静默上报</span>
</div>
<label class="toggle-switch">
<input type="checkbox" checked id="chkAutoUpload" onchange="toggleAutoUpload(this.checked)">
<span class="slider-round"></span>
</label>
</div>
<!-- 只读型遥测监控大盘 (与右侧“测试数据上传”深度联动) -->
<div class="telemetry-monitor-box">
<div class="monitor-title-bar">
<span class="monitor-caption">上传通道监控</span>
<span class="status-pill-live" id="statusBadge">
<span class="status-dot"></span>
<span id="statusText">未测试</span>
</span>
</div>
<div class="monitor-metrics-grid">
<div class="metric-sub-item">
<span class="metric-label">响应时延</span>
<span class="metric-val" id="latencyVal">-- ms</span>
</div>
<div class="metric-sub-item">
<span class="metric-label">传输协议</span>
<span class="metric-val">RESTful</span>
</div>
<div class="metric-sub-item" style="grid-column: 1 / -1;">
<span class="metric-label">最近测试时间</span>
<span class="metric-val" id="lastTestTime">从未测试</span>
</div>
</div>
</div>
</div>
<!-- 底部全宽保存与重置按钮 -->
<div class="side-actions-stack">
<button class="btn-dynamic-full btn-primary-gradient" onclick="handleSave()">
<svg style="width: 16px; height: 16px; fill: currentColor;" viewBox="0 0 24 24"><path d="M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z"/></svg>
<span>保存</span>
</button>
<button class="btn-dynamic-full btn-secondary-ghost" onclick="handleReset()">
<span>重置</span>
</button>
</div>
</div>
<!-- 右侧 1fr 表单输入与贯穿式测试操作面板 -->
<div class="right-form-panel">
<div>
<div class="form-panel-header">
<span class="form-section-title">服务器端点配置</span>
<span style="font-size: 12px; color: var(--text-sub);">完整填写所有地址后可触发测试</span>
</div>
<div class="form-group-stack" style="margin-top: 18px;">
<!-- 表单上传地址 -->
<div class="form-field-item">
<label class="field-label" for="iptFormUrl">
<span>表单上传地址</span>
</label>
<input type="text" class="text-input-control" id="iptFormUrl" value="http://192.168.1.100:8080/api/v1/form_upload" placeholder="请输入表单上传服务器完整 URL" oninput="validateFormInputs()">
<span class="field-desc">用于同步学员体检报告与评估表单数据</span>
</div>
<!-- 原始数据上传地址 -->
<div class="form-field-item">
<label class="field-label" for="iptRawUrl">
<span>原始数据上传地址</span>
</label>
<input type="text" class="text-input-control" id="iptRawUrl" value="http://192.168.1.100:8080/api/v1/raw_telemetry" placeholder="请输入原始传感器数据上传完整 URL" oninput="validateFormInputs()">
<span class="field-desc">用于回传 PPG / 心率变异性原始时域数据包</span>
</div>
<!-- 数据传输端口 -->
<div class="form-field-item">
<label class="field-label" for="iptPort">
<span>数据传输端口</span>
</label>
<input type="number" class="text-input-control" id="iptPort" value="8080" placeholder="例如 8080 或 443" style="max-width: 200px;" oninput="validateFormInputs()">
<span class="field-desc">默认 TCP/HTTP 通讯端口(范围 1 ~ 65535)</span>
</div>
</div>
</div>
<!-- 右侧贯穿式测试数据上传操作条 (根据表单填写状态动态点亮) -->
<div class="right-test-action-bar">
<button class="btn-test-full-through active" id="btnTestThrough" onclick="handleTestUpload()">
<svg style="width: 17px; height: 17px; fill: currentColor;" 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 2zm-1 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>
<span id="btnTestText">测试数据上传 (通道全量就绪)</span>
</button>
</div>
</div>
</main>
</div>
<script>
function toggleAutoUpload(checked) {
document.getElementById('switchSubText').innerText = checked ? '测量完成后后台静默上报' : '已关闭自动上传 (需手动同步)';
}
function validateFormInputs() {
const formUrl = document.getElementById('iptFormUrl').value.trim();
const rawUrl = document.getElementById('iptRawUrl').value.trim();
const port = document.getElementById('iptPort').value.trim();
const btn = document.getElementById('btnTestThrough');
const text = document.getElementById('btnTestText');
if (formUrl && rawUrl && port) {
btn.className = 'btn-test-full-through active';
btn.disabled = false;
text.innerText = '测试数据上传 (通道全量就绪)';
} else {
btn.className = 'btn-test-full-through disabled';
btn.disabled = true;
text.innerText = '请完整填写上方上传地址与端口后测试';
}
}
function handleSave() {
alert('数据上传配置已成功保存!');
}
function handleReset() {
if (confirm('确认将上传地址与端口重置为默认值吗?')) {
document.getElementById('iptFormUrl').value = '';
document.getElementById('iptRawUrl').value = '';
document.getElementById('iptPort').value = '';
document.getElementById('chkAutoUpload').checked = false;
toggleAutoUpload(false);
validateFormInputs();
}
}
function handleTestUpload() {
const btn = document.getElementById('btnTestThrough');
if (btn.disabled) return;
const badge = document.getElementById('statusBadge');
const text = document.getElementById('statusText');
const latency = document.getElementById('latencyVal');
const lastTest = document.getElementById('lastTestTime');
const btnText = document.getElementById('btnTestText');
badge.className = 'status-pill-live testing';
text.innerText = '正在测试...';
btnText.innerText = '正在发送测试 Ping 数据包...';
setTimeout(() => {
badge.className = 'status-pill-live ready';
text.innerText = '正常 (200 OK)';
latency.innerText = '28 ms';
const now = new Date();
lastTest.innerText = `${now.getHours().toString().padStart(2,'0')}:${now.getMinutes().toString().padStart(2,'0')}:${now.getSeconds().toString().padStart(2,'0')}`;
btnText.innerText = '测试数据上传 (通道全量就绪)';
alert('测试数据上传成功!服务器响应正常 (HTTP 200 OK · 延迟 28ms)');
}, 1000);
}
</script>
</body>
</html>