8c7f633541
- 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
27 lines
609 B
JavaScript
27 lines
609 B
JavaScript
const themeMod = require('./utils/theme')
|
|
|
|
App({
|
|
onLaunch() {
|
|
const settings = wx.getStorageSync('user_settings')
|
|
if (!settings) {
|
|
wx.setStorageSync('user_settings', {
|
|
planId: 'beginner',
|
|
dailyReminder: true,
|
|
reminderTime: '08:00',
|
|
voiceGuide: true,
|
|
vibrate: true
|
|
})
|
|
}
|
|
const streak = wx.getStorageSync('current_streak')
|
|
if (!streak) {
|
|
wx.setStorageSync('current_streak', { count: 0, lastDate: '' })
|
|
}
|
|
this.globalData.theme = themeMod.getCurrentTheme()
|
|
},
|
|
|
|
globalData: {
|
|
planId: 'beginner',
|
|
theme: null
|
|
}
|
|
})
|