rank-item.tsx 1.7 KB

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