首次提交

This commit is contained in:
zeronline
2026-06-25 08:39:47 +08:00
parent 20a93c703a
commit c5cccd346b
169 changed files with 24720 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
const api = require('../../services/api')
const app = getApp()
Page({
data: { user: null, items: [], streaks: {}, loading: true },
onShow() {
if (!app.globalData.token) { wx.reLaunch({ url: '/pages/login/index' }); return }
this.setData({ user: app.globalData.user })
this.loadItems()
},
onPullDownRefresh() { this.loadItems().then(() => wx.stopPullDownRefresh()) },
async loadItems() {
try {
const items = await api.get('/api/checkin/items')
const streaks = {}
for (const item of items.filter(i => i.status === 'active')) {
try { const s = await api.get('/api/checkin/streak/' + item.id); streaks[item.id] = s.streak } catch(e) {}
}
this.setData({ items: items.filter(i => i.status !== 'deleted'), streaks, loading: false })
} catch(e) { this.setData({ loading: false }) }
},
goCreate() { wx.navigateTo({ url: '/pages/checkin/create/index' }) },
goDetail(e) { wx.navigateTo({ url: '/pages/checkin/detail/index?id=' + e.currentTarget.dataset.id }) },
goProfile() { wx.switchTab({ url: '/pages/profile/index/index' }) },
})