diff --git a/src/components/Study.vue b/src/components/Study.vue index a3bdfb3..572d973 100644 --- a/src/components/Study.vue +++ b/src/components/Study.vue @@ -37,6 +37,9 @@ interface TaskItem { const tasks = ref([]); const selectedTaskId = ref(null); const loading = ref(false); +const currentPage = ref(1); +const totalTasks = ref(0); +const pageSize = 20; const taskApplications = ref([]); const applicationsLoading = ref(false); const appUrlTitles = ref>({}); @@ -147,11 +150,13 @@ const changeApplicationStatus = async (item: TaskApplication) => { } }; -const fetchTasks = async () => { +const fetchTasks = async (page = currentPage.value) => { loading.value = true; try { const previousSelectedTaskId = selectedTaskId.value; - const res = await request.get("/tasks", { pageSize: 100, pageNum: 1 }); + currentPage.value = page; + const res = await request.get("/tasks", { pageSize, pageNum: page }); + totalTasks.value = res?.data?.total || 0; tasks.value = (res?.data?.records || []).map((record: any) => ({ title: record.taskName, description: record.taskDescription || "", @@ -197,6 +202,12 @@ watch(selectedTaskId, (newId) => { } }); +const handlePageChange = (page: number) => { + selectedTaskId.value = null; + taskApplications.value = []; + fetchTasks(page); +}; + const startTask = async () => { if (!selectedTask.value) { ElMessage.warning("请先选择一个任务"); @@ -339,6 +350,16 @@ onMounted(() => {

+
@@ -584,6 +605,10 @@ onMounted(() => { justify-content: center; } +.task-pagination { + margin-top: 10px; + justify-content: center; +} .content-zone { display: grid;