import ColResult from '@/components/col-result' import { Cell, CellGroup, List, Image, Icon } from 'vant' import { defineComponent } from 'vue' import styles from './live.module.less' import iconTimer from '@common/images/icon_timer2.png' import iconTeacher from '@common/images/icon_teacher.png' import iconSuccess from '@common/images/icon_success.png' import request from '@/helpers/request' import dayjs from 'dayjs' export default defineComponent({ name: 'live', data() { return { list: [], dataShow: true, // 判断是否有数据 loading: false, finished: false, params: { groupStatus: 'APPLY', page: 1, rows: 20 } } }, mounted() { this.getList() }, methods: { formatTime(time: string) { let timeStr = dayjs(time || new Date()) const weekStr = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'] // console.log(timeStr.day()) return timeStr.format('YYYY-MM-DD') + `(${weekStr[timeStr.day()]})` }, async getList() { try { let params = this.params const res = await request.post( '/api-student/courseGroup/queryPageCourseGroup', { data: { ...params } } ) const result = res.data || {} // 处理重复请求数据 if (this.list.length > 0 && result.pageNo === 1) { return } this.list = this.list.concat(result.rows || []) this.finished = result.pageNo >= result.totalPage this.params.page = result.pageNo + 1 this.dataShow = this.list.length > 0 } catch {} }, onDetail(item: any) { this.$router.push({ path: '/liveDetail', query: { groupId: item.courseGroupId } }) } }, render() { return ( <> {this.dataShow ? ( {this.list.map((item: any) => ( this.onDetail(item)} > (
{item?.subjectName}
), title: () => (
{item.courseGroupName}

老师: {item.teacherName || `游客${item.teacherId}`}

{item.existBuy === 1 ? ( 已购买 ) : ( {item.studentCount}人已购买 )}
) }} /> ( {this.formatTime(item.salesStartDate)} ), default: () => (
¥ {(this as any).$filters.moneyFormat(item.coursePrice)} /{item.courseNum}课时
) }} />
))}
) : ( )} ) { /* {this.buyUserList.map(item => ( ))} */ } } })