From 102d94e6c850c5152e37a6ac2b902f702b1658ca Mon Sep 17 00:00:00 2001 From: "DESKTOP-JKIE562\\PC" <1013397054@qq.com> Date: Wed, 25 Nov 2026 13:45:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9F=B9=E8=AE=AD=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BC=98=E5=8C=96):1.=E8=AF=B7=E6=A3=80=E6=9F=A5=E6=89=80?= =?UTF-8?q?=E6=9C=89=E4=BC=81=E4=B8=9A=E5=9F=B9=E8=AE=AD=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=B8=A6=E6=9C=89=E5=88=97=E8=A1=A8=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E9=83=BD=E8=A6=81=E8=BF=9B=E8=A1=8C=E5=88=86=E9=A1=B5?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8=E5=88=86=E9=A1=B5=E5=85=B1=E7=94=A8?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=BB=98=E8=AE=A4=E6=AF=8F=E9=A1=B515?= =?UTF-8?q?=E6=9D=A1=EF=BC=81=202.=E8=AF=BE=E7=A8=8B=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=8F=B3=E4=BE=A7=E5=9B=BA=E5=AE=9A=E5=A4=AA?= =?UTF-8?q?=E5=AE=BD=E5=A6=82=E5=9B=BE=E4=BA=8C=E6=89=80=E7=A4=BA=E6=94=B6?= =?UTF-8?q?=E7=BC=A9=E5=A4=9F=E7=94=A8=E5=B0=B1=E5=8F=AF=E4=BB=A5=EF=BC=8C?= =?UTF-8?q?=E5=8F=AF=E5=8F=82=E8=80=83=E5=9F=B9=E8=AE=AD=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=203.=E6=9C=88=E5=9F=B9=E8=AE=AD=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E6=95=B0=E6=8D=AE=E9=BB=98=E8=AE=A4=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E5=9F=B9=E8=AE=AD=E5=92=8C=E6=8E=88=E8=AF=BE?= =?UTF-8?q?=E5=9F=B9=E8=AE=AD=E6=98=AF=E5=BD=93=E6=9C=88=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=EF=BC=8C=E5=8F=AF=E7=AD=9B=E9=80=89=E5=85=B6=E4=BB=96=E6=9C=88?= =?UTF-8?q?=E4=BB=BD=E6=94=AF=E6=8C=81=E5=A4=9A=E9=80=89=E6=88=96=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E6=95=B0=E6=8D=AE=204.=E6=9C=88=E5=9F=B9=E8=AE=AD?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E5=8F=AA=E9=9C=80=E8=A6=81=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E3=80=90=E5=88=9B=E5=BB=BA=E6=9C=88=E5=BA=A6?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E3=80=91=E6=8C=89=E9=92=AE=EF=BC=8C=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=88=9B=E5=BB=BA=E6=9C=88=E5=BA=A6=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E8=AF=B7=E6=A0=B8=E5=AE=9E=E6=A0=B9=E5=9B=A0=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../training/components/CourseCatalog.vue | 32 +++- .../components/CourseLearningStatus.vue | 17 +- .../views/training/components/CoursePanel.vue | 162 ++++++++++++++---- .../views/training/components/ExamPanel.vue | 21 ++- .../training/components/LibraryPanel.vue | 57 +++++- .../views/training/components/PlanPanel.vue | 31 +++- .../views/training/components/SignPanel.vue | 16 +- .../views/training/components/StudyPanel.vue | 16 +- .../components/TrainingPagination.vue | 50 ++++++ .../training/components/useTrainingPager.ts | 35 ++++ 10 files changed, 387 insertions(+), 50 deletions(-) create mode 100644 frontend/src/views/training/components/TrainingPagination.vue create mode 100644 frontend/src/views/training/components/useTrainingPager.ts diff --git a/frontend/src/views/training/components/CourseCatalog.vue b/frontend/src/views/training/components/CourseCatalog.vue index 42ef0fd..7fffe73 100644 --- a/frontend/src/views/training/components/CourseCatalog.vue +++ b/frontend/src/views/training/components/CourseCatalog.vue @@ -38,7 +38,7 @@ - + + + diff --git a/frontend/src/views/training/components/useTrainingPager.ts b/frontend/src/views/training/components/useTrainingPager.ts new file mode 100644 index 0000000..f94bae8 --- /dev/null +++ b/frontend/src/views/training/components/useTrainingPager.ts @@ -0,0 +1,35 @@ +import { computed, ref, watch, type Ref } from 'vue' + +// 企业培训共用分页口径(000163):默认每页 15 条 +export const TRAINING_PAGE_SIZE = 15 +export const TRAINING_PAGE_SIZE_OPTIONS = [15, 30, 50, 100] + +/** + * 企业培训列表共用客户端分页(000163): + * 列表页均为全量加载 + 本地过滤,分页在前端切片完成。 + * 传入过滤后的全量列表,返回当前页切片与分页状态(供 TrainingPagination 绑定); + * 列表条数变化时自动夹紧页码,reset() 供「重置」按钮回到第 1 页。 + */ +export function useTrainingPager(source: Ref | (() => T[])) { + const page = ref(1) + const pageSize = ref(TRAINING_PAGE_SIZE) + + const list = computed(() => (typeof source === 'function' ? source() : source.value)) + const total = computed(() => list.value.length) + const paged = computed(() => { + const start = (page.value - 1) * pageSize.value + return list.value.slice(start, start + pageSize.value) + }) + + // 条数/每页条数变化后夹紧页码(过滤收紧或翻页超界时不出现空页) + watch([total, pageSize], () => { + const maxPage = Math.max(1, Math.ceil(total.value / pageSize.value)) + if (page.value > maxPage) page.value = maxPage + }) + + const reset = () => { + page.value = 1 + } + + return { page, pageSize, total, paged, reset } +}