"use strict"; const common_vendor = require("../../../common/vendor.js"); const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ __name: "activity", props: { config: { type: Object, default: () => { } } }, setup(__props) { var _a; const props = __props; const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api; const user = common_vendor.ref({}); const searchInfo = common_vendor.ref({}); const list = common_vendor.ref([{ id: 1, name: "测试球队" }, { id: 1, name: "肝帝集团队" }]); const pageNum = common_vendor.ref(1); const pageSize = common_vendor.ref(10); const total = common_vendor.ref(0); const statusList = common_vendor.ref([]); const scrollTop = common_vendor.ref(0); const is_bottom = common_vendor.ref(false); const { config } = common_vendor.toRefs(props); common_vendor.onShow(async () => { await searchUser(); await search(); }); const searchUser = async () => { user.value = common_vendor.index.getStorageSync("user"); let res; res = await $api(`dict/data/list`, "GET", { dictType: "sys_game_status", status: "0" }); if (res.code === 200 && res.total > 0) statusList.value = res.rows; }; const search = async () => { const info = { pageNum: pageNum.value, pageSize: pageSize.value, userId: user.value.id }; const res = await $api("game/list", "GET", { ...info, ...searchInfo.value }); if (res.code === 200) { list.value = res.rows; total.value = res.total; } else { common_vendor.index.showToast({ title: res.msg || "", icon: "error" }); } }; const toInput = (e) => { if (searchInfo.value.name) searchInfo.value.name = e.detail.value; searchInfo.value = {}; clearPage(); search(); }; const toInfo = (item) => { common_vendor.index.navigateTo({ url: `/pagesHome/activity/info?id=${item._id || item.id}&name=${item.name || ""}` }); }; const getDayOfWeek = (dateString) => { if (dateString) { const date = new Date(dateString); const dayOfWeek = date.getDay(); const weekdays = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; return weekdays[dayOfWeek]; } else return "暂无日期"; }; const getStatus = (value) => { if (value) { const data = statusList.value.find((i) => i.dictValue == value); if (data) return data.dictLabel; } else return "暂无状态"; }; const toPage = () => { if (total.value > list.value.length) { common_vendor.index.showLoading({ title: "加载中", mask: true }); pageNum.value = pageNum.value + 1; pageSize.value = pageNum.value * 10; search(); common_vendor.index.hideLoading(); } else is_bottom.value = true; }; const toScroll = (e) => { let up = scrollTop.value; scrollTop.value = e.detail.scrollTop; let num = Math.sign(up - e.detail.scrollTop); if (num == 1) is_bottom.value = false; }; const clearPage = () => { list.value = []; pageNum.value = 1; pageSize.value = 10; }; return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.o([($event) => searchInfo.value.name = $event.detail.value, toInput]), b: searchInfo.value.name, c: common_vendor.f(list.value, (item, index, i0) => { return { a: index }; }), d: common_vendor.f(list.value, (item, index, i0) => { var _a2, _b, _c, _d, _e, _f; return common_vendor.e({ a: common_vendor.t(common_vendor.unref(common_vendor.hooks)(item.startTime).format("MM-DD") || "暂无日期"), b: common_vendor.t(getDayOfWeek(item.startTime)), c: common_vendor.t(getStatus(item.status)), d: common_vendor.n(item.status == "0" ? "status0" : item.status == "1" ? "status1" : item.status == "2" ? "status2" : "status3"), e: item.type == "0" }, item.type == "0" ? { f: common_vendor.t(((_a2 = item == null ? void 0 : item.matchInfo) == null ? void 0 : _a2.title) || "友谊赛") } : { g: common_vendor.t(((_b = item == null ? void 0 : item.leagueInfo) == null ? void 0 : _b.title) || "联赛") }, { h: common_vendor.t(((_c = item == null ? void 0 : item.redInfo) == null ? void 0 : _c.name) || "暂无红方名称"), i: ((_d = item == null ? void 0 : item.redInfo) == null ? void 0 : _d.logo) || common_vendor.unref(config).logoUrl, j: common_vendor.t(item.redScore || 0), k: common_vendor.t(item.blueScore || 0), l: ((_e = item == null ? void 0 : item.blueInfo) == null ? void 0 : _e.logo) || common_vendor.unref(config).logoUrl, m: common_vendor.t(((_f = item == null ? void 0 : item.blueInfo) == null ? void 0 : _f.name) || "暂无蓝方名称"), n: index, o: common_vendor.o(($event) => toInfo(item), index) }); }), e: is_bottom.value }, is_bottom.value ? { f: common_vendor.t(common_vendor.unref(config).bottomTitle || "到底了!") } : {}, { g: common_vendor.o(toPage), h: common_vendor.o(toScroll) }); }; } }); const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-8f22acf3"], ["__file", "D:/project/足球比赛/match_applet/pages/home/components/activity.vue"]]); wx.createComponent(Component);