投注记录增加分页
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-07-19 17:26:03 +08:00
parent 90d60a504b
commit 6844e25cef
2 changed files with 32 additions and 3 deletions

View File

@@ -4,8 +4,10 @@ export const GetBetOptList = async (type) =>
await alovaInst.Get(`/dice/shake?type=${type}`);
export const GetUserInfo = async (uid) =>
await alovaInst.Get(`/dice/userShakeInfo?uid=${uid}`);
export const GetBetRecord = async (uid) =>
await alovaInst.Get(`/dice/userShakeRecord?uid=${uid}`);
export const GetBetRecord = async (data) =>
await alovaInst.Get(
`/dice/userShakeRecord?uid=${data.uid}&PageNum=${data.PageNum}&PageSize=${data.PageSize}`
);
export const GetLotteryRecord = async (uid) =>
await alovaInst.Get(`/dice/draw?uid=${uid}`);
export const GetPeriod = async () => await alovaInst.Get(`/dice/periods`);

View File

@@ -90,6 +90,12 @@ const uid = ref("");
// ]);
const data = ref([]);
const page = ref({
page: 1,
size: 10,
total: 0,
});
Taro.useLoad((opt) => {
uid.value = opt.uid;
});
@@ -98,8 +104,27 @@ Taro.useDidShow(() => {
getList();
});
Taro.useReachBottom(async () => {
if (page.value.page * page.value.size >= page.value.total) {
Taro.showToast({
title: "没有更多了",
icon: "none",
});
return;
}
page.value.page++;
await getList();
});
const getList = async () => {
const res = await GetBetRecord(uid.value);
Taro.showLoading({
title: "加载中",
});
const res = await GetBetRecord({
uid: uid.value,
PageNum: page.value.page,
PageSize: page.value.size,
});
// console.log(res);
data.value = res.data.map((item) => ({
type: 1,
@@ -111,6 +136,8 @@ const getList = async () => {
state: item.State,
periods_num: item.PeriodsNum,
}));
page.value.total = res.data.total || 0;
Taro.hideLoading();
};
</script>