<!-- 直播 -->
<script setup lang="ts">
import type { LiveType } from '@/types'
import CourseViewLiveItem from './CourseViewLiveItem.vue'

import { getCourseLiveList } from '../api'
const { query } = useRoute()
const courseId = $ref(query.course_id as string)
const semesterId = $ref(query.semester_id as string)
let list = $ref<LiveType[]>([])
function fetchList() {
  getCourseLiveList({ course_id: courseId, semester_id: semesterId }).then(res => {
    list = res.data.items
  })
}
onMounted(() => {
  fetchList()
})
</script>
<template>
  <div class="course-live">
    <template v-if="list.length">
      <CourseViewLiveItem v-for="item in list" :data="item" :key="item.id"></CourseViewLiveItem>
    </template>
    <el-empty description="暂无数据" v-else />
  </div>
</template>
