"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const api_index = require("../../api/index.js");
if (!Array) {
  const _easycom_wd_navbar2 = common_vendor.resolveComponent("wd-navbar");
  const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
  (_easycom_wd_navbar2 + _easycom_z_paging2)();
}
const _easycom_wd_navbar = () => "../../uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.js";
const _easycom_z_paging = () => "../../uni_modules/z-paging/components/z-paging/z-paging.js";
if (!Math) {
  (_easycom_wd_navbar + _easycom_z_paging)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "notice",
  setup(__props) {
    const active = common_vendor.ref(1);
    const categoryId = common_vendor.ref("");
    const paging = common_vendor.ref(null);
    const dataList = common_vendor.ref([]);
    const noticeCateList = common_vendor.ref([]);
    common_vendor.onLoad(() => {
      api_index.api.noticeCatePage().then((res) => {
        noticeCateList.value = res.list;
      });
    });
    const toDeitl = (item) => {
      if (active.value == 1) {
        common_vendor.index.showModal({
          title: "通知",
          content: item.content,
          showCancel: false
        });
      } else {
        common_vendor.index.navigateTo({
          url: "/pages/notice/details?id=" + item.id
        });
      }
    };
    const activeChange = (e, cateId) => {
      active.value = e;
      categoryId.value = cateId;
      paging.value.reload();
    };
    const queryList = (pageNo, pageSize) => {
      api_index.api.noticePage({ pageNo, pageSize, type: active.value, categoryId: categoryId.value }).then((res) => {
        paging.value.complete(res.list);
      }).catch((res) => {
        paging.value.complete(false);
      });
    };
    const back = () => {
      common_vendor.index.navigateBack();
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.o(back),
        b: common_vendor.p({
          title: "公告",
          safeAreaInsetTop: true,
          ["left-arrow"]: true
        }),
        c: common_vendor.n(active.value == 1 ? "active" : ""),
        d: common_vendor.o(($event) => activeChange(1, "")),
        e: common_vendor.f(noticeCateList.value, (item, index, i0) => {
          return {
            a: common_vendor.t(item.categoryName),
            b: common_vendor.n(active.value == 2 && categoryId.value == item.id ? "active" : ""),
            c: common_vendor.o(($event) => activeChange(2, item.id), index),
            d: index
          };
        }),
        f: common_vendor.f(dataList.value, (item, index, i0) => {
          return common_vendor.e({
            a: common_vendor.t(active.value == 1 ? item.content : item.title)
          }, active.value == 2 ? {
            b: common_assets._imports_0$1
          } : {}, {
            c: index,
            d: common_vendor.o(($event) => toDeitl(item), index)
          });
        }),
        g: common_vendor.t(active.value == 1 ? "通知" : active.value == 2 ? noticeCateList.value.find((val) => val.id == categoryId.value).categoryName : ""),
        h: active.value == 2,
        i: common_vendor.sr(paging, "1c2e4c1e-1", {
          "k": "paging"
        }),
        j: common_vendor.o(queryList),
        k: common_vendor.o(($event) => dataList.value = $event),
        l: common_vendor.p({
          ["use-page-scroll"]: true,
          modelValue: dataList.value
        })
      };
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1c2e4c1e"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/notice/notice.js.map
