import { pillImg, syringeImg, heartImg, educationImg } from '../../../utils/drug-images';

Page({
  data: {
    drugList: [
      {
        id: 101,
        image: educationImg,
        title: '阿莫西林使用指南',
        desc: '了解抗生素的正确使用方法与注意事项',
        tag: '抗生素',
        readCount: '2,580',
      },
      {
        id: 102,
        image: pillImg,
        title: '布洛芬用药须知',
        desc: '解热镇痛安全用药，避免过量与禁忌',
        tag: '解热镇痛',
        readCount: '936',
      },
      {
        id: 103,
        image: syringeImg,
        title: '胰岛素注射教程',
        desc: '糖尿病患者必看：正确注射方法与部位轮换',
        tag: '降糖药',
        readCount: '492',
      },
      {
        id: 104,
        image: heartImg,
        title: '高血压用药管理',
        desc: '长期服药患者的日常管理与生活方式调整',
        tag: '心血管',
        readCount: '1,530',
      },
    ],
  },
  onLoad() {},
  onShow() {
    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
      this.getTabBar().setData({ selected: 2 });
    }
  },
  goDetail(e: WechatMiniprogram.TouchEvent) {
    const { id } = e.currentTarget.dataset;
    wx.navigateTo({ url: `/pages/drug-guide/index?id=${id}` });
  },
});
