<script setup lang="ts">
import { getCourseSection } from '../api'
const CoursePlayerVideo = defineAsyncComponent(() => import('../components/CoursePlayerVideo.vue'))
const CoursePlayerChapter = defineAsyncComponent(() => import('../components/CoursePlayerChapter.vue'))

const { query } = useRoute()
const semesterId = $ref(query.semester_id as string)
const sectionId = $ref(query.section_id as string)
const sourceId = $ref(query.source_id as string)

function fetchInfo() {
  getCourseSection({ section_id: sectionId, semester_id: semesterId }).then(res => {
    console.log(res)
  })
}
onMounted(fetchInfo)
</script>

<template>
  <div class="course-player">
    <div class="course-player-main">
      <CoursePlayerVideo v-if="sourceId" />
      <el-tabs>
        <el-tab-pane label="课件"> </el-tab-pane>
        <el-tab-pane label="教案" lazy> </el-tab-pane>
        <el-tab-pane label="作业" lazy> </el-tab-pane>
        <el-tab-pane label="资料" lazy> </el-tab-pane>
        <el-tab-pane label="考试/测验" lazy></el-tab-pane>
        <el-tab-pane label="直播" lazy></el-tab-pane>
      </el-tabs>
    </div>
    <div class="course-player-aside">
      <CoursePlayerChapter />
    </div>
  </div>
</template>

<style lang="scss" scoped>
.course-player {
  display: flex;
}
.course-player-main {
  flex: 1;
}
</style>
