From 35b481a1ca67beb248c783f2337d12c6e848585a Mon Sep 17 00:00:00 2001 From: "liweiliang0905@gmail.com" Date: Fri, 23 Jan 2026 18:03:55 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E7=9D=A1=E7=9C=A0/=E4=BD=93=E9=87=8D/?= =?UTF-8?q?=E9=98=85=E8=AF=BB=E9=A1=B5=E9=9D=A2=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 睡眠页面: 响应式布局、表格转卡片 - 体重页面: 统计卡片优化、图表适配 - 阅读页面: 书籍网格双列/单列切换 - 三页均添加底部 Tab 导航 Co-Authored-By: Claude Opus 4.5 --- src/vitals/web/app.py | 172 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 170 insertions(+), 2 deletions(-) diff --git a/src/vitals/web/app.py b/src/vitals/web/app.py index 2c08488..90fe33a 100644 --- a/src/vitals/web/app.py +++ b/src/vitals/web/app.py @@ -5513,8 +5513,26 @@ def get_sleep_page_html() -> str: .delete-btn:hover { background: #fef2f2; } + /* 移动端适配 */ @media (max-width: 768px) { - .nav { flex-wrap: wrap; gap: 10px; } + .nav { display: none !important; } + body { padding-bottom: 80px; } + .container { padding: 12px; } + header { padding: 18px 14px; margin-bottom: 16px; } + header h1 { font-size: 1.4rem; } + .grid { grid-template-columns: 1fr 1fr; gap: 10px; } + .card { padding: 12px; } + .card .value { font-size: 1.4rem; } + .fab { bottom: 84px; right: 16px; width: 52px; height: 52px; } + .modal-content { margin: 5% auto; width: 95%; padding: 16px; } + table, thead, tbody, th, td, tr { display: block; } + thead { display: none; } + tr { background: white; margin-bottom: 12px; padding: 12px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); } + td { padding: 6px 0; border: none; display: flex; justify-content: space-between; } + td:before { content: attr(data-label); font-weight: 600; color: #666; } + } + @media (max-width: 480px) { + .grid { grid-template-columns: 1fr; } } @@ -5796,6 +5814,45 @@ def get_sleep_page_html() -> str: document.getElementById('addSleepForm').addEventListener('submit', submitSleepForm); loadSleepData(); + + // 检查管理员状态 + const user = JSON.parse(localStorage.getItem('user') || '{}'); + if (user.is_admin) { + const adminLink = document.getElementById('admin-link'); + if (adminLink) adminLink.style.display = 'block'; + } + + + + + + + @@ -5972,8 +6029,26 @@ def get_weight_page_html() -> str: .delete-btn:hover { background: #fef2f2; } + /* 移动端适配 */ @media (max-width: 768px) { - .nav { flex-wrap: wrap; gap: 10px; } + .nav { display: none !important; } + body { padding-bottom: 80px; } + .container { padding: 12px; } + header { padding: 18px 14px; margin-bottom: 16px; } + header h1 { font-size: 1.4rem; } + .grid { grid-template-columns: 1fr 1fr; gap: 10px; } + .card { padding: 12px; } + .card .value { font-size: 1.4rem; } + .fab { bottom: 84px; right: 16px; width: 52px; height: 52px; } + .modal-content { margin: 5% auto; width: 95%; padding: 16px; } + table, thead, tbody, th, td, tr { display: block; } + thead { display: none; } + tr { background: white; margin-bottom: 12px; padding: 12px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); } + td { padding: 6px 0; border: none; display: flex; justify-content: space-between; } + td:before { content: attr(data-label); font-weight: 600; color: #666; } + } + @media (max-width: 480px) { + .grid { grid-template-columns: 1fr; } } @@ -6219,6 +6294,45 @@ def get_weight_page_html() -> str: document.getElementById('addWeightForm').addEventListener('submit', submitWeightForm); loadWeightData(); + + // 检查管理员状态 + const user = JSON.parse(localStorage.getItem('user') || '{}'); + if (user.is_admin) { + const adminLink = document.getElementById('admin-link'); + if (adminLink) adminLink.style.display = 'block'; + } + + + + + + + @@ -6548,6 +6662,21 @@ def get_reading_page_html() -> str: padding: 10px 0; border-bottom: 1px solid #E2E8F0; } .history-item:last-child { border-bottom: none; } + /* 移动端适配 */ + @media (max-width: 768px) { + .nav { display: none !important; } + body { padding-bottom: 80px; } + .container { padding: 12px; } + header { padding: 20px 16px; margin-bottom: 20px; } + header h1 { font-size: 1.5rem; } + .section { padding: 16px; } + .book-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } + .book-cover { height: 140px; } + .modal-content { padding: 20px; } + } + @media (max-width: 400px) { + .book-grid { grid-template-columns: 1fr; } + } @@ -7021,6 +7150,45 @@ def get_reading_page_html() -> str: // 页面加载 document.addEventListener('DOMContentLoaded', loadStats); + + // 检查管理员状态 + const user = JSON.parse(localStorage.getItem('user') || '{}'); + if (user.is_admin) { + const adminLink = document.getElementById('admin-link'); + if (adminLink) adminLink.style.display = 'block'; + } + + + + + + +