"use strict";
const common_vendor = require("../../common/vendor.js");
const api_api = require("../../api/api.js");
const utils_navTo = require("../../utils/navTo.js");
const common_assets = require("../../common/assets.js");
if (!Array) {
  const _easycom_up_tabs2 = common_vendor.resolveComponent("up-tabs");
  const _easycom_up__image2 = common_vendor.resolveComponent("up--image");
  const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
  const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
  (_easycom_up_tabs2 + _easycom_up__image2 + _easycom_up_icon2 + _easycom_z_paging2)();
}
const _easycom_up_tabs = () => "../../node-modules/uview-plus/components/u-tabs/u-tabs.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";
const _easycom_z_paging = () => "../../uni_modules/z-paging/components/z-paging/z-paging.js";
if (!Math) {
  (navBarSearch + _easycom_up_tabs + _easycom_up__image + _easycom_up_icon + _easycom_z_paging)();
}
const navBarSearch = () => "../../components/navBarSearch/navBarSearch.js";
const _sfc_main = {
  __name: "certList",
  setup(__props) {
    const paging = common_vendor.ref(null);
    const isSearch = common_vendor.ref(false);
    const dataList = common_vendor.ref([]);
    const total = common_vendor.ref(0);
    common_vendor.ref("");
    const keyWord = common_vendor.ref("");
    const tab = common_vendor.ref(0);
    common_vendor.ref("");
    const doctor_id = common_vendor.ref("");
    const numInfo = common_vendor.reactive({});
    const navName = common_vendor.ref("肝胆相照临床病例库");
    const formatdate = (date) => {
      return common_vendor.dayjs(date).format("YYYY-MM-DD");
    };
    const tabList = common_vendor.ref([{
      name: "文章病例库"
    }, {
      name: "视频病例库"
    }]);
    const switchTab = (index) => {
      tab.value = index.index;
      paging.value.reload();
    };
    common_vendor.onLoad((options) => {
      if (options.keyWord) {
        keyWord.value = options.keyWord;
      }
      if (options.doctor_id) {
        doctor_id.value = options.doctor_id;
      }
    });
    const goDetail = (url) => {
      utils_navTo.navTo({
        url: `/pages/certImg/certImg?src=${url}`
      });
    };
    const changeWord = (val) => {
      keyWord.value = val;
      isSearch.value = true;
      paging.value.reload();
    };
    const searchArticle = (params) => {
      let searchForm = {
        keyword: keyWord.value,
        doctor_id: doctor_id.value
      };
      if (isSearch.value) {
        formatdate.is_need_num = 1;
      }
      api_api.api.searchArticle({
        ...searchForm,
        ...params
      }).then((res) => {
        paging.value.complete(res.data.data.data);
        total.value = res.data.data.total;
        numInfo.search_article_num = res.data.data.search_article_num;
        numInfo.search_video_num = res.data.data.search_video_num;
      }).catch((err) => {
        paging.value.complete(false);
      });
    };
    const searchVideo = async (params) => {
      let searchForm = {
        keyword: keyWord.value,
        doctor_id: doctor_id.value
      };
      api_api.api.searchVideo({
        ...searchForm,
        ...params
      }).then((res) => {
        paging.value.complete(res.data.data.data);
        total.value = res.data.data.total;
        numInfo.search_article_num = res.data.data.search_article_num;
        numInfo.search_video_num = res.data.data.search_video_num;
      }).catch((err) => {
        paging.value.complete(false);
      });
    };
    const queryList = (pageNo, pageSize) => {
      common_vendor.index.__f__("log", "at pages/certList/certList.vue:162", 666666);
      const params = {
        page: pageNo,
        page_size: pageSize
      };
      tab.value == 0 ? searchArticle(params) : searchVideo(params);
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.o(changeWord),
        b: common_vendor.p({
          searchWord: keyWord.value,
          navName: navName.value
        }),
        c: isSearch.value
      }, isSearch.value ? common_vendor.e({
        d: common_vendor.t(numInfo.search_article_num),
        e: common_vendor.t(numInfo.search_video_num),
        f: keyWord.value
      }, keyWord.value ? {
        g: common_vendor.t(keyWord.value)
      } : {}) : {}, {
        h: common_vendor.o(switchTab),
        i: common_vendor.p({
          activeStyle: {
            color: "#3CC7C0"
          },
          inactiveStyle: {
            color: "#4B5563"
          },
          lineColor: "#3CC7C0",
          lineWidth: "155rpx",
          lineHeight: "2",
          list: tabList.value
        }),
        j: common_vendor.f(dataList.value, (item, index, i0) => {
          return {
            a: common_vendor.t(tab.value == 0 ? item.article_title : item.video_title),
            b: common_vendor.f(item.author, (tag, k1, i1) => {
              return {
                a: common_vendor.t(tag.doctor_name),
                b: tag.author_id
              };
            }),
            c: "24ff958c-3-" + i0 + ",24ff958c-0",
            d: "24ff958c-4-" + i0 + ",24ff958c-0",
            e: common_vendor.t(formatdate(item.push_date)),
            f: index,
            g: common_vendor.o(($event) => goDetail(item.cert_image), index)
          };
        }),
        k: common_vendor.p({
          src: common_vendor.unref(common_assets.certImg),
          width: "39rpx",
          height: "39rpx"
        }),
        l: common_vendor.p({
          name: "clock",
          color: "#6B7280",
          size: "28rpx"
        }),
        m: common_vendor.sr(paging, "24ff958c-0", {
          "k": "paging"
        }),
        n: common_vendor.o(queryList),
        o: common_vendor.o(($event) => dataList.value = $event),
        p: common_vendor.p({
          ["inside-more"]: true,
          ["loading-more-no-more-text"]: "咱也是有底线的！",
          ["auto-show-back-to-top"]: true,
          modelValue: dataList.value
        })
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-24ff958c"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/certList/certList.js.map
