|
@@ -2,30 +2,54 @@
|
|
|
const common_vendor = require("../../../common/vendor.js");
|
|
|
const _sfc_main = common_vendor.defineComponent({
|
|
|
__name: "activity",
|
|
|
+ props: {
|
|
|
+ config: { type: Object, default: () => {
|
|
|
+ } }
|
|
|
+ },
|
|
|
setup(__props) {
|
|
|
- const config = common_vendor.ref({ bottomTitle: "", logoUrl: "" });
|
|
|
- const searchInfo = common_vendor.ref({ name: "" });
|
|
|
+ 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 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 scrollTop = common_vendor.ref(0);
|
|
|
const is_bottom = common_vendor.ref(false);
|
|
|
- common_vendor.onShow(() => {
|
|
|
- searchConfig();
|
|
|
- search();
|
|
|
+ const { config } = common_vendor.toRefs(props);
|
|
|
+ common_vendor.onShow(async () => {
|
|
|
+ await searchUser();
|
|
|
+ await search();
|
|
|
});
|
|
|
- const searchConfig = async () => {
|
|
|
- config.value = common_vendor.index.getStorageSync("config");
|
|
|
+ const searchUser = async () => {
|
|
|
+ user.value = common_vendor.index.getStorageSync("user");
|
|
|
};
|
|
|
const search = async () => {
|
|
|
- console.log("查询");
|
|
|
+ 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 = { name: "" };
|
|
|
+ searchInfo.value = {};
|
|
|
clearPage();
|
|
|
search();
|
|
|
};
|
|
@@ -40,8 +64,8 @@ const _sfc_main = common_vendor.defineComponent({
|
|
|
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 +80,8 @@ const _sfc_main = common_vendor.defineComponent({
|
|
|
};
|
|
|
const clearPage = () => {
|
|
|
list.value = [];
|
|
|
- skip.value = 0;
|
|
|
- limit.value = 6;
|
|
|
+ pageNum.value = 1;
|
|
|
+ pageSize.value = 10;
|
|
|
page.value = 0;
|
|
|
};
|
|
|
return (_ctx, _cache) => {
|
|
@@ -76,10 +100,10 @@ const _sfc_main = common_vendor.defineComponent({
|
|
|
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,
|
|
|
+ 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 || config.value.logoUrl,
|
|
|
+ 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)
|
|
@@ -87,7 +111,7 @@ const _sfc_main = common_vendor.defineComponent({
|
|
|
}),
|
|
|
e: is_bottom.value
|
|
|
}, is_bottom.value ? {
|
|
|
- f: common_vendor.t(config.value.bottomTitle || "到底了!")
|
|
|
+ f: common_vendor.t(common_vendor.unref(config).bottomTitle || "到底了!")
|
|
|
} : {}, {
|
|
|
g: common_vendor.o(toPage),
|
|
|
h: common_vendor.o(toScroll)
|