From 5fc3de821aa16a09b511f8021a3730fe05e52226 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Fri, 26 Dec 2025 22:26:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/oj/contest/pages/rank.vue | 23 ++++++++----------- .../components/UserProgressView.vue | 2 +- src/shared/components/Pagination.vue | 5 +--- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/oj/contest/pages/rank.vue b/src/oj/contest/pages/rank.vue index 66e402f..dd575ae 100644 --- a/src/oj/contest/pages/rank.vue +++ b/src/oj/contest/pages/rank.vue @@ -5,6 +5,7 @@ import { getContestProblems, getContestRank } from "oj/api" import { secondsToDuration } from "utils/functions" import { useContestStore } from "oj/store/contest" import Pagination from "shared/components/Pagination.vue" +import { usePagination } from "shared/composables/pagination" import { ContestStatus } from "utils/constants" import { renderTableTitle } from "utils/renders" import { ContestRank, ProblemFiltered } from "utils/types" @@ -39,10 +40,8 @@ const { resume, pause } = useIntervalFn( }, ) -const query = reactive({ - limit: 50, - page: 1, -}) +// 使用分页 composable +const { query } = usePagination({}, { defaultLimit: 50 }) const columns = ref[]>([ { @@ -191,14 +190,8 @@ async function addColumns() { } } -watch(() => query.page, listRanks) -watch( - () => query.limit, - () => { - query.page = 1 - listRanks() - }, -) +// 监听分页参数变化 +watch([() => query.page, () => query.limit], listRanks) watch(autoRefresh, (checked) => (checked ? resume() : pause())) onMounted(() => { @@ -232,8 +225,10 @@ onMounted(() => { diff --git a/src/oj/problemset/components/UserProgressView.vue b/src/oj/problemset/components/UserProgressView.vue index a174756..bb8ba98 100644 --- a/src/oj/problemset/components/UserProgressView.vue +++ b/src/oj/problemset/components/UserProgressView.vue @@ -33,7 +33,7 @@ const completionOptions = [ ] // 使用分页 composable -const { query } = usePagination({}, { defaultLimit: 10 }) +const { query } = usePagination({}, { defaultLimit: 50 }) // 加载用户进度数据 async function loadUserProgress() { diff --git a/src/shared/components/Pagination.vue b/src/shared/components/Pagination.vue index dd07bf7..bac83f1 100644 --- a/src/shared/components/Pagination.vue +++ b/src/shared/components/Pagination.vue @@ -20,10 +20,7 @@ const { isDesktop } = useBreakpoints() const limit = ref(props.limit) const page = ref(props.page) -const sizes = computed(() => { - if (route.name === "contest rank") return [10, 30, 50] - return [10, 20, 30] -}) +const sizes = [10, 30, 50] watch(limit, () => emit("update:limit", limit)) watch(page, () => emit("update:page", page))