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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user