backup: snapshot before optimization

This commit is contained in:
2026-06-04 16:25:43 +08:00
commit ff2700c067
47 changed files with 3332 additions and 0 deletions
+104
View File
@@ -0,0 +1,104 @@
var storage = require('../../utils/storage')
var themeMod = require('../../utils/theme')
Page({
data: {
theme: { primary: '#FF6B35', primaryLight: '#FF8C5A', primaryBg: '#FFF3ED', primaryRgb: '255,107,53' },
themeStyle: '',
themes: themeMod.THEMES,
currentThemeId: 'orange',
plans: [
{ id: 'beginner', name: '初级', desc: '7天计划 · 30秒起步', days: 7 },
{ id: 'intermediate', name: '中级', desc: '14天计划 · 60秒起步', days: 14 },
{ id: 'advanced', name: '高级', desc: '30天计划 · 90秒起步', days: 30 }
],
currentPlanId: 'beginner',
dailyReminder: true,
reminderTime: '08:00',
voiceGuide: true,
vibrate: true
},
onLoad: function () {
var s = storage.getSettings()
var theme = themeMod.getCurrentTheme()
themeMod.applyThemeToPage(this)
this.setData({
currentPlanId: s.planId,
dailyReminder: s.dailyReminder,
reminderTime: s.reminderTime,
voiceGuide: s.voiceGuide,
vibrate: s.vibrate,
currentThemeId: theme.id
})
},
onShow: function () {
try {
var tb = this.getTabBar()
if (tb) tb.setData({ selected: 2 })
} catch (e) {}
themeMod.applyThemeToPage(this)
},
onSelectTheme: function (e) {
var id = e.currentTarget.dataset.id
var theme = themeMod.setTheme(id)
this.setData({ currentThemeId: id })
try {
var tb = this.getTabBar()
if (tb) {
tb.setData({ themeStyle: themeMod.getThemeStyle(theme) })
}
} catch (e) {}
themeMod.applyThemeToPage(this)
},
onSelectPlan: function (e) {
var planId = e.currentTarget.dataset.id
var s = storage.getSettings()
s.planId = planId
storage.saveSettings(s)
this.setData({ currentPlanId: planId })
wx.showToast({ title: '计划已切换', icon: 'success', duration: 1200 })
},
onToggleReminder: function (e) {
var s = storage.getSettings()
s.dailyReminder = e.detail.value
storage.saveSettings(s)
this.setData({ dailyReminder: e.detail.value })
},
onReminderTimeChange: function (e) {
var s = storage.getSettings()
s.reminderTime = e.detail.value
storage.saveSettings(s)
this.setData({ reminderTime: e.detail.value })
},
onToggleVoice: function (e) {
var s = storage.getSettings()
s.voiceGuide = e.detail.value
storage.saveSettings(s)
this.setData({ voiceGuide: e.detail.value })
},
onToggleVibrate: function (e) {
var s = storage.getSettings()
s.vibrate = e.detail.value
storage.saveSettings(s)
this.setData({ vibrate: e.detail.value })
},
onCopyWechat: function () {
wx.setClipboardData({
data: '刘承',
success: function () {
wx.showToast({ title: '已复制', icon: 'success', duration: 1500 })
}
})
}
})