This commit is contained in:
大哥大哥的大哥哥
2026-09-09 14:47:29 +08:00
parent 4d9da40abd
commit 65755c9e96
832 changed files with 412085 additions and 0 deletions
@@ -0,0 +1,77 @@
const memoryCards = require('../../data/memoryCards')
const {
getProgress,
getSettings,
saveSettings,
} = require('../../utils/storage')
const {
getCollectedMemories,
} = require('../../utils/memoryCollection')
const { chapterRoute } = require('../../utils/chapterRoute')
function twoDigits(value) {
return String(value).padStart(2, '0')
}
Page({
data: {
memories: [],
memoryCount: 0,
fontScale: 'large',
},
onShow() {
const progress = getProgress()
const settings = getSettings()
const memories = getCollectedMemories(progress, memoryCards).map(
(memory, index) => ({
...memory,
chapterLabel: `第${twoDigits(memory.chapterNumber)}回`,
pageLabel: `第${index + 1}页`,
characterInitial: memory.characterName.slice(0, 1),
}),
)
this.setData({
memories,
memoryCount: memories.length,
fontScale: settings.fontScale === 'xlarge' ? 'xlarge' : 'large',
})
},
goBack() {
wx.reLaunch({ url: '/pages/home/home' })
},
openCatalog() {
wx.navigateTo({ url: '/pages/catalog/catalog' })
},
openChapter(event) {
const chapter = Number(event.currentTarget.dataset.chapter) || 1
wx.navigateTo({
url: chapterRoute(chapter),
})
},
toggleFont() {
const fontScale = this.data.fontScale === 'large' ? 'xlarge' : 'large'
const settings = getSettings()
settings.fontScale = fontScale
saveSettings(settings)
this.setData({ fontScale })
},
onShareAppMessage() {
return {
title: '我的桂香岁月:饭桌边,也有值得带回家说的话',
path: '/pages/home/home',
}
},
onShareTimeline() {
return {
title: '我的桂香岁月:饭桌边,也有值得带回家说的话',
query: '',
}
},
})