diff --git a/config.js b/config.js index c3739d5..78ec93a 100644 --- a/config.js +++ b/config.js @@ -4,14 +4,14 @@ */ module.exports = { /** 应用版本号,外显在设置页「关于」 */ - version: 'v2.0', + version: 'v2.5', /** 最后更新日期,外显在设置页「关于」 */ - updatedAt: '2026-07-08', + updatedAt: '2026-07-09', /** 开发者名称 / 微信号,设置页点击可复制 */ developer: '刘承', /** 排行榜最大显示人数 */ - leaderboardMaxRank: 15 + leaderboardMaxRank: 20 } diff --git a/pages/records/records.js b/pages/records/records.js index cc26bdb..3661111 100644 --- a/pages/records/records.js +++ b/pages/records/records.js @@ -108,7 +108,9 @@ Page({ const { year, month, day } = e.detail const dateStr = `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}` const allRecords = Object.values(storage.getRecords()).flat() - const sessions = allRecords.filter(r => r.date === dateStr) + // record.date 是 "YYYY-MM-DD HH:MM:SS"(formatDate 生成),dateStr 只有 + // 日期部分,直接 === 永远不匹配,必须用 dateOnly 截取后再比。 + const sessions = allRecords.filter(r => util.dateOnly(r.date) === dateStr) const totalDur = sessions.reduce((sum, r) => sum + r.duration, 0) const calories = Math.round(totalDur * 0.068) this.setData({ @@ -127,6 +129,9 @@ Page({ this.setData({ showDayDetail: false }) }, + // Swallow touchmove on the popup so the background page doesn't scroll. + onNoop() { /* swallow */ }, + onLongPressDelete(e) { this.onDeleteRecord(e) }, diff --git a/pages/records/records.json b/pages/records/records.json index 6de9699..f938af9 100644 --- a/pages/records/records.json +++ b/pages/records/records.json @@ -1,8 +1,7 @@ { "usingComponents": { "calendar-heatmap": "/components/calendar-heatmap/calendar-heatmap", - "ui-card": "/components/ui-card/ui-card", - "ui-modal": "/components/ui-modal/ui-modal" + "ui-card": "/components/ui-card/ui-card" }, "navigationBarTitleText": "训练记录" } diff --git a/pages/records/records.wxml b/pages/records/records.wxml index de427b1..1f18a5e 100644 --- a/pages/records/records.wxml +++ b/pages/records/records.wxml @@ -113,31 +113,37 @@ - - - - - {{dayDetail.date}} - - - - - {{dayDetail.sessions}}次 - 训练次数 + + + + + + + {{dayDetail.date}} - - - {{dayDetail.durationText}} - 总时长 + + + + {{dayDetail.sessions}}次 + 训练次数 + + + + {{dayDetail.durationText}} + 总时长 + + + + {{dayDetail.calories}} + 约消耗 (千卡) + - - - {{dayDetail.calories}} - 约消耗 (千卡) + + 关闭 - - 关闭 - - + diff --git a/pages/records/records.wxss b/pages/records/records.wxss index 677ad0f..0a3caca 100644 --- a/pages/records/records.wxss +++ b/pages/records/records.wxss @@ -221,7 +221,57 @@ line-height: 1; } -/* ---- day detail popup ---- */ +/* ---- day detail popup ---- + 普通 view 实现,不用 ui-modal:自定义组件根元素的 position: fixed + 会被小程序运行时吞掉(见 settings.wxss plan-editor 注释),叠加 + .page-enter 的 transform 会让 fixed 降级相对 .container,导致弹窗 + 落到容器末尾而非视口居中。普通 view 的 fixed 100% 生效。 */ +.day-detail-mask { + position: fixed; + top: 0; left: 0; right: 0; bottom: 0; + z-index: 1000; + display: flex; + align-items: center; + justify-content: center; +} + +.day-detail-mask__bg { + position: absolute; + top: 0; left: 0; right: 0; bottom: 0; + background: rgba(0, 0, 0, 0.45); + animation: dayDetailFade 0.25s ease; +} + +.day-detail-body { + position: relative; + width: 560rpx; + border-radius: 28rpx; + padding: 48rpx 40rpx 36rpx; + background: var(--card-bg); + box-sizing: border-box; + text-align: center; + box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.25); + animation: dayDetailPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); +} + +@media (prefers-color-scheme: dark) { + .day-detail-body { + /* 暗黑下 body(#1C1C1E)与页面(#0F0F12)都偏深,加深阴影 + 微亮描边拉开层次 */ + box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.6), 0 0 0 1rpx rgba(255, 255, 255, 0.06); + } +} + +@keyframes dayDetailFade { + from { opacity: 0; } + to { opacity: 1; } +} + +@keyframes dayDetailPop { + from { transform: scale(0); opacity: 0; } + 60% { transform: scale(1.05); } + to { transform: scale(1); opacity: 1; } +} + .detail-date-row { display: flex; align-items: center; diff --git a/pages/settings/settings.js b/pages/settings/settings.js index eabf840..e2e190d 100644 --- a/pages/settings/settings.js +++ b/pages/settings/settings.js @@ -5,6 +5,7 @@ const iconsMod = require('../../utils/icons') const cloud = require('../../utils/cloud') const config = require('../../config') const darkMod = require('../../utils/darkMode') +const util = require('../../utils/util') /** * Build the simplified plans list shown in the settings UI by overlaying