import React, { Component } from 'react';
import './index.less';
import { Link } from 'react-router-dom';
import { Checkbox } from 'antd';
import Assets from '@src/components/Assets';
import { formatDate } from '@src/services/Tools';
import Module from '../Module';
import Progress from '../Progress';
import IconButton from '../IconButton';
import Button from '../Button';
export default class Card extends Component {
getBuyBody() {
const { data } = this.props;
return (
);
}
getOpenBody() {
return (
请开通预习作业
我已阅读并同意《千行 GMAT - Sentence Corretion 课程协议》
);
}
getIngBody() {
const { process, previewAction } = this.props;
return (
近期待完成
{process.previews.length === 0 ? (
) : (
{process.previews.map(item => {
return (
{item.time}
{!item.repport.id && (
previewAction && previewAction('start', item)}
/>
)}
{item.repport.id && (
previewAction && previewAction('continue', item)}
tip="Continue"
/>
)}
{item.repport.id && (
previewAction && previewAction('restart', item)}
tip="Restart"
/>
)}
);
})}
)}
);
}
getBody() {
const { process = {} } = this.props;
if (!process.payed && !process.startTime) return this.getBuyBody();
if (process.payed) return this.getOpenBody();
if (process.startTime) return this.getIngBody();
return ;
}
render() {
const { style, data = {}, process = {} } = this.props;
return (
{`${data.titleZh} ${data.titleEn}`}
{!process.payed && !process.startTime && 未购买}
{(process.payed || process.startTime) && 已购买}
{this.getBody()}
);
}
}
export class Card1 extends Component {
getEndBody() {
const { data, onPreview } = this.props;
const { useStartTime, useEndTime } = data;
return (
);
}
getStopBody() {
return (
);
}
getOpenBody() {
const { checked } = this.state;
const { data, onOpen, contract } = this.props;
const { teacher, endTime, courseModule } = data;
switch (courseModule) {
case 'video':
return
请于{endTime && formatDate(endTime, 'YYYY-MM-DD')}前开通课程
;
case 'online':
return
;
case 'vs':
return
请尽快与老师预约上课时间
请于 {endTime && formatDate(endTime, 'YYYY-MM-DD')} 前开通课程
;
default:
return ;
}
}
getIngBody() {
const { data, list = [], previewAction, onPreview } = this.props;
const { useStartTime, useEndTime } = data;
return (
{list.length > 0 &&
近期待完成
}
{list.length === 0 ? (
) : (
{list.map(item => {
return (
{item.progress === 0 && (
previewAction && previewAction('start', item)}
/>
)}
{item.progress > 0 && (
previewAction && previewAction('continue', item)}
tip="Continue"
/>
)}
{item.progress > 0 && (
previewAction && previewAction('restart', item)}
tip="Restart"
/>
)}
);
})}
)}
);
}
getBody() {
const { status } = this.props;
if (status === 'end') return this.getEndBody();
if (status === 'stop') return this.getStopBody();
if (status === 'open') return this.getOpenBody();
if (status === 'ing') return this.getIngBody();
return ;
}
render() {
const { style, title, tag, status } = this.props;
return (
{this.getBody()}
);
}
}