import { defineComponent, PropType } from 'vue' import { Image } from 'vant' import styles from './index.module.less' import iconTeacher from '@common/images/icon_teacher.png' import { moneyFormat } from '@/helpers/utils' interface VideoItemProps { id?: number teacherId?: number lessonName: string userName: string avatar: string lessonCoverUrl: string lessonCount: number lessonPrice: number countStudent: number lessonSubjectName: string auditVersion: number } export default defineComponent({ name: 'VideoItem', props: { item: Object as PropType, onClick: { type: Function as PropType<(item: any) => void>, default: (item: any) => {} } }, render() { const item: any = this.item return (
{ this.onClick(item) }} >
{item?.lessonSubjectName}
{item?.lessonName}
{item?.musicNum > 0 ? ( {item?.musicNum}首曲目 ) : ( '' )} {item?.lessonCount > 0 ? ( {item?.lessonCount}课时 ) : ( '' )}
{item?.countStudent}人学习
{item.payType === 'VIP' ? ( 会员 ) : ( <> {item?.lessonPrice > 0 && ( <> {moneyFormat(item?.lessonPrice, '0.00')} )} {item?.lessonPrice <= 0 && item.auditVersion !== 0 && ( <> 0 )} {item?.lessonPrice <= 0 && item.auditVersion === 0 && ( 免费 )} )}
) } })