"use strict";
const common_vendor = require("../../common/vendor.js");
const api_api = require("../../api/api.js");
if (!Array) {
  const _easycom_up_tabs2 = common_vendor.resolveComponent("up-tabs");
  const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
  const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
  const _easycom_up_popup2 = common_vendor.resolveComponent("up-popup");
  const _easycom_up_overlay2 = common_vendor.resolveComponent("up-overlay");
  (_easycom_up_tabs2 + _easycom_up_icon2 + _easycom_z_paging2 + _easycom_up_popup2 + _easycom_up_overlay2)();
}
const _easycom_up_tabs = () => "../../node-modules/uview-plus/components/u-tabs/u-tabs.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";
const _easycom_up_popup = () => "../../node-modules/uview-plus/components/u-popup/u-popup.js";
const _easycom_up_overlay = () => "../../node-modules/uview-plus/components/u-overlay/u-overlay.js";
if (!Math) {
  (backLogoNav + _easycom_up_tabs + _easycom_up_icon + _easycom_z_paging + _easycom_up_popup + _easycom_up_overlay)();
}
const backLogoNav = () => "../../components/backLogoNav/backLogoNav.js";
const _sfc_main = {
  __name: "myJoin",
  setup(__props) {
    const paging = common_vendor.ref(null);
    common_vendor.ref(null);
    const dataList = common_vendor.ref([]);
    const total = common_vendor.ref(0);
    const delId = common_vendor.ref("");
    const keyWord = common_vendor.ref("");
    common_vendor.ref(true);
    const navName = common_vendor.ref("肝胆相照临床病例库");
    const showDeal = common_vendor.ref(false);
    const showModal = common_vendor.ref(false);
    const tab = common_vendor.ref(0);
    const closeDeal = () => {
      showDeal.value = false;
    };
    const alertPop = () => {
      showModal.value = true;
      showDeal.value = false;
    };
    const confirmDel = () => {
      if (tab.value == 0) {
        delExchangeComment(delId.value);
      } else if (tab.value == 1) {
        delArticleComment(delId.value);
      } else if (tab.value == 2) {
        delVideoComment(delId.value);
      }
      showModal.value = false;
    };
    const openDeal = () => {
      showDeal.value = true;
    };
    const isDel = (id) => {
      delId.value = id;
      showDeal.value = true;
    };
    common_vendor.ref([
      {
        label: "正序",
        value: "asc"
      },
      {
        label: "倒序",
        value: "desc"
      }
    ]);
    const tabList = common_vendor.ref([
      {
        name: "病例交流"
      },
      {
        name: "文章病例库"
      },
      {
        name: "视频病例库"
      }
    ]);
    const delArticleComment = (id) => {
      api_api.api.delArticleComment(id).then((res) => {
        common_vendor.index.showToast({
          icon: "none",
          title: "删除成功"
        });
        paging.value.refresh();
      });
    };
    const delVideoComment = (id) => {
      api_api.api.delVideoComment(id).then((res) => {
        common_vendor.index.showToast({
          icon: "none",
          title: "删除成功"
        });
        paging.value.refresh();
      });
    };
    const delExchangeComment = (id) => {
      api_api.api.delExchangeComment(id).then((res) => {
        common_vendor.index.showToast({
          icon: "none",
          title: "删除成功"
        });
        paging.value.refresh();
      });
    };
    const switchTab = (item) => {
      tab.value = item.index;
      paging.value.reload();
    };
    common_vendor.onLoad((options) => {
    });
    const formatdate = (date) => {
      return common_vendor.dayjs(date).format("YYYY-MM-DD");
    };
    const getExchangeCommentUser = async (params) => {
      api_api.api.getExchangeCommentUser({
        ...params
      }).then((res) => {
        paging.value.complete(res.data.data.data);
        total.value = res.data.data.total;
      }).catch((err) => {
        paging.value.complete(false);
      });
    };
    const getArticleCommentUser = async (params) => {
      api_api.api.getArticleCommentUser({
        ...params
      }).then((res) => {
        paging.value.complete(res.data.data.data);
        total.value = res.data.data.total;
      }).catch((err) => {
        paging.value.complete(false);
      });
    };
    const getVideoCommentUser = async (params) => {
      api_api.api.getVideoCommentUser({
        ...params
      }).then((res) => {
        paging.value.complete(res.data.data.data);
        total.value = res.data.data.total;
      }).catch((err) => {
        paging.value.complete(false);
      });
    };
    const queryList = (pageNo, pageSize) => {
      const params = {
        page: pageNo,
        page_size: pageSize
      };
      if (tab.value == 0) {
        getExchangeCommentUser(params);
      } else if (tab.value == 1) {
        getArticleCommentUser(params);
      } else {
        getVideoCommentUser(params);
      }
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.p({
          searchWord: keyWord.value,
          navName: navName.value
        }),
        b: common_vendor.o(switchTab),
        c: common_vendor.p({
          activeStyle: {
            color: "#3CC7C0"
          },
          inactiveStyle: {
            color: "#4B5563"
          },
          lineColor: "#3CC7C0",
          lineWidth: "155rpx",
          lineHeight: "2",
          list: tabList.value
        }),
        d: common_vendor.f(dataList.value, (item, index, i0) => {
          return common_vendor.e({
            a: common_vendor.t(item.content),
            b: "235c92a6-3-" + i0 + ",235c92a6-0",
            c: common_vendor.t(formatdate(item.created_at)),
            d: common_vendor.o(($event) => isDel(item.comment_id), index)
          }, tab.value == 0 ? {
            e: common_vendor.t(item.author_name),
            f: common_vendor.t(item.author_hospital_name)
          } : {}, tab.value == 0 ? {
            g: common_vendor.t(item.exchange_title)
          } : tab.value == 1 ? {
            h: common_vendor.t(item.article_title)
          } : tab.value == 2 ? {
            i: common_vendor.t(item.video_title)
          } : {}, {
            j: index
          });
        }),
        e: common_vendor.p({
          name: "clock",
          color: "#6B7280",
          size: "28rpx"
        }),
        f: tab.value == 0,
        g: tab.value == 0,
        h: tab.value == 1,
        i: tab.value == 2,
        j: common_vendor.sr(paging, "235c92a6-0", {
          "k": "paging"
        }),
        k: common_vendor.o(queryList),
        l: common_vendor.o(($event) => dataList.value = $event),
        m: common_vendor.p({
          ["inside-more"]: true,
          ["loading-more-no-more-text"]: "咱也是有底线的！",
          ["auto-show-back-to-top"]: true,
          modelValue: dataList.value
        }),
        n: common_vendor.o(alertPop),
        o: common_vendor.o(closeDeal),
        p: common_vendor.o(closeDeal),
        q: common_vendor.o(openDeal),
        r: common_vendor.p({
          zIndex: 10,
          overlayStyle: {
            zIndex: 9
          },
          closeOnClickOverlay: false,
          show: showDeal.value,
          round: 10,
          mode: "bottom"
        }),
        s: common_vendor.o(($event) => showModal.value = false),
        t: common_vendor.o(confirmDel),
        v: common_vendor.p({
          show: showModal.value,
          ["mask-click-able"]: true
        })
      };
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-235c92a6"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/myJoin/myJoin.js.map
