import { defineComponent, onMounted, reactive, ref } from 'vue'; import styles from './index.module.less'; import { NBreadcrumb, NBreadcrumbItem, // NScrollbar, NSlider, NSpace, NSpin } from 'naive-ui'; import icon_back from '../../xiaoku-music/images/icon_back.png'; // import icon_default from '../../xiaoku-music/images/icon_default.png'; // import icon_separator from '../../xiaoku-music/images/icon_separator.png'; import iconT from '../images/icon-t.png'; import iconAddT from '../images/icon-add-t.png'; import iconPlusT from '../images/icon-plus-t.png'; import { api_lessonCoursewareDetail_listKnowledge, api_lessonCoursewareKnowledgeDetail } from '../api'; import TheEmpty from '/src/components/TheEmpty'; import { useRouter } from 'vue-router'; export default defineComponent({ name: 'cotnent-knowledge', setup() { const router = useRouter(); const show = ref(false); const content = ref(false); const musicContentRef = ref(); const state = reactive({ fontSize: 18, tableList: [] as any, selectKey: null, details: {} as any }); const getDetails = async () => { show.value = true; content.value = true; try { const { data } = await api_lessonCoursewareDetail_listKnowledge({ type: 'COURSEWARE' }); state.tableList = data || []; if (state.tableList.length) { const item = state.tableList[0].lessonCoursewareDetailKnowledgeDetailList; state.tableList[0].selected = true; if (item && item.length) { const child = item[0]; state.selectKey = child.id; await getDetail(); } } } catch { // } content.value = false; show.value = false; }; const getDetail = async () => { content.value = true; try { const { data } = await api_lessonCoursewareKnowledgeDetail({ id: state.selectKey }); state.details = data; } catch { // } content.value = false; }; onMounted(() => { getDetails(); }); return () => (
{item.name}
{child.name}