<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 { getOtherDetails } from '../api'

const route = useRoute()

const id = route.query.id as string

// 获取详情
let otherDetails: any = ref({})
getOtherDetails({ id: id }).then((res: any) => {
  otherDetails.value = res.data
})
</script>

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