import { PropType, defineComponent, reactive, watch, onMounted } from 'vue'; import styles from './point.module.less'; import iconMulv from '../image/icon-mulv.svg'; import iconZhibo from '../image/icon-load.gif'; import iconImage from '../image/icon-image.svg'; import iconImageActive from '../image/icon-image-active.svg'; import iconVideo from '../image/icon-video.svg'; import iconVideoActive from '../image/icon-video-active.svg'; import iconSong from '../image/icon-song.svg'; import iconSongActive from '../image/icon-song-active.svg'; import chapterDown from '../image/chapter-down-arrow.svg'; import chapterDefault from '../image/chapter-default-arrow.svg'; import chapterDefault2 from '../image/chapter-default-arrow2.svg'; import { Icon, Collapse, CollapseItem } from 'vant'; import { useRoute } from 'vue-router'; export default defineComponent({ name: 'points', props: { allList: { type: Array as any, default: () => [] }, kjId: { type: String, default: '' }, zsdId: { type: String, default: '' }, popShow: { type: Boolean, default: false }, data: { type: Array as PropType, default: () => [] }, itemActive: { type: String, default: '' }, itemName: { type: String, default: '' } }, emits: ['handleSelect'], setup(props, { emit }) { const route = useRoute(); // 类型(VIDEO,IMG,SONG,PPT,MUSIC,LISTEN:听音,RHYTHM:节奏,THEORY:乐理知识,MUSIC_WIKI:名曲鉴赏 INSTRUMENT:乐器 MUSICIAN:音乐家),可用值:VIDEO,MUSIC,IMG,SONG,PPT,LISTEN,RHYTHM,THEORY,MUSIC_WIKI,INSTRUMENT,MUSICIAN const types: { [_: string]: string } = { SONG: '音频', VIDEO: '视频', IMG: '图片', MUSIC: '乐谱', PPT: 'PPT', LISTEN: '听音', RHYTHM: '节奏', THEORY: '乐理', MUSIC_WIKI: '名曲', INSTRUMENT: '乐器', MUSICIAN: '音乐家', }; // 获取对应图片 const getImage = (item: any) => { if (item.type === 'VIDEO') { return props.itemActive == item.id ? iconVideoActive : iconVideo; } else if (['IMAGE', 'IMG'].includes(item.type)) { return props.itemActive == item.id ? iconImageActive : iconImage; } else if (item.type === 'SONG') { return props.itemActive == item.id ? iconSongActive : iconSong; } else { return props.itemActive == item.id ? iconVideoActive : iconVideo; } }; const pointData = reactive({ allList: props.allList, kjId: props.kjId, // 当前选中的课件id zsdId: props.zsdId, // 当前选中的知识点id }); watch( () => props.allList, () => { pointData.kjId = props.kjId pointData.zsdId = props.zsdId } ); watch( () => props.popShow, () => { console.log('刷新123') pointData.kjId = props.kjId pointData.zsdId = props.zsdId } ); return () => (
{props.itemName}
{props.allList.length && { pointData.kjId = val; }} border={false} accordion> {props.allList.map((item: any) => ( {{ default: () => ( <> { pointData.zsdId = val; }} border={false} accordion> {item.knowledgeList.map((know: any) => ( {{ default: () => ( <> {know.materialInfo.map((material: any, index: number) => { return (
{ console.log(pointData.allList) emit('handleSelect', { itemActive: material.id, zsdId: know.id, kjId: item.id }); }}>
{types[material.type]}
{material.name}
); })} ), icon: () => ( ) }}
))}
), icon: () => ( ) }}
))}
} {/* {props.data.map((item, index: number) => { return (
{ emit('handleSelect', { itemActive: item.id }); }}>
{types[item.type]}
{item.name}
); })} */}
); } });