|
@@ -1,7 +1,6 @@
|
|
|
-import { defineComponent, reactive, watch } from 'vue';
|
|
|
+import { PropType, defineComponent, reactive, watch } from 'vue';
|
|
|
import styles from './point.module.less';
|
|
|
import iconMulv from '../image/icon-mulv.svg';
|
|
|
-import iconArrow from '../image/icon-arrow.svg';
|
|
|
import iconZhibo from '../image/icon-load.gif';
|
|
|
import iconImage from '../image/icon-image.svg';
|
|
|
import iconImageActive from '../image/icon-image-active.svg';
|
|
@@ -9,18 +8,15 @@ 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 { Collapse, Icon, Image } from 'vant';
|
|
|
+
|
|
|
+import { Icon } from 'vant';
|
|
|
export default defineComponent({
|
|
|
name: 'points',
|
|
|
props: {
|
|
|
data: {
|
|
|
- type: Array,
|
|
|
+ type: Array as PropType<any[]>,
|
|
|
default: () => []
|
|
|
},
|
|
|
- tabActive: {
|
|
|
- type: String,
|
|
|
- default: ''
|
|
|
- },
|
|
|
itemActive: {
|
|
|
type: String,
|
|
|
default: ''
|
|
@@ -28,24 +24,12 @@ export default defineComponent({
|
|
|
},
|
|
|
emits: ['handleSelect'],
|
|
|
setup(props, { emit }) {
|
|
|
- const pointData = reactive({
|
|
|
- active: props.tabActive[0] || '',
|
|
|
- childActive: props.tabActive[1] || ''
|
|
|
- });
|
|
|
- watch(
|
|
|
- () => props.tabActive,
|
|
|
- () => {
|
|
|
- pointData.active = props.tabActive[0] || '';
|
|
|
- pointData.childActive = props.tabActive[1] || '';
|
|
|
- }
|
|
|
- );
|
|
|
-
|
|
|
- console.log(
|
|
|
- pointData.active,
|
|
|
- 'pointData.active',
|
|
|
- props.data,
|
|
|
- props.tabActive
|
|
|
- );
|
|
|
+ const types: { [_: string]: string } = {
|
|
|
+ SONG: '乐谱',
|
|
|
+ VIDEO: '视频',
|
|
|
+ IMG: '图片',
|
|
|
+ AUDIO: '音频'
|
|
|
+ };
|
|
|
|
|
|
// 获取对应图片
|
|
|
const getImage = (item: any) => {
|
|
@@ -63,38 +47,39 @@ export default defineComponent({
|
|
|
<div class={styles.container}>
|
|
|
<div class={styles.pointHead}>
|
|
|
<img src={iconMulv} />
|
|
|
- 课件列表
|
|
|
+ 第一单元 我愿住在童话里
|
|
|
</div>
|
|
|
<div class={styles.content}>
|
|
|
- <Collapse
|
|
|
- class={styles.collapse}
|
|
|
- modelValue={pointData.active}
|
|
|
- onUpdate:modelValue={(val: any) => {
|
|
|
- pointData.active = val;
|
|
|
- }}
|
|
|
- accordion>
|
|
|
- {props.data.map((item: any, index: number) => {
|
|
|
- return (
|
|
|
- <div
|
|
|
- class={[
|
|
|
- styles.item,
|
|
|
- props.itemActive == item.id ? styles.itemActive : ''
|
|
|
- ]}
|
|
|
- onClick={() => {
|
|
|
- emit('handleSelect', {
|
|
|
- itemActive: item.id,
|
|
|
- tabName: item.name
|
|
|
- });
|
|
|
- }}>
|
|
|
- <Image src={getImage(item)} class={styles.itemImage} />
|
|
|
- <span class={["van-ellipsis", styles.name]}>
|
|
|
- {item.name}
|
|
|
- </span>
|
|
|
+ {props.data.map((item, index: number) => {
|
|
|
+ return (
|
|
|
+ <div
|
|
|
+ class={[
|
|
|
+ styles.item,
|
|
|
+ props.itemActive == item.id ? styles.itemActive : ''
|
|
|
+ ]}
|
|
|
+ onClick={() => {
|
|
|
+ emit('handleSelect', {
|
|
|
+ itemActive: item.id
|
|
|
+ });
|
|
|
+ }}>
|
|
|
+ <div class={styles.cover}>
|
|
|
+ {item.type === 'VIDEO' && (
|
|
|
+ <img src="https://daya.ks3-cn-beijing.ksyuncs.com/1687681877690iShot2023-06-25_16.31.11.png" />
|
|
|
+ )}
|
|
|
+ {item.type === 'IMG' && <img src={item.content} />}
|
|
|
+ {item.type === 'AUDIO' && <img src={item.content} />}
|
|
|
+ {item.type === 'SONG' && (
|
|
|
+ <img src="https://cloud-coach.ks3-cn-beijing.ksyuncs.com/music-sheet-first/1687673062603-1.png" />
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ <div class={styles.title}>
|
|
|
+ <div class={styles.tag}>{types[item.type]}</div>
|
|
|
+ <div>{item.name}</div>
|
|
|
<Icon name={iconZhibo} />
|
|
|
</div>
|
|
|
- );
|
|
|
- })}
|
|
|
- </Collapse>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ })}
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|