43 lines
1003 B
Vue
43 lines
1003 B
Vue
|
|
<template>
|
||
|
|
<CourseLearning
|
||
|
|
v-if="courseId"
|
||
|
|
:course-id="courseId"
|
||
|
|
:chapter-index="chapterIndex"
|
||
|
|
:node-index="nodeIndex"
|
||
|
|
@back="handleBack"
|
||
|
|
/>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script setup lang="ts">
|
||
|
|
import { computed } from 'vue';
|
||
|
|
import { useRouter, useRoute } from 'vue-router';
|
||
|
|
import { CourseLearning } from '@/views/course/components';
|
||
|
|
|
||
|
|
defineOptions({
|
||
|
|
name: 'CourseStudyView'
|
||
|
|
});
|
||
|
|
|
||
|
|
const router = useRouter();
|
||
|
|
const route = useRoute();
|
||
|
|
|
||
|
|
// 从路由参数获取课程ID和节点索引
|
||
|
|
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);
|
||
|
|
|
||
|
|
// 返回到课程详情页
|
||
|
|
function handleBack() {
|
||
|
|
router.push({
|
||
|
|
path: '/study-plan/course-detail',
|
||
|
|
query: {
|
||
|
|
courseId: courseId.value
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style lang="scss" scoped>
|
||
|
|
// 此组件只是容器,样式由子组件处理
|
||
|
|
</style>
|
||
|
|
|