index.tsx 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import { Icon, NoticeBar, Tag, Image } from 'vant'
  2. import { defineComponent, PropType } from 'vue'
  3. import styles from './index.module.less'
  4. import IconPlay from '@/common/images/icon-play.png'
  5. import IconFine from '@/views/music/component/images/icon_exquisite.png'
  6. import IconAlbum from '@/views/music/component/images/icon_album_active.png'
  7. import { useRouter } from 'vue-router'
  8. export default defineComponent({
  9. name: 'TheSong',
  10. props: {
  11. list: {
  12. type: Array as PropType<any[]>,
  13. default: () => []
  14. }
  15. },
  16. emits: ['detail'],
  17. setup(props, { emit }) {
  18. const router = useRouter()
  19. const colors: any = {
  20. FREE: {
  21. color: '#01B84F',
  22. text: '免费'
  23. },
  24. VIP: {
  25. color: '#CD863E',
  26. text: '会员'
  27. },
  28. CHARGE: {
  29. color: '#3591CE',
  30. text: '点播'
  31. }
  32. }
  33. return () => (
  34. <div class={styles.theSong}>
  35. {props.list.map((n: any) => (
  36. <div class={styles.item} onClick={() => emit('detail', n)}>
  37. <div class={styles.content}>
  38. <div class={styles.top}>
  39. {n.exquisiteFlag === 1 && (
  40. <Image src={IconFine} class={styles.iconFine} />
  41. )}
  42. {n.albumNums > 0 && (
  43. <Image src={IconAlbum} class={styles.iconAlbum} />
  44. )}
  45. <span class={[styles.title, 'van-ellipsis']}>
  46. {n.musicSheetName}
  47. </span>
  48. <span class={[styles.singer, 'van-ellipsis']}>
  49. -{n.composer}
  50. </span>
  51. </div>
  52. <div class={styles.user}>
  53. {n.addName ? (
  54. <div class={styles.name}>上传者:{n.addName}</div>
  55. ) : (
  56. <div class={styles.name}>作曲:{n.composer}</div>
  57. )}
  58. <div class={styles.tags}>
  59. {n?.subjectNames.split(',').map((name: any) => (
  60. <span>{name}</span>
  61. ))}
  62. </div>
  63. </div>
  64. </div>
  65. <div style={styles.play}>
  66. <Icon name={IconPlay} size={28} />
  67. </div>
  68. </div>
  69. ))}
  70. </div>
  71. )
  72. }
  73. })