"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const api_api = require("../../api/api.js");
const utils_navTo = require("../../utils/navTo.js");
if (!Array) {
  const _easycom_navBarSearch2 = common_vendor.resolveComponent("navBarSearch");
  const _easycom_up_dropdown_item2 = common_vendor.resolveComponent("up-dropdown-item");
  const _easycom_up_dropdown2 = common_vendor.resolveComponent("up-dropdown");
  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_navBarSearch2 + _easycom_up_dropdown_item2 + _easycom_up_dropdown2 + _easycom_up__image2 + _easycom_up_icon2 + _easycom_z_paging2)();
}
const _easycom_navBarSearch = () => "../../components/navBarSearch/navBarSearch.js";
const _easycom_up_dropdown_item = () => "../../node-modules/uview-plus/components/u-dropdown-item/u-dropdown-item.js";
const _easycom_up_dropdown = () => "../../node-modules/uview-plus/components/u-dropdown/u-dropdown.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) {
  (_easycom_navBarSearch + _easycom_up_dropdown_item + _easycom_up_dropdown + _easycom_up__image + _easycom_up_icon + _easycom_z_paging)();
}
const _sfc_main = {
  __name: "specialList",
  setup(__props) {
    const user_id = common_vendor.ref("");
    const is_selected = common_vendor.ref(0);
    const paging = common_vendor.ref(null);
    const dataList = common_vendor.ref([]);
    const total = common_vendor.ref(0);
    const keyWord = common_vendor.ref("");
    const showNum = common_vendor.ref(false);
    const options = common_vendor.ref([
      {
        label: "正序",
        value: "asc"
      },
      {
        label: "倒序",
        value: "desc"
      }
    ]);
    const order = common_vendor.reactive({
      read_num: "",
      push_date: ""
    });
    const formatdate = (date) => {
      return common_vendor.dayjs(date).format("YYYY-MM-DD");
    };
    common_vendor.onLoad((options2) => {
      if (options2.keyWord) {
        keyWord.value = options2.keyWord;
      }
      if (options2.userId) {
        user_id.value = options2.userId;
      }
      if (options2.is_selected) {
        is_selected.value = options2.is_selected;
      }
    });
    const videoErrorCallback = (e) => {
      common_vendor.index.showModal({
        content: e.target.errMsg,
        showCancel: false
      });
    };
    const changeWord = (val) => {
      if (!val)
        return false;
      showNum.value = true;
      keyWord.value = val;
      paging.value.reload();
    };
    const goDetail = (id) => {
      utils_navTo.navTo({
        url: `/pages/detail/detail?id=${id}&type=exchange`
      });
    };
    const queryList = (pageNo, pageSize) => {
      common_vendor.index.__f__("log", "at pages/specialList/specialList.vue:218", 666666);
      const params = {
        page: pageNo,
        page_size: pageSize
      };
      searchList(params);
    };
    const searchList = async (params) => {
      let searchForm = {
        keyword: keyWord.value,
        user_id: user_id.value
      };
      if (Number(is_selected.value)) {
        searchForm.is_selected = Number(is_selected.value);
      }
      if (!order.read_num) {
        delete order.read_num;
      }
      if (!order.push_date) {
        delete order.push_date;
      }
      if (order.read_num || order.push_date) {
        searchForm.order = order;
      }
      api_api.api.searchExchage({
        ...searchForm,
        ...params
      }).then((res) => {
        paging.value.complete(res.data.data.data);
        total.value = res.data.data.total;
      }).catch((err) => {
        paging.value.complete(false);
      });
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.o(changeWord),
        b: common_vendor.p({
          navName: "肝胆相照精选病例交流"
        }),
        c: total.value > 0 && showNum.value
      }, total.value > 0 && showNum.value ? common_vendor.e({
        d: common_vendor.t(total.value),
        e: keyWord.value
      }, keyWord.value ? {
        f: common_vendor.t(keyWord.value)
      } : {}) : {}, {
        g: common_vendor.o(_ctx.change),
        h: common_vendor.o(($event) => order.push_date = $event),
        i: common_vendor.p({
          title: "发布时间",
          options: options.value,
          modelValue: order.push_date
        }),
        j: common_vendor.o(_ctx.change),
        k: common_vendor.o(($event) => order.read_num = $event),
        l: common_vendor.p({
          title: "阅读量",
          options: options.value,
          modelValue: order.read_num
        }),
        m: common_vendor.sr("uDropdownRef", "b2cb78f4-2,b2cb78f4-0"),
        n: common_vendor.f(dataList.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: "b2cb78f4-5-" + i0 + ",b2cb78f4-0",
            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: "b2cb78f4-6-" + i0 + "-" + i1 + ",b2cb78f4-0",
                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: "b2cb78f4-7-" + i0 + ",b2cb78f4-0",
            s: common_vendor.t(item.read_num),
            t: "b2cb78f4-8-" + i0 + ",b2cb78f4-0",
            v: common_vendor.t(item.collect_num),
            w: "b2cb78f4-9-" + i0 + ",b2cb78f4-0",
            x: common_vendor.t(item.comment_num),
            y: "b2cb78f4-10-" + i0 + ",b2cb78f4-0",
            z: common_vendor.t(formatdate(item.push_date)),
            A: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id),
            B: item.exchange_id
          });
        }),
        o: common_vendor.p({
          name: "eye",
          color: "#4B5563",
          size: "28rpx"
        }),
        p: common_vendor.p({
          name: "heart",
          color: "#4B5563",
          size: "28rpx"
        }),
        q: common_vendor.p({
          name: "chat",
          color: "#4B5563",
          size: "28rpx"
        }),
        r: common_vendor.p({
          name: "clock",
          color: "#4B5563",
          size: "28rpx"
        }),
        s: common_vendor.sr(paging, "b2cb78f4-0", {
          "k": "paging"
        }),
        t: common_vendor.o(queryList),
        v: common_vendor.o(($event) => dataList.value = $event),
        w: 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-b2cb78f4"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/specialList/specialList.js.map
