| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
- import tickleBehavior, {
- getTickleContext,
- } from "../../../../core/behavior/tickle.behavior";
- import { getFootPrintListMethod } from "../../request";
- // module/diet/pages/delivery-address/delivery-address.ts
- Page({
- behaviors: [PageContainerBehavior, tickleBehavior],
- lifetimes: {
- attached() {},
- },
- properties: {},
- data: {
- articleList: [
- {
- id: 1,
- img: "", // 图片地址,留空显示占位
- title: "补肾误区大揭秘:这些食物并非越多越好…",
- subtitle: "",
- time: "2024-02-03 15:32:42",
- type: "article",
- },
- {
- id: 2,
- img: "",
- title: "虾的营养如何?怎么吃安全又营养",
- subtitle: "",
- time: "2024-02-03 15:32:42",
- type: "diet",
- },
- ],
- },
- // toInfoPage(event: WechatMiniprogram.TouchEvent) {
- // console.log(event, '健康宣教');
- // const item = event.currentTarget.dataset.item.item;
- // wx.navigateTo({ url: `/module/article/pages/science-info/science-info?id=${item.sourceId}` })
- // .then(res => { res.eventChannel.emit('load', item) })
- // // if (this.data.replace) {
- // // wx.redirectTo({ url: `/module/article/pages/science-info/science-info?id=${item.sourceId}` });
- // // } else {
- // // wx.navigateTo({ url: `/module/article/pages/science-info/science-info?id=${item.sourceId}` })
- // // .then(res => { res.eventChannel.emit('load', item) })
- // // }
- // },
- goDetail(e: any) {
- const type = e.currentTarget.dataset.type;
- const item = e.currentTarget.dataset.item;
- // type 1 中医科普 2 药膳 3 茶饮
- // 药膳详情
- 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") {
- wx.navigateTo({
- url: `/module/article/pages/diet-info/diet-info?id=${item.sourceId}`,
- }).then((res) => {
- res.eventChannel.emit("load", item);
- });
- } else if (type === "3") {
- console.log("茶饮");
- }
- },
- async load() {
- wx.showLoading({ title: "加载中" });
- try {
- const res = await getFootPrintListMethod();
- console.log(res.data.data, "获取足迹");
- if (res && res.data && res.data.data.length > 0) {
- this.setData({ articleList: res.data.data });
- }
- console.log(this.data.articleList, "articleList");
- } catch (error: any) {
- getTickleContext.call(this).showWarnMessage(error.errMsg);
- }
- wx.hideLoading();
- },
- onShow() {
- this.load();
- },
- });
|