|
@@ -3,24 +3,52 @@ const common_vendor = require("../../common/vendor.js");
|
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
__name: "index",
|
|
|
setup(__props) {
|
|
|
+ var _a;
|
|
|
+ const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
|
|
|
+ const user = common_vendor.ref({});
|
|
|
const config = common_vendor.ref({ bottomTitle: "", logoUrl: "" });
|
|
|
const searchInfo = common_vendor.ref({ name: "" });
|
|
|
const list = common_vendor.ref([{ id: 1, name: "测试球队" }, { id: 1, name: "肝帝集团队" }]);
|
|
|
- const skip = common_vendor.ref(0);
|
|
|
- const limit = common_vendor.ref(6);
|
|
|
- const page = common_vendor.ref(0);
|
|
|
+ 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);
|
|
|
- common_vendor.onShow(() => {
|
|
|
- searchConfig();
|
|
|
- search();
|
|
|
+ common_vendor.onShow(async () => {
|
|
|
+ await searchUser();
|
|
|
+ await searchConfig();
|
|
|
+ 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 searchConfig = async () => {
|
|
|
config.value = common_vendor.index.getStorageSync("config");
|
|
|
};
|
|
|
const search = async () => {
|
|
|
- console.log("查询");
|
|
|
+ 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)
|
|
@@ -31,17 +59,34 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
};
|
|
|
const toInfo = (item) => {
|
|
|
common_vendor.index.navigateTo({
|
|
|
- url: `/pagesHome/activity/info?id=${item._id || item.id}&name=${item.name}`
|
|
|
+ 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
|
|
|
});
|
|
|
- page.value = page.value + 1;
|
|
|
- skip.value = page.value * limit.value;
|
|
|
+ pageNum.value = pageNum.value + 1;
|
|
|
+ pageSize.value = pageNum.value * 10;
|
|
|
search();
|
|
|
common_vendor.index.hideLoading();
|
|
|
} else
|
|
@@ -56,8 +101,8 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
};
|
|
|
const clearPage = () => {
|
|
|
list.value = [];
|
|
|
- skip.value = 0;
|
|
|
- limit.value = 6;
|
|
|
+ pageNum.value = 1;
|
|
|
+ pageSize.value = 10;
|
|
|
};
|
|
|
return (_ctx, _cache) => {
|
|
|
return common_vendor.e({
|
|
@@ -69,20 +114,27 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
};
|
|
|
}),
|
|
|
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 || config.value.logoUrl,
|
|
|
- g: common_vendor.t(item.red_score || 0),
|
|
|
- h: common_vendor.t(item.blue_score || 0),
|
|
|
- i: item.blue_logo || config.value.logoUrl,
|
|
|
- j: common_vendor.t(item.blue_name || "暂无蓝方名称"),
|
|
|
- k: index,
|
|
|
- l: common_vendor.o(($event) => toInfo(item), index)
|
|
|
- };
|
|
|
+ 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) || config.value.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) || config.value.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 ? {
|