fix(ui): 顶部栏Logo居中预览、移除预设选择器,并完善版本信息OTA下载进度条交互

1. Logo授权管理:
   - 顶部导航栏预览舱实现 Logo 图像与文本绝对居中对齐展示;
   - 移除快速预设体验模块,聚焦纯净的本地图片上传与拖拽交互;
   - 重新无头渲染 1200x800 高清效果图。
2. 版本信息:
   - 落地 OTA 固件下载进度条,精准内嵌于【系统更新】卡片内部;
   - 按钮支持 下载 -> 暂停/继续 -> 验证完成(立即安装重启) 四态动态联动。
This commit is contained in:
zhy200308
2026-08-17 18:57:11 +08:00
parent fa961c8820
commit a9747c9a78
7 changed files with 399 additions and 129 deletions
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>版本信息 - Master-Detail Inset Station (360px 1fr)</title>
<title>版本信息 - Master-Detail Inset Station (OTA 下载进度与状态联动版)</title>
<style>
/* =========================================================================
全局统一色彩与 Design Tokens (严格对齐 #2563EB 体系)
@@ -30,6 +30,7 @@
--color-success: #059669;
--color-success-bg: #ECFDF5;
--color-success-border: #A7F3D0;
--color-success-gradient: linear-gradient(135deg, #059669 0%, #047857 100%);
--color-warning: #D97706;
--color-warning-bg: #FFFBEB;
@@ -88,7 +89,7 @@ body {
.hero-header-box {
display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
padding-bottom: 20px; border-bottom: 1px solid var(--divider);
padding-bottom: 18px; border-bottom: 1px solid var(--divider);
}
.app-logo-box {
width: 72px; height: 72px; border-radius: 18px; background: linear-gradient(135deg, #FF6B6B 0%, #EE5253 100%);
@@ -102,23 +103,51 @@ body {
font-family: ui-monospace, monospace;
}
/* OTA 系统更新卡片 */
/* OTA 系统更新卡片 (内嵌高质感动态进度条) */
.ota-update-card {
background: var(--color-primary-light); border: 1.5px solid var(--color-primary-border); border-radius: 12px;
padding: 16px; display: flex; flex-direction: column; gap: 10px;
padding: 16px; display: flex; flex-direction: column; gap: 12px; transition: all 0.3s ease;
}
.ota-card-title {
font-size: 13px; font-weight: 700; color: var(--color-on-primary-container); display: flex; align-items: center; justify-content: space-between;
}
.ota-badge-status {
font-size: 11px; background: #DBEAFE; color: var(--color-primary); padding: 2px 8px; border-radius: 4px; font-weight: 700;
transition: all 0.2s ease;
}
.ota-new-version {
display: flex; align-items: baseline; justify-content: space-between;
}
.ota-version-code { font-size: 16px; font-weight: 800; color: var(--color-primary); font-family: ui-monospace, monospace; }
/* 底部贯穿式升级按钮 */
/* 动态进度条区域 (下载时平滑展示) */
.download-progress-block {
display: none; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px dashed var(--color-primary-border);
}
.progress-meta-row {
display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-sub);
}
.progress-percent-val {
font-family: ui-monospace, monospace; font-weight: 800; color: var(--color-primary); font-size: 13px;
}
.progress-track-bg {
width: 100%; height: 8px; background: #DBEAFE; border-radius: 10px; overflow: hidden; position: relative;
}
.progress-fill-bar {
height: 100%; width: 0%; background: var(--color-primary-gradient); border-radius: 10px;
transition: width 0.2s linear; box-shadow: 0 0 8px rgba(37, 99, 235, 0.4);
}
.progress-stats-row {
display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-dim); font-family: ui-monospace, monospace;
}
/* 底部贯穿式升级按钮组 */
.btn-dynamic-full {
width: 100%; height: 46px; 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;
display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s ease;
border: 1.5px solid transparent;
}
.btn-primary-gradient {
@@ -127,6 +156,17 @@ body {
}
.btn-primary-gradient:hover { transform: translateY(-1px); box-shadow: 0 6px 16px var(--color-primary-glow); }
.btn-success-gradient {
background: var(--color-success-gradient); color: white;
box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}
.btn-success-gradient:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(5, 150, 105, 0.35); }
.btn-downloading-ghost {
background: #FFFFFF; color: var(--text-main); border: 1.5px solid #CBD5E1;
}
.btn-downloading-ghost:hover { background: #F1F5F9; border-color: var(--text-sub); }
/* 右侧 1fr 设备与底层系统信息矩阵 */
.right-details-panel {
display: flex; flex-direction: column; gap: 16px;
@@ -184,24 +224,39 @@ body {
<div class="app-version-badge">版本号 1.00.0000</div>
</div>
<!-- 系统更新卡片 -->
<div class="ota-update-card">
<!-- 系统更新卡片 (内嵌动态展开进度条) -->
<div class="ota-update-card" id="otaCard">
<div class="ota-card-title">
<span>系统更新</span>
<span style="font-size: 11px; background: #DBEAFE; color: var(--color-primary); padding: 2px 6px; border-radius: 4px;">OTA 就绪</span>
<span class="ota-badge-status" id="otaBadge">OTA 就绪</span>
</div>
<div class="ota-new-version">
<span style="font-size: 12.5px; color: var(--text-sub);">有新版本可用:</span>
<span class="ota-version-code">1.00.0001</span>
<span style="font-size: 12.5px; color: var(--text-sub);" id="otaLabelText">有新版本可用:</span>
<span class="ota-version-code" id="otaVersionCode">1.00.0001</span>
</div>
<!-- 动态下载进度容器 -->
<div class="download-progress-block" id="progressBlock">
<div class="progress-meta-row">
<span style="font-weight: 600; color: var(--text-main);" id="progressStateText">正在下载固件包...</span>
<span class="progress-percent-val" id="progressPercent">0%</span>
</div>
<div class="progress-track-bg">
<div class="progress-fill-bar" id="progressFill"></div>
</div>
<div class="progress-stats-row">
<span id="progressMbStats">0.0 MB / 38.4 MB</span>
<span id="progressSpeedStats">2.8 MB/s</span>
</div>
</div>
</div>
</div>
<!-- 底部贯穿式下载更新按钮 -->
<!-- 底部贯穿式升级与多态操作按钮 -->
<div>
<button class="btn-dynamic-full btn-primary-gradient" onclick="handleDownloadUpdate()">
<svg style="width: 17px; height: 17px; fill: currentColor;" viewBox="0 0 24 24"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM17 13l-5 5-5-5h3V9h4v4h3z"/></svg>
<span>下载更新 (1.00.0001)</span>
<button class="btn-dynamic-full btn-primary-gradient" id="btnUpdateAction" onclick="handleUpdateActionClick()">
<svg style="width: 17px; height: 17px; fill: currentColor;" id="btnActionIcon" viewBox="0 0 24 24"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM17 13l-5 5-5-5h3V9h4v4h3z"/></svg>
<span id="btnActionText">下载更新 (1.00.0001)</span>
</button>
</div>
</div>
@@ -254,8 +309,68 @@ body {
</div>
<script>
function handleDownloadUpdate() {
alert('开始下载固件包 v1.00.0001 (共 38.4 MB)...');
let downloadState = 'IDLE'; // IDLE | DOWNLOADING | PAUSED | COMPLETED
let progress = 0;
let timer = null;
const totalSize = 38.4; // MB
function handleUpdateActionClick() {
const btn = document.getElementById('btnUpdateAction');
const btnText = document.getElementById('btnActionText');
const badge = document.getElementById('otaBadge');
const progressBlock = document.getElementById('progressBlock');
const fill = document.getElementById('progressFill');
const percentText = document.getElementById('progressPercent');
const mbStats = document.getElementById('progressMbStats');
const speedStats = document.getElementById('progressSpeedStats');
if (downloadState === 'IDLE') {
// 开始下载
downloadState = 'DOWNLOADING';
progressBlock.style.display = 'flex';
badge.innerText = '下载中';
badge.style.background = '#FFFBEB';
badge.style.color = '#D97706';
btn.className = 'btn-dynamic-full btn-downloading-ghost';
btnText.innerText = '暂停下载';
timer = setInterval(() => {
if (progress < 100) {
progress += Math.floor(Math.random() * 8) + 4;
if (progress > 100) progress = 100;
fill.style.width = `${progress}%`;
percentText.innerText = `${progress}%`;
const currentMb = ((progress / 100) * totalSize).toFixed(1);
mbStats.innerText = `${currentMb} MB / ${totalSize} MB`;
speedStats.innerText = `${(Math.random() * 0.8 + 2.2).toFixed(1)} MB/s`;
if (progress === 100) {
clearInterval(timer);
downloadState = 'COMPLETED';
badge.innerText = '验证通过';
badge.style.background = '#ECFDF5';
badge.style.color = '#059669';
document.getElementById('progressStateText').innerText = '固件包下载完成 (SHA256 校验通过)';
btn.className = 'btn-dynamic-full btn-success-gradient';
btnText.innerText = '⚡ 立即安装并重启';
}
}
}, 300);
} else if (downloadState === 'DOWNLOADING') {
// 暂停
clearInterval(timer);
downloadState = 'PAUSED';
badge.innerText = '已暂停';
btnText.innerText = '继续下载';
} else if (downloadState === 'PAUSED') {
// 继续
downloadState = 'DOWNLOADING';
badge.innerText = '下载中';
btnText.innerText = '暂停下载';
handleUpdateActionClick();
} else if (downloadState === 'COMPLETED') {
alert('正在触发系统 OTA 升级安装... 系统将自动重启并更新至 v1.00.0001');
}
}
</script>
</body>