<script setup lang="ts">
import ViewTop from '../components/ViewTop.vue'
import ViewCenter from '../components/ViewCenter.vue'
import Operation from '../components/Operation.vue'
import ResourceCourseList from '@/components/ResourceCourseList.vue'
import DataAccess from '@/components/DataAccess.vue'


import { getCourseDetails } from '../api'

const route = useRoute()
const id = route.query.id as string
let courseDetails: any = ref({})

// 获取详情
getCourseDetails({ id: id }).then(res => {
  courseDetails.value = res.data
})
</script>

<template>
  <AppCard title="课件资源信息">
    <Operation :data="courseDetails"></Operation>
    <ViewTop v-if="Object.keys(courseDetails).length" :data="courseDetails"></ViewTop>
    <ViewCenter v-if="Object.keys(courseDetails).length" :data="courseDetails"></ViewCenter>
    <DataAccess v-if="Object.keys(courseDetails).length" :data="courseDetails"></DataAccess>
  </AppCard>
  <ResourceCourseList title="课件资源关联使用课程" :list="courseDetails.course_list"></ResourceCourseList>
</template>
