refactor(ui): 12-point UI polish and bugfixes

Bug fixes:
- #1 Remove duplicate month label from calendar-heatmap (shown twice in records)
- #2 Extract shared .modal-overlay to app.wxss (was duplicated in index/records)

UX improvements:
- #3 Add long-press hint to history list in records page
- #4 Add drag handle + catchtouchmove to picker modal
- #5 Extend timer auto-navigate-back from 1.5s to 3s
- #6 Add clear data option in settings with confirmation dialog

Visual/code polish:
- #7 Remove 4 unused @keyframes (shimmer, spin) and 5 unused .icon classes
- #8 Tab bar inactive colors: hardcoded #888/#666 -> var(--text-secondary)
- #10 Split progress-ring observer to avoid redundant setData on size/color changes
- #12 Remove meaningless Math.min(planDay, 99) cap
This commit is contained in:
2026-06-04 16:34:22 +08:00
parent 8c7f633541
commit 89d93c8155
12 changed files with 95 additions and 71 deletions
+3 -2
View File
@@ -79,8 +79,9 @@
</view>
<!-- 时间选择弹窗 -->
<view class="modal-overlay" wx:if="{{showPicker}}" bindtap="onClosePicker">
<view class="picker-modal" catchtap="noop">
<view class="modal-overlay modal-overlay-bottom" wx:if="{{showPicker}}" bindtap="onClosePicker">
<view class="picker-modal" catchtap="noop" catchtouchmove="noop">
<view class="picker-handle"></view>
<text class="picker-title">⏱ 选择训练时长</text>
<view class="preset-grid">
<view
+9 -14
View File
@@ -295,28 +295,23 @@
}
/* ---- picker modal ---- */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.45);
z-index: 1000;
display: flex;
align-items: flex-end;
justify-content: center;
}
.picker-modal {
width: 100%;
background: #fff;
border-radius: 32rpx 32rpx 0 0;
padding: 40rpx 32rpx;
padding: 28rpx 32rpx 40rpx;
padding-bottom: calc(40rpx + env(safe-area-inset-bottom));
animation: slideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.picker-handle {
width: 64rpx;
height: 8rpx;
background: #DDD;
border-radius: 4rpx;
margin: 0 auto 24rpx;
}
@keyframes slideUp {
from { transform: translateY(100%); }
to { transform: translateY(0); }
+2 -1
View File
@@ -40,6 +40,7 @@
<view class="history-section card">
<view class="history-header">
<text class="section-title">📋 最近记录</text>
<text class="history-hint" wx:if="{{historyList.length > 0}}">长按可删除</text>
</view>
<view wx:if="{{historyList.length === 0}}" class="empty-state">
<text class="empty-emoji">🏃</text>
@@ -63,7 +64,7 @@
</view>
<!-- 日期详情弹窗 -->
<view class="modal-overlay" wx:if="{{showDayDetail}}" bindtap="onCloseDayDetail">
<view class="modal-overlay modal-overlay-center" wx:if="{{showDayDetail}}" bindtap="onCloseDayDetail">
<view class="day-detail-modal" catchtap="noop">
<view class="detail-date-row">
<text class="detail-emoji">📅</text>
+12 -13
View File
@@ -78,9 +78,21 @@
/* ---- history ---- */
.history-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8rpx;
}
.history-header .section-title {
margin-bottom: 0;
}
.history-hint {
font-size: 22rpx;
color: #CCC;
}
.empty-state {
display: flex;
flex-direction: column;
@@ -150,19 +162,6 @@
}
/* ---- day detail popup ---- */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.45);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
}
.day-detail-modal {
width: 560rpx;
background: #fff;
+16
View File
@@ -98,5 +98,21 @@ Page({
wx.showToast({ title: '已复制', icon: 'success', duration: 1500 })
}
})
},
onClearData() {
wx.showModal({
title: '清除数据',
content: '将删除所有训练记录和连续打卡数据,此操作不可恢复。确定继续吗?',
confirmText: '确定清除',
confirmColor: '#E53935',
success: (res) => {
if (res.confirm) {
wx.removeStorageSync('training_records')
wx.removeStorageSync('current_streak')
wx.showToast({ title: '已清除', icon: 'success', duration: 1500 })
}
}
})
}
})
+11
View File
@@ -92,6 +92,17 @@
</view>
</view>
<!-- 数据管理 -->
<view class="card">
<view class="section-header">
<text class="section-emoji">🗑</text>
<text class="section-title">数据管理</text>
</view>
<button class="btn-danger" bindtap="onClearData">
<text>清除所有训练记录</text>
</button>
</view>
<!-- 关于 -->
<view class="card about-card">
<view class="section-header">
+2 -2
View File
@@ -41,7 +41,7 @@ Page({
duration: target,
remaining: target,
todayTarget: target,
planDay: isFreeMode ? 0 : Math.min(planDay, 99),
planDay: isFreeMode ? 0 : planDay,
isFreeMode
})
@@ -105,6 +105,6 @@ Page({
storage.updateStreak(today)
wx.showToast({ title: `已记录 ${elapsed}`, icon: 'none', duration: 1500 })
setTimeout(() => { wx.navigateBack() }, 1500)
setTimeout(() => { wx.navigateBack() }, 3000)
}
})