feat: 移动端优化

- 响应式布局(768px 和 400px 断点)
- 统计卡片小屏 3 列/2 列布局
- Tab 按钮小屏横向滚动/垂直堆叠
- 日历组件小屏垂直布局
- 触摸友好的交互(点击反馈、tap-highlight)
- 最小点击区域 44x44px(符合移动端规范)
- 字体和间距适配小屏
This commit is contained in:
maoshen
2026-04-14 11:17:29 +00:00
parent 2b35247953
commit 4f916bba01

View File

@@ -73,11 +73,16 @@
color: #666;
transition: all 0.3s;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
-webkit-tap-highlight-color: transparent;
touch-action: manipulation;
}
.tab-btn:hover {
background: #f8f9fa;
transform: translateY(-2px);
}
.tab-btn:active {
transform: scale(0.98);
}
.tab-btn.active {
background: linear-gradient(135deg, #667eea, #764ba2);
color: white;
@@ -119,13 +124,24 @@
background: #667eea;
color: white;
border: none;
padding: 5px 10px;
padding: 8px 12px;
border-radius: 5px;
cursor: pointer;
min-width: 44px;
min-height: 44px;
display: flex;
align-items: center;
justify-content: center;
-webkit-tap-highlight-color: transparent;
touch-action: manipulation;
}
.calendar-header button:hover {
background: #5568d3;
}
.calendar-header button:active {
background: #4857c0;
transform: scale(0.95);
}
.calendar-grid {
display: grid;
grid-template-columns: repeat(7, 1fr);
@@ -146,10 +162,18 @@
border-radius: 5px;
cursor: pointer;
transition: all 0.2s;
-webkit-tap-highlight-color: transparent;
touch-action: manipulation;
min-width: 36px;
min-height: 36px;
}
.calendar-day:hover {
background: #e0e7ff;
}
.calendar-day:active {
background: #c7d2fe;
transform: scale(0.95);
}
.calendar-day.selected {
background: #667eea;
color: white;
@@ -188,11 +212,17 @@
border-radius: 5px;
cursor: pointer;
transition: all 0.2s;
-webkit-tap-highlight-color: transparent;
touch-action: manipulation;
}
.task-item:hover, .diary-item:hover {
transform: translateX(5px);
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.task-item:active, .diary-item:active {
transform: scale(0.98);
background: #eef1f5;
}
.task-item.status-pending { border-left-color: #6b7280; }
.task-item.status-in_progress { border-left-color: #3b82f6; }
.task-item.status-blocked { border-left-color: #f59e0b; }
@@ -381,12 +411,124 @@
grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
gap: 30px;
}
/* 移动端优化 */
@media (max-width: 768px) {
.grid-2, .calendar-wrapper {
grid-template-columns: 1fr;
body {
padding: 10px;
}
header h1 {
font-size: 1.8em;
}
header p {
font-size: 0.9em;
}
.stats {
grid-template-columns: repeat(3, 1fr);
gap: 10px;
margin-bottom: 20px;
}
.stat-card {
padding: 10px;
}
.stat-card h3 {
font-size: 1.4em;
}
.stat-card p {
font-size: 0.75em;
}
.tabs {
gap: 8px;
margin-bottom: 15px;
}
.tab-btn {
padding: 10px 16px;
font-size: 0.9em;
flex: 1;
text-align: center;
}
.section-box {
padding: 15px;
margin-bottom: 20px;
}
.section-box h2 {
font-size: 1.3em;
margin-bottom: 15px;
}
.calendar-wrapper {
flex-direction: column;
gap: 15px;
}
.calendar {
flex: 1;
flex: none;
width: 100%;
padding: 10px;
}
.calendar-header span {
font-size: 0.9em;
}
.calendar-header button {
padding: 3px 8px;
font-size: 0.9em;
}
.calendar-day {
font-size: 0.75em;
aspect-ratio: 1;
}
.calendar-day-header {
font-size: 0.65em;
}
.content-area {
width: 100%;
}
.task-item, .diary-item {
padding: 12px;
margin-bottom: 12px;
}
.task-item .title, .diary-item .title {
font-size: 1em;
}
.task-item .status {
font-size: 0.75em;
padding: 3px 10px;
}
.task-item .priority {
font-size: 0.75em;
}
.task-detail .meta {
flex-direction: column;
gap: 8px;
}
.task-detail .meta-item {
font-size: 0.85em;
}
.experience-item .title {
font-size: 1em;
}
.experience-item .category {
font-size: 0.75em;
}
}
/* 超小屏幕(< 400px */
@media (max-width: 400px) {
.stats {
grid-template-columns: repeat(2, 1fr);
}
.stat-card h3 {
font-size: 1.2em;
}
.stat-card p {
font-size: 0.7em;
}
header h1 {
font-size: 1.5em;
}
.tabs {
flex-direction: column;
}
.tab-btn {
width: 100%;
}
}
</style>