const store = require('../../utils/store.js'); const api = require('../../utils/api.js'); Page({ data: { articles: [], sheetShow: false, sheetType: '', }, onLoad() { store .ready() .then(() => api.listArticles()) .then((list) => { this.setData({ articles: (list || []).map((a) => ({ icon: a.icon, title: a.title, desc: a.description, type: a.related_sheet_type || 'vaccine', })), }); }) .catch((e) => wx.showToast({ title: e.message || '加载失败', icon: 'none' })); }, openSheet(e) { this.setData({ sheetType: e.currentTarget.dataset.type, sheetShow: true }); }, closeSheet() { this.setData({ sheetShow: false }); }, onFab() { this.setData({ sheetType: 'ai', sheetShow: true }); }, });