import PageContainerBehavior from "../../../../core/behavior/page-container.behavior"; import tickleBehavior, { getTickleContext, } from "../../../../core/behavior/tickle.behavior"; import { getFootPrintListMethod } from "../../request"; Page({ behaviors: [PageContainerBehavior, tickleBehavior], lifetimes: { attached() {}, }, properties: {}, data: { articleList: [], }, goDetail(e: any) { const type = e.currentTarget.dataset.type; const item = e.currentTarget.dataset.item; // type 1 中医科普 2 药膳 4 茶饮 // 药膳详情 console.log(type, "详情"); if (type === "1") { wx.navigateTo({ url: `/module/article/pages/science-info/science-info?id=${item.sourceId}`, }).then((res) => { res.eventChannel.emit("load", item); }); } else if (type === "2" || type === "4") { wx.navigateTo({ url: `/module/article/pages/diet-info/diet-info?id=${item.sourceId}`, }).then((res) => { res.eventChannel.emit("load", item); }); } }, async load() { wx.showLoading({ title: "加载中" }); try { const res = await getFootPrintListMethod(); const list = res?.data?.data ?? []; console.log(list, "list",res.data.data); this.setData({ articleList: Array.isArray(list) ? list : [] }); } catch (error: any) { getTickleContext.call(this).showWarnMessage(error.errMsg); } wx.hideLoading(); }, onShow() { this.load(); }, });