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 更新)。
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# JIRA 任务卡:CARD-20260817-UITask-数据上传
|
||||
|
||||
- **任务 ID**: `CARD-20260817-UITask-数据上传`
|
||||
- **模块名称**: 设置 / 数据上传
|
||||
- **设计风格**: 方案 1 · Master-Detail Inset Station 经典双栏 (360px 1fr)
|
||||
- **状态**: `READY_FOR_RELEASE`
|
||||
- **创建时间**: 2026-08-17
|
||||
|
||||
---
|
||||
|
||||
## 1. 业务目标与需求
|
||||
|
||||
1. **统一色彩规范**:严格对齐项目主色调 `#2563EB`(Royal Blue)体系,输入框聚焦时使用 `--color-primary` 高亮与浅蓝微底。
|
||||
2. **黄金栅格比例**:采用 `360px : 1fr` 经典双栏比例,左侧为上传监控与操作大盘,右侧为服务器端点配置表单。
|
||||
3. **测试按钮右侧贯穿与表单校验联动**:将【测试数据上传】置于右侧表单底部,实现 100% 贯穿排版;当表单未填满时置灰禁用,填写完整后自动点亮为科技蓝。
|
||||
4. **实时连通性测试联动**:点击【测试数据上传】后向左侧【上传通道监控】发送连通性状态,动态刷新 200 OK 连通状态、响应时延(28ms)及最近测试时间。
|
||||
5. **重置与保存逻辑**:保存弹出成功提示,重置清空表单并使测试按钮自动回退为禁用态。
|
||||
|
||||
---
|
||||
|
||||
## 2. 验收清单 (Acceptance Criteria)
|
||||
|
||||
- [x] AppBar 标题为 `← 数据上传`,带标准返回与更多功能操作。
|
||||
- [x] 左侧 360px 控制面板包含模块标题、自动上传数据开关、上传通道监控大盘与全宽保存/重置按钮。
|
||||
- [x] 右侧 1fr 面板完整包含【表单上传地址】、【原始数据上传地址】与【数据传输端口】3 个输入字段。
|
||||
- [x] 右侧底部贯穿式【测试数据上传】按钮在表单完整时点亮,未填满时置灰禁用。
|
||||
- [x] 点击测试后左侧监控大盘实时更新连通状态与时延。
|
||||
- [x] 无头渲染输出 1200x800 高清效果图 `image.png`。
|
||||
@@ -0,0 +1,51 @@
|
||||
# 数据上传 - 工业级 UI 重构设计规范 (Design Spec)
|
||||
|
||||
## 1. 架构与定位 (Architecture & Positioning)
|
||||
|
||||
本模块作为智能穿戴与生理指标监测系统向云端服务上报数据的通信中枢,负责配置表单数据上传接口、原始 PPG/HRV 时域数据包上传接口、通信端口以及自动上传开关,并提供实时网络连通性 Ping 测试与状态反馈。
|
||||
|
||||
---
|
||||
|
||||
## 2. 设计规范与色彩系统 (Design Tokens & Color Palette)
|
||||
|
||||
严格对齐项目主色调 `#2563EB` 与调和语义色规范:
|
||||
|
||||
| Token 变量名 | 色值 / 规范 | 应用场景 |
|
||||
| :--- | :--- | :--- |
|
||||
| `--color-primary` | `#2563EB` (Royal Blue) | 主品牌色、输入框聚焦高亮、主操作按钮 |
|
||||
| `--color-primary-dark` | `#1D4ED8` | 主按钮悬停与渐变深色端 |
|
||||
| `--color-primary-light` | `#EFF6FF` | 输入框聚焦浅底、测试通过浅底容器 |
|
||||
| `--color-primary-border` | `#DBEAFE` | 测试操作条外边框 |
|
||||
| `--color-primary-gradient` | `linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%)` | 保存主按钮全宽贯穿背景 |
|
||||
| `--color-success` | `#059669` (Emerald) | 测试成功连通状态 (200 OK) |
|
||||
| `--color-success-bg` | `#ECFDF5` | 连通状态胶囊浅底 |
|
||||
| `--color-success-border` | `#A7F3D0` | 连通状态胶囊边框 |
|
||||
| `--color-warning` | `#D97706` (Amber) | 测试中动态转圈状态 |
|
||||
| `--color-warning-bg` | `#FFFBEB` | 测试中胶囊浅底 |
|
||||
|
||||
---
|
||||
|
||||
## 3. 布局与比例规范 (Layout & Ratio)
|
||||
|
||||
采用与语言设置、版型切换、设备数据库管理深度对齐的 **360px : 1fr** 经典双栏比例:
|
||||
- **左侧 360px 上传监控与控制面板**:
|
||||
- 模块标题与副标题描述;
|
||||
- 自动上传数据设置行(集成 iOS/M3 标准开关);
|
||||
- 上传通道监控大盘(只读型,实时展现响应时延、传输协议与最近测试时间戳);
|
||||
- 底部贯穿式全宽 `保存`(主色渐变)与 `重置`(次级幽灵白)按钮。
|
||||
- **右侧 1fr 服务器端点配置面板**:
|
||||
- 顶部表单区:表单上传地址、原始数据上传地址、数据传输端口;
|
||||
- 底部贯穿式 `测试数据上传` 操作条:
|
||||
- 当表单未填写完整时,按钮置灰禁用 (`disabled`);
|
||||
- 当表单完整填写后,按钮自动点亮为科技蓝底色并支持点击;
|
||||
- 点击后向左侧【上传通道监控】发送测试 Ping 并实时反馈连通状态与毫秒延迟。
|
||||
|
||||
---
|
||||
|
||||
## 4. 交付文件清单 (Deliverables)
|
||||
|
||||
1. `baseline_ui.html`:生产级无头渲染 HTML 源代码。
|
||||
2. `image.png`:1200x800 高清定稿预览效果截图。
|
||||
3. `DESIGN_SPEC.md`:本设计规范。
|
||||
4. `implementation_plan.md`:原生与前端工程实施方案。
|
||||
5. `CARD-20260817-UITask-数据上传.md`:JIRA 重构研发任务卡。
|
||||
@@ -0,0 +1,405 @@
|
||||
<!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>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 98 KiB |
@@ -0,0 +1,50 @@
|
||||
# 数据上传 - 工程实施方案 (Implementation Plan)
|
||||
|
||||
## 1. 数据模型与接口规范 (Data Model & Schema)
|
||||
|
||||
```typescript
|
||||
export interface DataUploadConfig {
|
||||
autoUploadEnabled: boolean; // 是否开启自动上传数据
|
||||
formUploadUrl: string; // 表单上传完整 URL
|
||||
rawTelemetryUrl: string; // 原始数据上传完整 URL
|
||||
transferPort: number; // 通信传输端口 (1~65535)
|
||||
}
|
||||
|
||||
export interface NetworkPingResult {
|
||||
status: 'IDLE' | 'TESTING' | 'SUCCESS' | 'ERROR';
|
||||
statusCode?: number; // HTTP 状态码 (如 200)
|
||||
latencyMs?: number; // 响应时延 (毫秒)
|
||||
testedAt?: string; // 测试完成时间 ISO 字符串
|
||||
errorMessage?: string; // 错误描述
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. 状态机与联动流程 (State Machine & Workflow)
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
[*] --> FormLoaded: 载入当前网络配置
|
||||
FormLoaded --> FormValid: 检查 3 项输入框均非空
|
||||
FormLoaded --> FormInvalid: 任一输入框为空
|
||||
FormInvalid --> TestDisabled: 右侧【测试数据上传】置灰禁用
|
||||
FormValid --> TestEnabled: 右侧【测试数据上传】点亮就绪
|
||||
TestEnabled --> TestingPing: 点击【测试数据上传】
|
||||
TestingPing --> PingSuccess: 服务器返回 200 OK
|
||||
TestingPing --> PingFail: 网络超时或 4xx/5xx
|
||||
PingSuccess --> UpdateMonitor: 左侧通道监控更新时延与状态
|
||||
UpdateMonitor --> FormLoaded: 恢复就绪
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. 原生实施映射 (Native Implementation Mapping)
|
||||
|
||||
- **Android (Kotlin / Jetpack Compose)**:
|
||||
- 左侧采用 `Card(modifier = Modifier.width(360.dp))` 包含 `Switch` 与 `MonitorBox`;
|
||||
- 右侧采用 `OutlinedTextField` 结合 `derivedStateOf { formUrl.isNotBlank() && rawUrl.isNotBlank() && port.isNotBlank() }` 实现测试按钮动态点亮;
|
||||
- 网络测试基于 `OkHttpClient` 执行轻量 `HEAD` 或 `OPTIONS` Ping 请求。
|
||||
- **Flutter**:
|
||||
- `Row(children: [SizedBox(width: 360, child: UploadControlPanel()), Expanded(child: ServerEndpointsForm())])`;
|
||||
- 动态点亮使用 `ValueListenableBuilder` 监听 3 个 `TextEditingController` 的文本长度。
|
||||
Reference in New Issue
Block a user