refactor: ES6+ modernization + 2 bugfixes

- var→const/let, function→arrow/class across all 13 JS files
- Timer: prototype→class with ES6 getters
- plan days: IIFE→Array.from declarative generation
- storage/plan: unified formatDate via util.js
- Bugfix: getPlanDay now filters by planId (plan switch accuracy)
- Bugfix: getTodayRecord searches all months (cross-month boundary)
- WXML/WXSS unchanged; public API unchanged
This commit is contained in:
2026-06-04 16:29:25 +08:00
parent ff2700c067
commit 8c7f633541
13 changed files with 404 additions and 494 deletions
+4 -4
View File
@@ -1,8 +1,8 @@
var themeMod = require('./utils/theme')
const themeMod = require('./utils/theme')
App({
onLaunch: function () {
var settings = wx.getStorageSync('user_settings')
onLaunch() {
const settings = wx.getStorageSync('user_settings')
if (!settings) {
wx.setStorageSync('user_settings', {
planId: 'beginner',
@@ -12,7 +12,7 @@ App({
vibrate: true
})
}
var streak = wx.getStorageSync('current_streak')
const streak = wx.getStorageSync('current_streak')
if (!streak) {
wx.setStorageSync('current_streak', { count: 0, lastDate: '' })
}