const api = require('../../api.js') Page({ data: { loading: true, kits: [], appNameZh: 'MilesYang时光助手', subtitle: '小工具集合 · 完全独立 · 零共享', }, onLoad() { this.refresh() }, onPullDownRefresh() { this.refresh().finally(() => wx.stopPullDownRefresh()) }, async refresh() { this.setData({ loading: true }) try { const res = await api.core.getMeta() if (res && res.appNameZh) this.setData({ appNameZh: res.appNameZh }) } catch (e) {} this.setData({ kits: this.buildKits(), loading: false, }) }, buildKits() { return [ { id: 'personal_collect', name: '微信收藏夹', description: '聊天图片 / 文件 / 文字收藏,标签搜索,软删除可追溯。', icon: '📁', path: '/kits/personal_collect/pages/list/list', meta: 'API: /api/mp_personal_collect/ · DB: mp_personal_collect.db', }, { id: 'rep_clock', name: '运动节拍 RepClock', description: 'HIIT / Yoga / 拉伸节奏倒计时,锚点时钟 + 女声播报。', icon: '⏱️', path: '/kits/rep_clock/pages/cards/cards', meta: 'API: /api/mp_rep_clock/ · DB: mp_rep_clock.db', }, ] }, async onKitTap(e) { const id = (e.currentTarget.dataset.id || '').trim() const path = (e.currentTarget.dataset.path || '').trim() if (!path) { wx.showToast({ title: '功能开发中', icon: 'none' }); return } try { await api.core.setActiveKit(id) } catch (e) {} wx.navigateTo({ url: path, fail: () => wx.showToast({ title: '打开失败', icon: 'none' }), }) }, })