rank-item.tsx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { defineComponent, reactive, ref, watch } from 'vue'
  2. import { Image } from 'vant'
  3. import styles from './rank-item.module.less'
  4. import defaultIcon from '@/school/images/student-icon.png'
  5. import firstIcon from '../images/first.png'
  6. import secondIcon from '../images/second.png'
  7. import thirdIcon from '../images/third.png'
  8. export default defineComponent({
  9. props: ['item', 'type', 'index'],
  10. name: 'rank-item',
  11. setup(props) {
  12. return () => (
  13. <>
  14. <div>
  15. <div class={styles.itemWrap}>
  16. <div class={styles.wrapLeft}>
  17. <div class={styles.numWrap}>
  18. {props.index == 1 ? <img src={firstIcon} alt="" /> : null}
  19. {props.index == 2 ? <img src={secondIcon} alt="" /> : null}
  20. {props.index == 3 ? <img src={thirdIcon} alt="" /> : null}
  21. {props.index > 3 ? <p>{props.index}</p> : null}
  22. </div>
  23. <div class={styles.headerWrap}>
  24. <Image
  25. width="100%"
  26. height="100%"
  27. src={props.item.avatar ? props.item.avatar : defaultIcon}
  28. alt=""
  29. fit="cover"
  30. />
  31. </div>
  32. <div>
  33. <p class={styles.studentName}>{props.item.nickname}</p>
  34. <div class={styles.tag}>
  35. {props.item.subjectNames ? props.item.subjectNames : '暂无声部'}
  36. </div>
  37. </div>
  38. </div>
  39. <div class={styles.wrapRight}>
  40. {props.type == 'day' ? (
  41. <p>
  42. <span>{props.item.practiceDays ? props.item.practiceDays : 0}</span> 天
  43. </p>
  44. ) : (
  45. <p>
  46. <span>{props.item.practiceTimes ? props.item.practiceTimes : 0}</span> 分钟
  47. </p>
  48. )}
  49. </div>
  50. </div>
  51. </div>
  52. </>
  53. )
  54. }
  55. })