web-学习
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
:course-id="courseId"
|
||||
:chapter-index="chapterIndex"
|
||||
:node-index="nodeIndex"
|
||||
:back-button-text="taskId ? '返回任务详情' : '返回课程详情'"
|
||||
@back="handleBack"
|
||||
/>
|
||||
</template>
|
||||
@@ -24,15 +25,27 @@ const route = useRoute();
|
||||
const courseId = computed(() => route.query.courseId as string || '');
|
||||
const chapterIndex = computed(() => parseInt(route.query.chapterIndex as string) || 0);
|
||||
const nodeIndex = computed(() => parseInt(route.query.nodeIndex as string) || 0);
|
||||
const taskId = computed(() => route.query.taskId as string || '');
|
||||
|
||||
// 返回到课程详情页
|
||||
// 返回到上一页
|
||||
function handleBack() {
|
||||
router.push({
|
||||
path: '/study-plan/course-detail',
|
||||
query: {
|
||||
courseId: courseId.value
|
||||
}
|
||||
});
|
||||
// 如果有 taskId,返回任务详情页
|
||||
if (taskId.value) {
|
||||
router.push({
|
||||
path: '/study-plan/task-detail',
|
||||
query: {
|
||||
taskId: taskId.value
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 否则返回课程详情页
|
||||
router.push({
|
||||
path: '/study-plan/course-detail',
|
||||
query: {
|
||||
courseId: courseId.value
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user