diff --git a/src/views/training/GenericTrainingPage.vue b/src/views/training/GenericTrainingPage.vue index ca98819..f74be00 100644 --- a/src/views/training/GenericTrainingPage.vue +++ b/src/views/training/GenericTrainingPage.vue @@ -382,9 +382,9 @@ @@ -744,6 +744,8 @@ const saving = ref(false); const uploading = ref(false); const currentStep = ref(1); const configuredSteps = computed(() => parseArray(remoteTask.value?.steps)); +const isFirstConfiguredStep = computed(() => currentStep.value <= 1); +const isLastConfiguredStep = computed(() => configuredSteps.value.length > 0 && currentStep.value >= configuredSteps.value.length); const indexedConfiguredSteps = computed(() => configuredSteps.value.map((step, index) => ({ step, index }))); const comprehensiveStepNavRef = ref(null); const comprehensiveNavDragging = ref(false); diff --git a/tests/comprehensive-training-layout.static.test.cjs b/tests/comprehensive-training-layout.static.test.cjs index 0908198..b1ebee9 100644 --- a/tests/comprehensive-training-layout.static.test.cjs +++ b/tests/comprehensive-training-layout.static.test.cjs @@ -30,3 +30,10 @@ test("综合实训步骤保持单行并支持鼠标或触控左右拖动", () => assert.match(pageSource, /\.comprehensive-step-strip \.step-name\s*\{[\s\S]*?white-space: nowrap/); assert.doesNotMatch(pageSource, /comprehensive-turn-row|comprehensive-turn-rail/); }); + +test("综合实训首尾步骤只展示可用的底部导航", () => { + assert.match(pageSource, /const isFirstConfiguredStep = computed\(\(\) => currentStep\.value <= 1\);/); + assert.match(pageSource, /const isLastConfiguredStep = computed\(\(\) => configuredSteps\.value\.length > 0 && currentStep\.value >= configuredSteps\.value\.length\);/); + assert.match(pageSource, /v-if="!isFirstConfiguredStep" plain @click="goPreviousStep">上一步/); + assert.match(pageSource, /v-if="!isLastConfiguredStep" plain @click="goNextStep">下一步/); +});