<template>
  <layout-card>
    <el-divider content-position="left">课程信息</el-divider>
    <el-descriptions :column="1" border>
      <el-descriptions-item label="课程名称">
        {{ data.curriculumInfo.CURRICULUMNAME }}
      </el-descriptions-item>
      <el-descriptions-item label="培训行业类型">
        {{
          data.curriculumInfo.CURRENCY === "1"
            ? "通用"
            : data.curriculumInfo.train_type_name
        }}
      </el-descriptions-item>
      <el-descriptions-item label="岗位培训类型">
        {{ data.curriculumInfo.post_type_name }}
      </el-descriptions-item>
      <el-descriptions-item label="课程图片">
        <img
          :src="FILE_URL + data.curriculumInfo.CAPTURE"
          width="100"
          height="100"
        />
      </el-descriptions-item>
      <el-descriptions-item label="课程介绍">
        {{ data.curriculumInfo.CURRICULUMINTRODUCE }}
      </el-descriptions-item>
    </el-descriptions>
    <template v-for="(chapter, index) in data.chapterList" :key="index">
      <el-divider content-position="left">{{ data.NAME }}</el-divider>
      <el-divider content-position="left">视频课件</el-divider>
      <layout-table :data="chapter.xzVideoList" :showPagination="false">
        <el-table-column
          show-overflow-tooltip
          prop="COURSEWARENAME"
          label="视频课件名称"
        />
        <el-table-column
          show-overflow-tooltip
          prop="post_type_name"
          label="岗位培训类型"
        />
        <el-table-column
          show-overflow-tooltip
          prop="train_type_name"
          label="培训行业类型"
        />
        <el-table-column show-overflow-tooltip prop="CLASSHOUR" label="学时" />
        <el-table-column
          show-overflow-tooltip
          prop="COURSEWAREINTRODUCE"
          label="课件描述"
        />
        <el-table-column
          show-overflow-tooltip
          prop="teacherName"
          label="讲师"
        />
      </layout-table>
      <el-divider content-position="left">资料课件</el-divider>
      <layout-table :data="chapter.xzDataList" :showPagination="false">
        <el-table-column
          show-overflow-tooltip
          prop="COURSEWARENAME"
          label="资料课件名称"
        />
        <el-table-column
          show-overflow-tooltip
          prop="post_type_name"
          label="岗位培训类型"
        />
        <el-table-column
          show-overflow-tooltip
          prop="train_type_name"
          label="培训行业类型"
        />
        <el-table-column show-overflow-tooltip prop="CLASSHOUR" label="学时" />
        <el-table-column
          show-overflow-tooltip
          prop="COURSEWAREINTRODUCE"
          label="课件描述"
        />
        <el-table-column
          show-overflow-tooltip
          prop="teacherName"
          label="讲师"
        />
      </layout-table>
    </template>
  </layout-card>
</template>

<script setup>
import LayoutTable from "@/components/table/index.vue";
import { reactive } from "vue";
import { useRoute } from "vue-router";
import { getCurriculumInfo } from "@/request/platform_resource_library.js";

const FILE_URL = import.meta.env.VITE_FILE_URL;

const route = useRoute();
const { CURRICULUM_ID } = route.query;

const data = reactive({
  curriculumInfo: {},
  chapterList: [],
});

const fnGetCurriculumInfo = async () => {
  const respData = await getCurriculumInfo({ CURRICULUM_ID });
  if (respData) {
    data.curriculumInfo = respData.pd;
    data.chapterList = respData.chapterList;
  }
};
await fnGetCurriculumInfo();
</script>

<style scoped lang="scss"></style>
