import { defineComponent, reactive, ref, watch } from 'vue'
import styles from './rank-item.module.less'
import defaultIcon from '@/school/images/default-icon.jpg'
import firstIcon from '../images/first.png'
import secondIcon from '../images/second.png'
import thirdIcon from '../images/third.png'
export default defineComponent({
  props: ['item', 'type', 'index'],
  name: 'rank-item',
  setup(props) {
    return () => (
      <>
        <div>
          <div class={styles.itemWrap}>
            <div class={styles.wrapLeft}>
              <div class={styles.numWrap}>
                {props.index == 1 ? <img src={firstIcon} alt="" /> : null}
                {props.index == 2 ? <img src={secondIcon} alt="" /> : null}
                {props.index == 3 ? <img src={thirdIcon} alt="" /> : null}
                {props.index > 3 ? <p>{props.index}</p> : null}
              </div>
              <div class={styles.headerWrap}>
                <img src={props.item.avatar ? props.item.avatar : defaultIcon} alt="" />
              </div>
              <div>
                <p class={styles.studentName}>{props.item.nickname}</p>
                <div class={styles.tag}>{props.item.subjectNames}</div>
              </div>
            </div>
            <div class={styles.wrapRight}>
              {props.type == 'day' ? (
                <p>
                  <span>{props.item.practiceDays ? props.item.practiceDays : 0}</span>天
                </p>
              ) : (
                <p>
                  <span>{props.item.practiceTimes ? props.item.practiceTimes : 0}</span>小时
                </p>
              )}
            </div>
          </div>
        </div>
      </>
    )
  }
})
