feat(ui): 完成 [用户管理] (含添加用户/用户表管理) UI重构与全套6件交付物

- 统一采用 Fluid Studio 现代健康工作台设计体系与 #2563EB 核心品牌蓝标准
- 实现主界面、添加/编辑用户表单、用户表管理三视图无缝 SPA 状态机闭环
- 支持真实头像流展示与优质默认 SVG 头像回退
- 精确隔离添加用户(清空)与编辑用户(回填)状态逻辑
- 产出 baseline_ui.html, image.png, DESIGN_SPEC.md, implementation_plan.md, CARD-20260817-UITask-用户管理.md
- 更新 README.md 页面完工状态 (第 7 页已完工)
This commit is contained in:
zhy200308
2026-08-17 18:04:39 +08:00
parent 3d7be0e326
commit 96c82ad25d
29 changed files with 2620 additions and 1 deletions
@@ -0,0 +1,163 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>方案 2:Master-Detail 360px 双栏联动工作台</title>
<style>
:root {
--color-primary: #2563EB;
--color-primary-light: #EFF6FF;
--color-primary-border: #DBEAFE;
--color-primary-gradient: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
--bg: #EEF2F6;
--surface: #FFFFFF;
--text-main: #0F172A;
--text-sub: #64748B;
--divider: #E2E8F0;
--color-danger: #E11D48;
--color-danger-bg: #FFF1F2;
--color-danger-border: #FFE4E6;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, "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;
}
.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: 660px; display: flex; flex-direction: column;
}
.appbar {
height: 60px; display: flex; align-items: center; justify-content: space-between;
padding: 0 20px; border-bottom: 1px solid var(--divider); background: var(--surface);
}
.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;
}
.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; }
.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);
}
.side-panel {
background: white; border: 1.5px solid var(--divider); border-radius: 16px; padding: 18px;
display: flex; flex-direction: column; gap: 12px;
}
.main-panel {
background: white; border: 1.5px solid var(--divider); border-radius: 16px; padding: 22px;
display: flex; flex-direction: column; gap: 16px;
}
.roster-card {
border: 1.5px solid var(--divider); border-radius: 12px; padding: 12px 14px; cursor: pointer;
display: flex; align-items: center; gap: 12px; transition: all 0.15s ease;
}
.roster-card.active { border-color: var(--color-primary); background: var(--color-primary-light); }
.avatar-mini {
width: 40px; height: 40px; border-radius: 10px; background: #EFF6FF; display: flex; align-items: center; justify-content: center;
}
.avatar-mini svg { width: 22px; height: 22px; fill: var(--color-primary); }
.prop-pill-row {
background: #F8FAFC; border: 1px solid var(--divider); border-radius: 8px; padding: 10px 14px;
display: flex; justify-content: space-between;
}
</style>
</head>
<body>
<div class="device-wrapper">
<header class="appbar">
<div class="appbar-left">
<button class="appbar-nav"><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="side-panel">
<div style="display: flex; justify-content: space-between; align-items: center;">
<span style="font-weight: 700; font-size: 13.5px;">表: UserDatabase_CHINA</span>
<button style="border: 1px solid var(--divider); background: white; padding: 4px 8px; border-radius: 6px; font-size: 12px; cursor: pointer;" onclick="alert('进入用户表管理')">管理表</button>
</div>
<div style="display: flex; gap: 8px;">
<button style="flex: 1; background: var(--color-primary); color: white; border: none; padding: 8px; border-radius: 8px; font-weight: 700; cursor: pointer;" onclick="switchToNewUser()">+ 添加用户</button>
<button style="border: 1px solid var(--divider); background: white; padding: 8px 12px; border-radius: 8px; font-weight: 700; cursor: pointer;" onclick="alert('导入表格')">导入</button>
</div>
<div style="display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 380px;">
<div class="roster-card active" onclick="selectUser('孙伟', '女', '10229', '25岁', '167 cm', '117.0 kg', '60 bpm', '188', this)">
<div class="avatar-mini"><svg viewBox="0 0 24 24"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg></div>
<div>
<div style="font-weight: 700; font-size: 14.5px;">孙伟 (女)</div>
<div style="font-size: 11.5px; color: var(--text-sub);">学号: 10229 · 25岁</div>
</div>
</div>
<div class="roster-card" onclick="selectUser('陈静', '男', '203464', '28岁', '189 cm', '71.0 kg', '60 bpm', '186', this)">
<div class="avatar-mini"><svg viewBox="0 0 24 24"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg></div>
<div>
<div style="font-weight: 700; font-size: 14.5px;">陈静 (男)</div>
<div style="font-size: 11.5px; color: var(--text-sub);">学号: 203464 · 28岁</div>
</div>
</div>
<div class="roster-card" onclick="selectUser('吴敏', '女', '295', '29岁', '153 cm', '109.0 kg', '60 bpm', '185', this)">
<div class="avatar-mini"><svg viewBox="0 0 24 24"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg></div>
<div>
<div style="font-weight: 700; font-size: 14.5px;">吴敏 (女)</div>
<div style="font-size: 11.5px; color: var(--text-sub);">学号: 295 · 29岁</div>
</div>
</div>
</div>
</div>
<!-- 右侧 1fr 学员档案与详情 -->
<div class="main-panel">
<div style="display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--divider); padding-bottom: 14px;">
<div style="display: flex; align-items: center; gap: 14px;">
<div style="width: 52px; height: 52px; border-radius: 14px; background: var(--color-primary-light); display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--color-primary-border);">
<svg viewBox="0 0 24 24" style="width:28px;height:28px;fill:var(--color-primary);"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>
</div>
<div>
<h2 style="font-size: 18px; font-weight: 700;" id="dtName">孙伟 <span style="font-size: 13px; color: var(--text-sub);" id="dtGender">女 · 25岁</span></h2>
<div style="font-size: 12px; color: var(--text-sub);" id="dtSno">学号: 10229 · 所属表: UserDatabase_CHINA</div>
</div>
</div>
<div style="display: flex; gap: 8px;">
<button style="border: 1.5px solid var(--divider); background: white; padding: 7px 14px; border-radius: 8px; font-weight: 700; cursor: pointer;" onclick="alert('编辑此学员')">✏️ 编辑档案</button>
<button style="border: 1.5px solid var(--color-danger-border); background: var(--color-danger-bg); color: var(--color-danger); padding: 7px 14px; border-radius: 8px; font-weight: 700; cursor: pointer;">🗑️ 删除</button>
</div>
</div>
<div style="display: flex; flex-direction: column; gap: 10px;">
<div class="prop-pill-row"><span style="color: var(--text-sub);">学号</span><b id="pvSno" style="font-family: monospace;">10229</b></div>
<div class="prop-pill-row"><span style="color: var(--text-sub);">身高 / 体重</span><b id="pvHw">167 cm / 117.0 kg</b></div>
<div class="prop-pill-row"><span style="color: var(--text-sub);">静息心率 (bpm)</span><b id="pvRest" style="color: var(--color-primary); font-family: monospace;">60 bpm</b></div>
<div class="prop-pill-row"><span style="color: var(--text-sub);">最大心率 (bpm)</span><b id="pvMax" style="color: var(--color-primary); font-family: monospace;">188 (自动计算)</b></div>
</div>
</div>
</main>
</div>
<script>
function selectUser(n, g, sno, age, h, w, rest, max, el) {
document.querySelectorAll('.roster-card').forEach(c => c.classList.remove('active'));
el.classList.add('active');
document.getElementById('dtName').innerHTML = `${n} <span style="font-size: 13px; color: var(--text-sub);">${g} · ${age}</span>`;
document.getElementById('dtSno').innerText = `学号: ${sno} · 所属表: UserDatabase_CHINA`;
document.getElementById('pvSno').innerText = sno;
document.getElementById('pvHw').innerText = `${h} / ${w}`;
document.getElementById('pvRest').innerText = rest;
document.getElementById('pvMax').innerText = `${max} (自动计算)`;
}
function switchToNewUser() {
alert("右侧已切换为 [新建学员] 表单模式!");
}
</script>
</body>
</html>