<!-- 直播 -->
<script setup>
import CoursePlayerResourceListItem from './CoursePlayerResourceListItem.vue'

import { getCourseBook } from '../api'

const props = defineProps({ bookId: String })

const list = ref([])
function fetchInfo() {
  if (!props.bookId) return
  getCourseBook({ id: props.bookId }).then(res => {
    const book = res.data
    const resource = {
      id: book.id,
      name: book.name,
      resource_id: book.id,
      resource_type: 13,
      info: { book_id: book.id, name: book.name }
    }
    list.value = [resource]
  })
}
onMounted(() => {
  fetchInfo()
})
</script>
<template>
  <div class="list">
    <template v-if="list.length">
      <CoursePlayerResourceListItem v-for="item in list" :data="item" :key="item.id" />
    </template>
    <el-empty description="暂无数据" v-else />
  </div>
</template>
