1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- import { defineComponent, PropType } from 'vue'
- import { Image } from 'vant'
- import styles from './video-item.module.less'
- import iconTeacher from '@common/images/icon_teacher.png'
- 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<VideoItemProps>,
- onClick: {
- type: Function as PropType<(item: any) => void>,
- default: (item: any) => {}
- }
- },
- render() {
- const item: any = this.item
- return (
- <div
- class={styles.videoItem}
- onClick={() => {
- this.onClick(item)
- }}
- >
- <div style={{ position: 'relative' }}>
- <Image
- class={styles.viCover}
- fit="cover"
- src={item?.lessonCoverUrl}
- />
- <span class={styles.subjectName}>{item?.lessonSubjectName}</span>
- </div>
- <div class={styles.viSection}>
- <div class={[styles.viTitle, 'van-ellipsis']}>{item?.lessonName}</div>
- {/* <div class={styles.viUserInfo}>
- <Image
- src={item?.avatar || iconTeacher}
- class={styles.viUserLogo}
- />
- <span class={[styles.viUserName, 'van-hairline--right']}>
- {item?.userName ||
- item?.username ||
- `游客${item?.teacherId || ''}`}
- </span>
- </div> */}
- <div class={styles.viPrice}>
- <span class={styles.priceNum}>
- {item.payType === 'VIP' ? (
- <span style={{ color: '#C76E21' }}>会员</span>
- ) : (
- <>
- {item?.lessonPrice > 0 && (
- <>
- <i>¥</i>
- {item?.lessonPrice}
- </>
- )}
- {item?.lessonPrice <= 0 && item.auditVersion !== 0 && (
- <>
- <i>¥</i>0
- </>
- )}
- {item?.lessonPrice <= 0 && item.auditVersion === 0 && (
- <span style={{ color: '#20BEA0' }}>免费</span>
- )}
- </>
- )}
- </span>
- <span class={styles.label}>/{item?.lessonCount}课时</span>
- </div>
- <div class={styles.viUserNum}>{item?.countStudent}人已学习</div>
- </div>
- </div>
- )
- }
- })
|