index.tsx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import { Cell, Icon, Image } from 'vant'
  2. import styles from './index.module.less'
  3. import { defineComponent } from 'vue'
  4. import IconXin from '@/common/images/icon-xin.png'
  5. import IconXinActive from '@/common/images/icon-xin-active.png'
  6. import TheTitle from '../the-title'
  7. import { openDefaultWebView } from '@/student/home-layout-orchestra/state-orchestra'
  8. import { useRouter } from 'vue-router'
  9. import event from '../../event'
  10. export default defineComponent({
  11. name: 'hot-album',
  12. props: {
  13. album: {
  14. type: Array,
  15. default: []
  16. }
  17. },
  18. setup(props) {
  19. const router = useRouter()
  20. return () => (
  21. <>
  22. {props.album.length > 0 && (
  23. <TheTitle
  24. title="热门专辑"
  25. onDetail={() => {
  26. // const url = location.origin + location.pathname + '#/music-album'
  27. // openDefaultWebView(url, () => {
  28. // router.push('/music-album')
  29. // })
  30. event.emit('downloadApp')
  31. }}
  32. />
  33. )}
  34. <div class={styles.albumContainer}>
  35. {props.album.map((item: any) => (
  36. <div
  37. class={styles.album}
  38. key={item.id}
  39. onClick={() => {
  40. // const url =
  41. // location.origin +
  42. // location.pathname +
  43. // '#/music-album-detail/' +
  44. // item.id
  45. // openDefaultWebView(url, () => {
  46. // router.push('/music-album-detail/' + item.id)
  47. // })
  48. event.emit('downloadApp')
  49. }}
  50. >
  51. <div class={styles.main}>
  52. {item.paymentType === 'CHARGE' && (
  53. <span class={styles.albumType}>付费</span>
  54. )}
  55. <Image class={styles.img} src={item.albumCoverUrl} />
  56. <div class={styles.model}>
  57. <Icon name={item.favorite ? IconXinActive : IconXin} />
  58. <span class={styles.num}>{item.albumFavoriteCount}人</span>
  59. </div>
  60. </div>
  61. <h4 class={[styles.title, 'van-ellipsis']}>{item.albumName}</h4>
  62. </div>
  63. ))}
  64. </div>
  65. </>
  66. )
  67. }
  68. })