"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const utils_navTo = require("../../utils/navTo.js");
const api_api = require("../../api/api.js");
if (!Array) {
  const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
  const _easycom_up__image2 = common_vendor.resolveComponent("up--image");
  const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
  (_easycom_u_icon2 + _easycom_up__image2 + _easycom_up_icon2)();
}
const _easycom_u_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js";
const _easycom_up__image = () => "../../node-modules/uview-plus/components/u--image/u--image.js";
const _easycom_up_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js";
if (!Math) {
  (navBar + _easycom_u_icon + _easycom_up__image + _easycom_up_icon + tabBar)();
}
const navBar = () => "../../components/navBar/navBar.js";
const tabBar = () => "../../components/tabBar/tabBar.js";
const _sfc_main = {
  __name: "caseTalk",
  setup(__props) {
    const numInfo = common_vendor.reactive({});
    const most_read_articles = common_vendor.ref([]);
    const new_articles = common_vendor.ref([]);
    const formatdate = (date) => {
      return common_vendor.dayjs(date).format("YYYY-MM-DD");
    };
    const goList = (type) => {
      if (type == "read") {
        utils_navTo.navTo({
          url: "/pages/specialList/specialList?is_selected=1"
        });
      } else {
        utils_navTo.navTo({
          url: "/pages/specialList/specialList"
        });
      }
    };
    const getStatic = () => {
      api_api.api.getExchangeStatic().then((res) => {
        let result = res.data.data;
        Object.assign(numInfo, result);
      });
    };
    const goDetail = (id) => {
      utils_navTo.navTo({
        url: `/pages/detail/detail?id=${id}&type=exchange`
      });
    };
    const videoErrorCallback = (e) => {
      common_vendor.index.showModal({
        content: e.target.errMsg,
        showCancel: false
      });
    };
    const searchList = async () => {
      let searchForm = {
        page: 1,
        page_size: 10
      };
      api_api.api.searchExchage({
        ...searchForm
      }).then((res) => {
        new_articles.value = res.data.data.data;
      }).catch((err) => {
      });
    };
    const goodList = () => {
      api_api.api.searchExchageGood({
        is_selected: 1,
        limit: 5
      }).then((res) => {
        most_read_articles.value = res.data.data;
      });
    };
    common_vendor.onShow(() => {
      getStatic();
      goodList();
      searchList();
    });
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.p({
          navName: "肝胆相照病例交流园地",
          type: "caseTalk"
        }),
        b: common_vendor.t(numInfo.exchange_num),
        c: common_vendor.t(numInfo.exchange_collect_num),
        d: common_vendor.t(numInfo.exchange_read_num),
        e: most_read_articles.value.length > 0
      }, most_read_articles.value.length > 0 ? {
        f: common_vendor.p({
          name: "arrow-right",
          size: "16",
          color: "#3CC7C0"
        }),
        g: common_vendor.o(($event) => goList("read")),
        h: common_vendor.f(most_read_articles.value, (item, k0, i0) => {
          return {
            a: common_vendor.t(item.exchange_title),
            b: item.exchange_id,
            c: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id)
          };
        })
      } : {}, {
        i: common_vendor.p({
          name: "arrow-right",
          size: "16",
          color: "#3CC7C0"
        }),
        j: common_vendor.o(($event) => goList("new")),
        k: common_vendor.f(new_articles.value, (item, k0, i0) => {
          return common_vendor.e({
            a: common_vendor.t(item.exchange_title),
            b: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id),
            c: "4b2e7592-3-" + i0,
            d: common_vendor.p({
              src: item.avatar ? item.avatar : common_vendor.unref(common_assets.headImg),
              width: "46rpx",
              height: "46rpx",
              radius: "50%"
            }),
            e: common_vendor.t(item.user_name),
            f: common_vendor.t(item.hospital_name),
            g: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id),
            h: common_vendor.t(item.exchange_content),
            i: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id),
            j: item.exchange_content_image && item.exchange_content_image.length > 0
          }, item.exchange_content_image && item.exchange_content_image.length > 0 ? {
            k: common_vendor.f(item.exchange_content_image, (unit, k1, i1) => {
              return {
                a: "4b2e7592-4-" + i0 + "-" + i1,
                b: common_vendor.p({
                  src: unit,
                  radius: "10",
                  width: "220rpx",
                  height: "220rpx"
                })
              };
            }),
            l: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id)
          } : {}, {
            m: item.exchange_content_video && item.exchange_content_video.length > 0
          }, item.exchange_content_video && item.exchange_content_video.length > 0 ? {
            n: common_vendor.f(item.exchange_content_video, (videoCell, index, i1) => {
              return {
                a: index,
                b: videoCell,
                c: common_vendor.o(videoErrorCallback, index)
              };
            })
          } : {}, {
            o: item.label && item.label.length > 0
          }, item.label && item.label.length > 0 ? {
            p: common_vendor.f(item.label, (cell, k1, i1) => {
              return {
                a: common_vendor.t(cell.label_name),
                b: cell.exchange_label_id
              };
            }),
            q: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id)
          } : {}, {
            r: "4b2e7592-5-" + i0,
            s: common_vendor.t(item.read_num),
            t: "4b2e7592-6-" + i0,
            v: common_vendor.t(item.collect_num),
            w: "4b2e7592-7-" + i0,
            x: common_vendor.t(item.comment_num),
            y: "4b2e7592-8-" + i0,
            z: common_vendor.t(formatdate(item.push_date)),
            A: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id),
            B: item.exchange_id
          });
        }),
        l: common_vendor.p({
          name: "eye",
          color: "#4B5563",
          size: "28rpx"
        }),
        m: common_vendor.p({
          name: "heart",
          color: "#4B5563",
          size: "28rpx"
        }),
        n: common_vendor.p({
          name: "chat",
          color: "#4B5563",
          size: "28rpx"
        }),
        o: common_vendor.p({
          name: "clock",
          color: "#4B5563",
          size: "28rpx"
        }),
        p: common_vendor.p({
          value: 2
        })
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4b2e7592"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/caseTalk/caseTalk.js.map
