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 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() { return (
课程已经结束啦
); } getStopBody() { return (
停课中
您可至「我的-课程」恢复学习
); } getOpenBody() { const { data } = this.props; const { qrCode } = data; return !qrCode ? (
我已阅读并同意《千行课程协议》
) : (
请尽快与老师预约上课时间
请于 2019-07-25 前开通课程
); } getIngBody() { const { data, previewAction } = this.props; const { list = [] } = data; return (
{list.length > 0 &&
近期待完成
} {list.length === 0 ? (
好棒!
近期的作业都完成啦
) : (
{list.map(item => { return (
{item.title}
{item.status === 'start' && ( previewAction && previewAction('start', item)} /> )} {item.status === 'continue' && ( previewAction && previewAction('continue', item)} tip="Continue" /> )} {item.status === 'restart' && ( previewAction && previewAction('restart', item)} tip="Restart" /> )}
); })}
)}
有效期: 2019-08-20至2020-01-01 全部作业>
); } getBody() { const { data } = this.props; const { status } = data; 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, data, title, tag } = this.props; const { status } = data; return (
{tag &&
{tag}
} {title}
{this.getBody()}
); } }