feat(index): 新版本更新通知(What's New)弹窗

- 复用 ui-modal(position:center) + ui-btn,不新建组件,风格统一且自动跟随暗黑
- config.js 新增 releaseNotes 数组(每条一行短句),复用已有 version 字段
- 首页 _checkUpdateNote() 在 onShow 检测 storage 版本 vs config.version,
  不一致则居中弹通知并写回 storage 防重复;onCloseUpdateNote 关闭
- 绿色渐变徽章 + sparkleWhite 图标 + 版本标题 + 要点列表 + 知道了按钮
- 纯通知不重启应用;发版时改 version 同步更新 releaseNotes 即可
This commit is contained in:
2026-08-14 10:40:03 +08:00
parent 9d2c752043
commit 346d46cb27
6 changed files with 138 additions and 2 deletions
+29
View File
@@ -34,6 +34,12 @@ Page({
presets: [30, 60, 90, 120, 180, 300],
customDuration: 60,
customInput: '',
// --- 新版本更新通知(What's New) ---
showUpdateNote: false,
updateNoteVersion: '',
updateNoteItems: [],
updateNoteDate: '',
// --- Circuit (循环训练) config panel (persisted via storage.saveCircuitConfig) ---
showCircuitPicker: false,
cHold: 30,
@@ -50,6 +56,7 @@ Page({
onShow() {
themeMod.applyThemeToPage(this)
this._checkUpdateNote()
try {
const tb = this.getTabBar()
if (tb) {
@@ -92,6 +99,28 @@ Page({
} catch (e) {}
},
/**
* 新版本首次启动的 What's New 通知。复用 config.version 作为版本号,
* 用 storage 记录已提示过的版本,避免每次冷启动重复弹出。纯通知,不重启应用。
*/
_checkUpdateNote() {
try {
const shown = wx.getStorageSync('lastUpdateNoteVersion')
if (shown === config.version) return
this.setData({
showUpdateNote: true,
updateNoteVersion: config.version,
updateNoteItems: config.releaseNotes || [],
updateNoteDate: config.updatedAt || ''
})
wx.setStorageSync('lastUpdateNoteVersion', config.version)
} catch (e) {}
},
onCloseUpdateNote() {
this.setData({ showUpdateNote: false })
},
onPullDownRefresh() {
this.refresh()
wx.stopPullDownRefresh()
+18
View File
@@ -179,4 +179,22 @@
></ui-btn>
<text class="picker-cancel" bindtap="onCloseCircuitPicker">取消</text>
</ui-modal>
<!-- 新版本更新通知(What's New),首次进入当期版本弹一次 -->
<ui-modal visible="{{showUpdateNote}}" position="center" bind:close="onCloseUpdateNote">
<view class="update-note">
<view class="update-note__badge">
<image class="update-note__icon" src="{{icons.sparkleWhite}}" mode="aspectFit"></image>
</view>
<text class="update-note__title">版本更新 {{updateNoteVersion}}</text>
<text class="update-note__date" wx:if="{{updateNoteDate}}">更新于 {{updateNoteDate}}</text>
<view class="update-note__list">
<view class="update-note__item" wx:for="{{updateNoteItems}}" wx:key="*this">
<text class="update-note__dot">·</text>
<text class="update-note__text">{{item}}</text>
</view>
</view>
<ui-btn variant="primary" size="lg" block text="知道了" bindtap="onCloseUpdateNote" custom-style="border-radius:16rpx;margin-top:28rpx;"></ui-btn>
</view>
</ui-modal>
</view>
+69
View File
@@ -446,3 +446,72 @@
0%, 100% { transform: scale(1); }
50% { transform: scale(1.02); }
}
/* ===== 新版本更新通知(What's New) ===== */
/* slot 内容由页面 wxss 控制;ui-modal--center 的 body 已居中且用 --card-bg,
这里只管内部排版。徽章用负 margin 上探出卡片顶,制造浮动感。 */
.update-note {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
}
.update-note__badge {
width: 96rpx;
height: 96rpx;
border-radius: 50%;
margin: -76rpx auto 18rpx;
background: linear-gradient(135deg, #4CAF50, #81C784);
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 8rpx 20rpx rgba(76, 175, 80, 0.35);
}
.update-note__icon {
width: 52rpx;
height: 52rpx;
}
.update-note__title {
font-size: 36rpx;
font-weight: 700;
color: var(--text);
line-height: 1.4;
}
.update-note__date {
font-size: 24rpx;
color: var(--text-secondary);
margin-top: 6rpx;
}
.update-note__list {
width: 100%;
margin: 26rpx 0 4rpx;
text-align: left;
box-sizing: border-box;
}
.update-note__item {
display: flex;
align-items: flex-start;
margin-bottom: 16rpx;
}
.update-note__dot {
color: var(--primary);
font-weight: 700;
margin-right: 12rpx;
line-height: 1.5;
flex-shrink: 0;
}
.update-note__text {
flex: 1;
font-size: 27rpx;
color: var(--text);
line-height: 1.5;
text-align: left;
}