123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- "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 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");
- };
- const search = async () => {
- const info = {
- pageNum: pageNum.value,
- pageSize: pageSize.value,
- userId: user.value.id
- };
- const res = await $api("activity/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 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;
- page.value = 0;
- };
- 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) => {
- return {
- a: common_vendor.t(item.date || "暂无日期"),
- b: common_vendor.t(item.status_name || "暂无状态"),
- c: common_vendor.n(item.status == "0" ? "status0" : item.status == "1" ? "status1" : "status2"),
- d: common_vendor.t(item.name || "暂无活动名称"),
- e: common_vendor.t(item.red_name || "暂无红方名称"),
- f: item.red_logo || common_vendor.unref(config).logoUrl,
- g: common_vendor.t(item.red_score || 0),
- h: common_vendor.t(item.blue_score || 0),
- i: item.blue_logo || common_vendor.unref(config).logoUrl,
- j: common_vendor.t(item.blue_name || "暂无蓝方名称"),
- k: index,
- l: 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);
|