12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844 |
- import React, { Component } from 'react';
- import { Link } from 'react-router-dom';
- import './index.less';
- import { Icon, Popover } from 'antd';
- import FileUpload from '@src/components/FileUpload';
- import Page from '@src/containers/Page';
- import Assets from '@src/components/Assets';
- import { asyncSMessage } from '@src/services/AsyncTools';
- import { formatDate, formatSeconds, formatPercent } from '@src/services/Tools';
- import UserLayout from '../../../layouts/User';
- import Button from '../../../components/Button';
- import ProgressText from '../../../components/ProgressText';
- import IconButton from '../../../components/IconButton';
- import { Icon as GIcon } from '../../../components/Icon';
- import menu from '../index';
- import Tabs from '../../../components/Tabs';
- import UserTable from '../../../components/UserTable';
- import More from '../../../components/More';
- import Modal from '../../../components/Modal';
- import DatePlane from '../../../components/Date';
- import Note from '../../../components/Note';
- import { FinishModal, CommentModal } from '../../../components/OtherModal';
- import { My } from '../../../stores/my';
- import { User } from '../../../stores/user';
- import { Question } from '../../../stores/question';
- import { Order } from '../../../stores/order';
- import { Common } from '../../../stores/common';
- export default class extends Page {
- initState() {
- return {
- tab: 'online',
- status: 'all',
- };
- }
- formatRecord(row) {
- if (row.useEndTime) {
- if (row.isSuspend && !row.restoreTime) {
- row.status = 'suspend';
- } else if (new Date(row.useEndTime).getTime() < new Date().getTime()) {
- row.status = 'end';
- } else {
- row.status = 'ing';
- }
- } else {
- row.status = 'not';
- }
- row.paperMap = {};
- row.appointmentPaperMap = {};
- if (row.papers) {
- row.papers.forEach(paper => {
- if (paper.courseNo) row.paperMap[paper.courseNo] = paper;
- if (paper.appointment) row.appointmentPaperMap[paper.appointment] = paper;
- });
- }
- row.progressMap = {};
- if (row.progress) {
- row.progress.forEach(progress => {
- row.progressMap[progress.courseNoId] = progress;
- });
- }
- row.courseNoMap = {};
- row.courseTime = 0;
- if (row.courseNos) {
- row.courseNos.forEach(no => {
- row.courseNoMap[no.id] = no;
- row.courseTime += no.time;
- no.paper = row.paperMap[no.id];
- no.progress = row.progressMap[no.id];
- });
- }
- if (row.currentNo) {
- row.currentCourseNo = row.courseNoMap[row.currentNo];
- } else {
- row.currentNo = 0;
- }
- // 如果已经最新预约结束,则添加一个空记录作为最新预约
- if (row.appointments) {
- row.appointments.forEach(r => {
- r.paper = row.appointmentPaperMap[r.id];
- r.noteList = (row.comments || []).filter(c => c.type === 'note' && c.appointmentId === r.id);
- r.supplyList = (row.comments || []).filter(c => c.type === 'supply' && c.appointmentId === r.id);
- });
- // 是否是最后一课时,是否过预约时间
- const last = row.appointments.length - 1;
- const appointment = row.appointments[last];
- if (new Date(appointment.endTime).getTime() < new Date().getTime()) {
- // row.status = 'end';
- if (row.number !== row.appointments.length) {
- row.appointments.push([{}]);
- }
- }
- }
- row.days = new Date(row.userEndTime);
- return row;
- }
- initData() {
- const data = Object.assign(this.state, this.state.search);
- data.filterMap = this.state.search;
- if (data.order) {
- data.sortMap = { [data.order]: data.direction };
- }
- this.setState(data);
- let isUsed = null;
- let isEnd = null;
- switch (data.status) {
- case 'learning':
- isUsed = true;
- isEnd = false;
- break;
- case 'end':
- isUsed = true;
- isEnd = true;
- break;
- case 'nouse':
- isUsed = false;
- isEnd = false;
- break;
- case 'all':
- default:
- }
- My.listCourse(Object.assign({ courseModule: data.tab }, this.state.search, { isUsed, isEnd })).then(result => {
- result.list = result.list.map(row => {
- return this.formatRecord(row);
- });
- this.setState({ list: result.list, total: result.total, page: data.page });
- });
- }
- onAction() { }
- onTabChange(tab) {
- const data = { tab };
- this.refreshQuery(data);
- }
- onStatusChange(status) {
- this.search({ status });
- }
- openTime(record) {
- if (record.courseTimeMap) {
- this.setState({ data: record, showTime: true });
- return;
- }
- My.timeCourse(record.id).then(result => {
- const courseMap = {};
- const previewMap = {};
- const stopMap = {};
- result.forEach(row => {
- const date = formatDate(row.day, 'YYYY-MM-DD');
- if (row.type === 'stop') {
- stopMap[date] = true;
- } else if (row.type === 'preview') {
- previewMap[date] = true;
- } else if (row.type === 'course') {
- courseMap[date] = true;
- }
- });
- record.courseTimeMap = courseMap;
- record.previewTimeMap = previewMap;
- record.stopTimeMap = stopMap;
- this.setState({ data: record, showTime: true });
- });
- }
- refreshDetail(recordId) {
- My.detailCourse(recordId).then(result => {
- let { list } = this.state;
- list = list.map(row => {
- if (row.id === recordId) return this.formatRecord(result);
- return row;
- });
- this.setState({ list });
- });
- }
- suspend() {
- const { suspend } = this.state;
- My.suspendCourse(suspend.id)
- .then(() => {
- asyncSMessage('停课成功');
- this.setState({ showSuspend: false });
- this.refreshDetail(suspend.id);
- })
- .catch(err => {
- asyncSMessage(err.message, 'error');
- });
- }
- restore() {
- const { restore } = this.state;
- My.restoreCourse(restore.id)
- .then(() => {
- asyncSMessage('恢复成功');
- this.setState({ showRestore: false });
- this.refreshDetail(restore.id);
- })
- .catch(err => {
- asyncSMessage(err.message, 'error');
- });
- }
- submitAppointmentComment(data, type) {
- data.type = type;
- if (data.id) {
- My.editAppointmentComment(data).then(() => {
- this.refreshDetail(data.recordId);
- });
- } else {
- My.addAppointmentComment(data).then(() => {
- this.refreshDetail(data.recordId);
- });
- }
- }
- deleteAppointmentComment(row) {
- My.delAppointmentComment(row.id).then(() => {
- this.refreshDetail(row.recordId);
- });
- }
- submitQuestionFile(data) {
- My.uploadAppointmentQuestion(data).then(() => {
- this.refreshDetail(data.recordId);
- });
- }
- setCCTalkName(recordId, cctalkname) {
- My.setCCTalkName(recordId, cctalkname).then(() => {
- this.refreshDetail(recordId);
- });
- }
- open(recordId) {
- Order.useRecord(recordId).then(() => {
- this.refreshDetail(recordId);
- });
- }
- closeCommentTips(recordId) {
- My.courseCommentTips(recordId);
- }
- uploadNote(file) {
- const { note = {} } = this.state;
- Common.uploadImage(file).then(result => {
- note.file = result.url;
- note.name = file.name;
- this.setState({ note });
- });
- }
- uploadSupply(file) {
- const { supply = {} } = this.state;
- Common.uploadImage(file).then(result => {
- supply.file = result.url;
- supply.name = file.name;
- this.setState({ supply });
- });
- }
- renderView() {
- const { config } = this.props;
- return <UserLayout active={config.key} menu={menu} center={this.renderDetail()} />;
- }
- renderDetail() {
- const {
- tab,
- status,
- showTips,
- showTime,
- showSuspend,
- showRestore,
- showUploadNote,
- showUploadSupply,
- showSupply,
- showNote,
- showComment,
- showFinish,
- comment = {},
- data = {},
- note = {},
- supply = {},
- appointment = {},
- } = this.state;
- return (
- <div className="detail-layout">
- <div hidden={!showTips} className="tip">
- <div className="text">理清备考思路,避开常见误区,让学习的每一分钟发光发热!</div>
- <a href="" target="_blank">
- 去填写 >
- </a>
- <Icon type="close-circle" theme="filled" onClick={() => this.setState({ showTips: false })} />
- </div>
- <Tabs
- type="division"
- theme="theme"
- size="small"
- space={2.5}
- width={100}
- active={tab}
- tabs={[{ key: 'online', title: '在线课程' }, { key: 'vs', title: '1V1私教' }]}
- onChange={key => this.onTabChange(key)}
- />
- <Tabs
- type="tag"
- theme="white"
- size="small"
- space={5}
- width={54}
- active={status}
- tabs={[
- { key: 'all', title: '全部' },
- { key: 'nouse', title: '未开通' },
- { key: 'learning', title: '学习中' },
- { key: 'end', title: '已结束' },
- ]}
- onChange={key => this.onStatusChange(key)}
- />
- {this[`renderTab${tab}`]()}
- <Modal
- show={showTime}
- className="clock-modal"
- title="打卡表"
- width={460}
- onClose={() => this.setState({ showTime: false })}
- >
- <div>
- <div className="d-i-b w-3">
- <div className="t-2 t-s-14">听课频率</div>
- <div className="t-4 t-s-18">{data.currentNo ? parseInt(data.totalDays / data.currentNo, 10) : 0}天/课时</div>
- </div>
- <div className="d-i-b w-3">
- <div className="t-2 t-s-14">作业完成度</div>
- <div className="t-4 t-s-18">{data.previewProgress || 0}%</div>
- </div>
- </div>
- <div className="b-b m-t-1 m-b-1" />
- <div className="m-b-1">
- <div className="tag d-i-b t-s-16">
- <i style={{ background: '#6865FD' }} />
- 听课
- </div>
- <div className="tag d-i-b t-s-16">
- <i style={{ background: '#4299FF' }} />
- 预习
- </div>
- <div className="tag d-i-b t-s-16">
- <i style={{ background: '#E7E7E7' }} />
- 停课
- </div>
- </div>
- <DatePlane
- hideInput
- show={showTime}
- onChange={() => { }}
- disabledDate={current => {
- const date = current.format('YYYY-MM-DD');
- return data.stopTimeMap[date];
- }}
- dateRender={current => {
- const date = current.format('YYYY-MM-DD');
- return (
- <div className="ant-calendar-date">
- {current.get('date')}
- {data.courseTimeMap[date] && <i className="s1" style={{ background: '#6865FD' }} />}
- {data.previewTimeMap[date] && <i className="s2" style={{ background: '#4299FF' }} />}
- </div>
- );
- }}
- checkRefresh={(date, refresh) => {
- setTimeout(() => {
- refresh();
- }, 2000);
- return true;
- }}
- />
- <div className="t-2 t-s-12">*听课频率≤2天/课时,作业完成度≥90%,课程有效期可延长7-10天。</div>
- </Modal>
- <Modal
- show={showSuspend}
- title="申请停课"
- width={630}
- confirmText="立即停课"
- onConfirm={() => this.suspend()}
- onCancel={() => this.setState({ showSuspend: false })}
- >
- <div className="t-2 t-s-18">最长停课周期为1个月,到期后系统自动恢复至“学习中”状态。</div>
- <div className="t-2 t-s-18">每门课程只有一次申请机会,是否需要停课?</div>
- <div style={{ bottom: 20, left: 0 }} className="p-a t-3 t-s-14">
- *停课不影响听课频率的计算;
- </div>
- <div style={{ bottom: 0, left: 0 }} className="p-a t-3 t-s-14">
- {' '}
- 停课期间可随时恢复学习。
- </div>
- </Modal>
- <Modal
- show={showRestore}
- title="恢复学习"
- width={630}
- confirmText="立即恢复"
- onConfirm={() => this.restore()}
- onCancel={() => this.setState({ showRestore: false })}
- >
- <div className="t-2 t-s-18">恢复学习后,本课程的停课功能将无法使用。是否恢复学习?</div>
- </Modal>
- <Modal
- show={showUploadNote}
- title="上传笔记"
- width={630}
- confirmText="提交"
- onConfirm={() => this.submitAppointmentComment(note, 'note')}
- onCancel={() => this.setState({ showUploadNote: false, note: {} })}
- >
- <textarea
- className="b-c-1 w-10 p-10 m-b-1"
- rows={6}
- value={note.content}
- placeholder="请输入留言内容。"
- onChange={e => {
- note.content = e.target.value;
- this.setState({ note });
- }}
- />
- <div className={`t-c drag-upload ${this.state.draging ? 'draging' : ''}`}>
- <Button theme="file">上传文件</Button>
- <span className="m-l-1 t-3 t-s-14">
- {note.file ? `上传文件:${note.name} 成功` : '支持 docx, xls, PDF, rar, zip, PNG, JPG 等类型的文件'}
- </span>
- <div className="fixed">
- <span className="f-w-b t-s-18">放开文件立刻上传</span>
- </div>
- <FileUpload
- type="none"
- onDragEnter={() => this.setState({ draging: true })}
- onDragLeave={() => this.setState({ draging: false })}
- onUpload={({ file }) => {
- Common.upload(file).then(result => {
- note.file = result.url;
- note.name = file.name;
- this.setState({ note });
- });
- }}
- />
- </div>
- <div className="b-b m-t-2" />
- </Modal>
- <Modal
- show={showNote}
- title="课后笔记"
- width={500}
- height={500}
- onClose={() => this.setState({ showNote: false })}
- >
- {appointment.noteList &&
- appointment.noteList.map(row => {
- return <Note user={this.props.user} teacher={data.teacher} data={row} />;
- })}
- </Modal>
- <Modal
- show={showSupply}
- title="课后留言"
- width={500}
- height={500}
- onClose={() => this.setState({ showSupply: false })}
- >
- {appointment.supplyList &&
- appointment.supplyList.map(row => {
- return <Note user={this.props.user} teacher={data.teacher} data={row} />;
- })}
- </Modal>
- <Modal
- show={showUploadSupply}
- title="上传留言"
- width={630}
- confirmText="提交"
- onConfirm={() => this.submitAppointmentComment(supply, 'supply')}
- onCancel={() => this.setState({ showUploadSupply: false, supply: {} })}
- >
- <textarea
- className="b-c-1 w-10 p-10 m-b-1"
- rows={6}
- value={supply.content}
- placeholder="请输入留言内容。"
- onChange={e => {
- supply.content = e.target.value;
- this.setState({ supply });
- }}
- />
- <div className={`t-c drag-upload ${this.state.draging ? 'draging' : ''}`}>
- <Button theme="file">上传文件</Button>
- <span className="m-l-1 t-3 t-s-14">
- {supply.file ? `上传文件:${supply.name} 成功` : '支持 docx, xls, PDF, rar, zip, PNG, JPG 等类型的文件'}
- </span>
- <div className="fixed">
- <span className="f-w-b t-s-18">放开文件立刻上传</span>
- </div>
- <FileUpload
- type="none"
- onDragEnter={() => this.setState({ draging: true })}
- onDragLeave={() => this.setState({ draging: false })}
- onUpload={({ file }) => {
- Common.upload(file).then(result => {
- supply.file = result.url;
- supply.name = file.name;
- this.setState({ supply });
- });
- }}
- />
- </div>
- <div className="b-b m-t-2" />
- </Modal>
- <CommentModal
- show={showComment}
- defaultData={comment}
- onConfirm={() => this.setState({ showComment: false, comment: {}, showFinish: true })}
- onCancel={() => this.setState({ showComment: false, comment: {} })}
- onClose={() => this.setState({ showComment: false, comment: {} })}
- />
- <FinishModal
- show={showFinish}
- onConfirm={() => this.setState({ showFinish: false })}
- />
- </div>
- );
- }
- renderTabonline() {
- const { list = [] } = this.state;
- return list.map(item => {
- return (
- <CourseOnline
- data={item}
- user={this.props.user}
- refreshDetail={recordId => {
- this.refreshDetail(recordId);
- }}
- onRestore={() => {
- this.setState({ showRestore: true, restore: item });
- }}
- onSuspend={() => {
- this.setState({ showSuspend: true, suspend: item });
- }}
- onTime={() => {
- this.openTime(item);
- }}
- onComment={() => {
- this.setState({ showComment: true, comment: { channel: 'course-video', position: item.course.id } });
- }}
- closeCommentTips={() => this.closeCommentTips(item.id)}
- />
- );
- });
- }
- renderTabvs() {
- const { list = [] } = this.state;
- return list.map(item => {
- return (
- <CourseVs
- data={item}
- user={this.props.user}
- refreshDetail={recordId => {
- this.refreshDetail(recordId);
- }}
- onRestore={() => {
- this.setState({ showRestore: true, restore: item });
- }}
- onSuspend={() => {
- this.setState({ showSuspend: true, suspend: item });
- }}
- onComment={() => {
- this.setState({ showComment: true, comment: { channel: 'course-vs', position: item.course.id } });
- }}
- closeCommentTips={() => this.closeCommentTips(item.id)}
- onUploadNote={(appointment, row) => {
- this.setState({ showUploadNote: true, appointment, data: item, note: row || {} });
- }}
- onUploadSupply={(appointment, row) => {
- this.setState({ showUploadSupply: true, appointment, data: item, supply: row || {} });
- }}
- onDeleteNote={(appointment, row) => this.deleteAppointmentComment(row)}
- onDeleteSupply={(appointment, row) => this.deleteAppointmentComment(row)}
- onNote={appointment => this.setState({ showNote: true, appointment, data: item })}
- onSupply={appointment => this.setState({ showSupply: true, appointment, data: item })}
- onUploadQuestion={(appointment, file, name) => {
- this.submitQuestionFile({
- id: appointment.id,
- recordId: appointment.recordId,
- questionFile: file,
- questionFileName: name,
- });
- }}
- setCCTalkName={(appointment, cctalkName) => this.setCCTalkName(appointment.recordId, cctalkName)}
- />
- );
- });
- }
- }
- class CourseOnline extends Component {
- constructor(props) {
- super(props);
- this.columns = [
- {
- title: '学习内容',
- key: 'title',
- render: (text, record) => {
- return `课时 ${record.no}: ${text}`;
- },
- },
- {
- title: '预习作业',
- key: 'paper',
- render: text => {
- text = text || {};
- const progress = text.report ? formatPercent(text.report.userNumber, text.report.questionNumber) : 0;
- const times = text.paper ? text.paper.finishTimes : 0;
- return (
- <div>
- <div className="v-a-m d-i-b">
- <ProgressText width={50} size="small" times={times} progress={progress} unit="次" />
- </div>
- {!text.report && (
- <IconButton
- className="m-l-2"
- type="start"
- tip="Start"
- onClick={() => {
- User.needLogin().then(() => {
- Question.startLink('preview', text);
- });
- }}
- />
- )}
- {text.report && !text.report.isFinish && (
- <IconButton
- className="m-l-2"
- type="continue"
- tip="Continue"
- onClick={() => {
- User.needLogin().then(() => {
- Question.continueLink('preview', text);
- });
- }}
- />
- )}
- {text.report && (
- <IconButton
- className="m-l-2"
- type="restart"
- tip="Restart"
- onClick={() => {
- User.needLogin().then(() => {
- Question.restart('preview', text);
- });
- }}
- />
- )}
- {text.report && !!text.report.isFinish && (
- <IconButton
- className="m-l-5"
- type="report"
- tip="Report"
- onClick={() => {
- User.needLogin().then(() => {
- Question.reportLink('preview', text);
- });
- }}
- />
- )}
- </div>
- );
- },
- },
- {
- title: '进度',
- key: 'progress',
- render: (text, record) => {
- const { paper = {} } = record;
- return `${paper.paper && paper.paper.finishTimes > 0 ? `${paper.paper.finishTimes}次+` : ''}${
- paper.report ? formatPercent(paper.report.userNumber, paper.report.questionNumber, false) : '0%'}`;
- },
- },
- {
- title: '最近学习',
- key: 'lastTime',
- render: (text, record) => {
- const { paper = {} } = record;
- return paper.report && formatDate(paper.report.updateTime, 'YYYY-MM-DD HH:mm:ss');
- },
- },
- {
- title: '笔记',
- key: 'note',
- render: (text, record) => {
- return <GIcon name="note" active={record.note} />;
- },
- },
- {
- title: '问答',
- key: 'ask',
- render: (text, record) => {
- return (
- <Link to={`/course/answer/${record.courseId}?tab=my&courseNoId=${record.id}`}>{`${record.answerNumber ||
- 0}/${record.askNumber || 0}`}</Link>
- );
- },
- },
- ];
- this.state = { open: props.data.status === 'ing' };
- }
- render() {
- const { data = {} } = this.props;
- switch (data.status) {
- case 'ing':
- return this.renderIng();
- case 'not':
- return this.renderNot();
- case 'end':
- return this.renderEnd();
- case 'suspend':
- return this.renderSuspend();
- default:
- return <div />;
- }
- }
- renderIng() {
- const { data, onTime, onComment, onSuspend } = this.props;
- const { open } = this.state;
- return (
- <div className="course-item ing">
- <div className="title">
- <div className="tag">学习中</div>
- <div className="text">{data.course.title}</div>
- <div className="right">
- <More
- menu={[{ label: '评价', key: 'comment' }, { label: '停课', key: 'suspend' }]}
- onClick={value => {
- const { key } = value;
- if (key === 'comment') {
- onComment();
- } else if (key === 'suspend') {
- onSuspend();
- }
- }}
- />
- </div>
- </div>
- {data.currentCourseNo && (
- <div
- className="continue"
- onClick={() => {
- linkTo(`/course/detail/${data.course.id}`);
- }}
- >
- <Assets name="notice" />
- 继续学习:课时 {data.currentNo}:{data.currentCourseNo.title}
- </div>
- )}
- <div className="detail">
- <div className="left">
- <Assets name="sun_blue" src={data.course.cover} />
- <div className="info">
- <div className="t1">授课老师</div>
- <div className="t2">{data.course.teacher}</div>
- <div className="t1">有效期</div>
- <div className="t2">{data.useExpireDays}Days</div>
- </div>
- </div>
- <div className="right">
- <div className="item">
- <GIcon name="speed-block" active noHover />
- <div className="text">
- <span>{data.currentNo}</span>/{data.courseNos.length}
- </div>
- </div>
- <div className="item">
- <GIcon name="question-block" active noHover />
- <div className="text">
- <span>{data.answerNumber}</span>/{data.askNumber}
- </div>
- </div>
- <div className="item" onClick={() => onTime()}>
- <GIcon name="clockin-block" active noHover />
- <div className="text">
- <span>{formatSeconds(data.totalTime)}</span> {data.previewProgress || 0}%
- </div>
- </div>
- <div className="item">
- <GIcon name="note-block" active noHover />
- <div className="text">{data.noteNumber}</div>
- </div>
- </div>
- <div className="open">
- <GIcon name={open ? 'up' : 'down'} onClick={() => this.setState({ open: !open })} />
- </div>
- </div>
- {open && this.renderTable()}
- </div>
- );
- }
- renderNot() {
- const { data } = this.props;
- return (
- <div className="course-item not">
- <div className="title">
- <div className="tag">未开通</div>
- <div className="text">{data.course.title}</div>
- </div>
- <div className="detail">
- <div className="left">
- <Assets name="sun_blue" src={data.course.cover} />
- <div className="info">
- <div className="t1">授课老师</div>
- <div className="t2">{data.course.teacher}</div>
- <div>
- <div className="d-i-b m-r-2">
- <div className="t-2">课时</div>
- <div className="t-1 t-s-16">{(data.courseNos || []).length}</div>
- </div>
- <div className="d-i-b">
- <div className="t-2">总时长</div>
- <div className="t-1 t-s-16">{formatSeconds(data.time || data.courseTime)}</div>
- </div>
- </div>
- </div>
- </div>
- <div className="right t-c">
- <div className="text">请于 {formatDate(data.endTime, 'YYYY-MM-DD')} 前开通</div>
- <Button
- size="lager"
- radius
- onClick={() => {
- this.open(data.id);
- }}
- >
- 立即开通
- </Button>
- </div>
- </div>
- </div>
- );
- }
- renderEnd() {
- const { data, onTime, onComment } = this.props;
- const { open } = this.state;
- return (
- <div className="course-item end">
- <div className="title">
- <div className="tag">已结束</div>
- <div className="text">{data.course.title}</div>
- <div className="right">
- <More
- menu={[{ label: '评价', key: 'comment' }]}
- onClick={value => {
- const { key } = value;
- if (key === 'comment') {
- onComment();
- }
- }}
- />
- </div>
- </div>
- <div className="detail">
- <div className="left">
- <Assets name="sun_blue" src={data.course.cover} />
- <div className="info">
- <div className="t1">授课老师</div>
- <div className="t2">{data.course.teacher}</div>
- <div className="t1">有效期</div>
- <div className="t-s-12">
- {formatDate(data.useStartTime, 'YYYY-MM-DD')}
- <br />至{formatDate(data.useEndTime, 'YYYY-MM-DD')}
- </div>
- </div>
- </div>
- <div className="right">
- <div className="item">
- <GIcon name="question-block" active noHover />
- <div className="text">
- <span>{data.answerNumber}</span>/{data.askNumber}
- </div>
- </div>
- <div className="item" onClick={() => onTime()}>
- <GIcon name="clockin-block" active noHover />
- <div className="text">
- <span>{formatSeconds(data.totalTime)}</span> {data.previewProgress || 0}%
- </div>
- </div>
- <div className="item">
- <GIcon name="note-block" active noHover />
- <div className="text">{data.noteNumber}</div>
- </div>
- {data.courseAward > 0 && (
- <div className="item">
- <GIcon name="gift-block" active />
- <div className="text">赠送{data.courseAward}天</div>
- </div>
- )}
- </div>
- <div className="open">
- <GIcon name={open ? 'up' : 'down'} onClick={() => this.setState({ open: !open })} />
- </div>
- </div>
- {open && this.renderTable()}
- </div>
- );
- }
- renderSuspend() {
- const { data, onTime, onRestore, onComment } = this.props;
- const { open } = this.state;
- return (
- <div className="course-item end">
- <div className="title">
- <div className="tag">已停课</div>
- <div className="text">
- {data.course.title}
- <Button size="small" radius onClick={() => onRestore()}>
- 恢复上课
- </Button>
- </div>
- <div className="t-s-12">
- <span className="t-3">申请时间:</span>
- <span className="t-2 m-r-1">{formatDate(data.suspendTime, 'YYYY-MM-DD HH:mm:ss')}</span>
- <span className="t-3">已停课:</span>
- <span>{parseInt((new Date().getTime() - new Date(data.suspendTime).getTime()) / 86400000, 10)}Days/30</span>
- </div>
- <div className="right">
- <More
- menu={[{ label: '评价', key: 'comment' }]}
- onClick={value => {
- const { key } = value;
- if (key === 'comment') {
- onComment();
- }
- }}
- />
- </div>
- </div>
- <div className="detail">
- <div className="left">
- <Assets name="sun_blue" src={data.course.cover} />
- <div className="info">
- <div className="t1">授课老师</div>
- <div className="t2">{data.course.teacher}</div>
- <div className="t1">有效期</div>
- <div className="t2">{data.useExpireDays}Days</div>
- </div>
- </div>
- <div className="right">
- <div className="item">
- <GIcon name="speed-block" noHover />
- <div className="text">
- <span>{data.currentNo}</span>/{data.courseNos.length}
- </div>
- </div>
- <div className="item">
- <GIcon name="question-block" active noHover />
- <div className="text">
- <span>{data.answerNumber}</span>/{data.askNumber}
- </div>
- </div>
- <div className="item" onClick={() => onTime()}>
- <GIcon name="clockin-block" active noHover />
- <div className="text">
- <span>{formatSeconds(data.totalTime)}</span> {data.previewProgress || 0}%
- </div>
- </div>
- <div className="item">
- <GIcon name="note-block" active noHover />
- <div className="text">{data.noteNumber}</div>
- </div>
- </div>
- <div className="open">
- <GIcon name={open ? 'up' : 'down'} onClick={() => this.setState({ open: !open })} />
- </div>
- </div>
- {open && this.renderTable()}
- </div>
- );
- }
- renderTable() {
- const { data = {} } = this.props;
- const { courseNos = [] } = data;
- return <UserTable size="small" columns={this.columns} data={courseNos} />;
- }
- }
- const titleMap = {
- 1: '预约时间',
- 2: '答疑文档',
- 3: '上课',
- 4: '课后笔记',
- 5: '课后补充',
- 6: '备考信息',
- 7: '完成作业',
- };
- const iconMap = {
- 1: 'time-icon',
- 2: 'QA-icon',
- 3: 'class-icon',
- 4: 'note-icon',
- 5: 'supplement-icon',
- 6: 'information-icon',
- 7: 'homework-icon',
- };
- const statusMap = {
- 1: appointment => {
- if (!appointment.id) return 'end';
- return '';
- },
- 2: appointment => {
- if (!appointment.questionFile) return 'not';
- return '';
- },
- 3: (appointment, data) => {
- if (!data.cctalkName) return 'not';
- // if (new Date(appointment.endTime).getTime() > new Date()) return 'not';
- return '';
- },
- 4: appointment => {
- if (!appointment.noteList || appointment.noteList.length === 0) return 'not';
- return '';
- },
- 5: appointment => {
- if (!appointment.supplyList || appointment.supplyList.length === 0) return 'not';
- return '';
- },
- 6: () => {
- return '';
- },
- 7: appointment => {
- const { paper = {} } = appointment;
- if (!paper.report || formatPercent(paper.report.userNumber, paper.report.questionNumber) < 100) return 'not';
- return '';
- },
- };
- class CourseVs extends Component {
- constructor(props) {
- super(props);
- this.columns = {
- system: [
- { title: '学习内容', key: 'title' },
- {
- title: '预习作业',
- key: 'paper',
- render: text => {
- text = text || {};
- const progress = text.report ? formatPercent(text.report.userNumber, text.report.questionNumber) : 0;
- const times = text.paper ? text.paper.finishTimes : 0;
- return (
- <div>
- <div className="v-a-m d-i-b">
- <ProgressText width={50} size="small" times={times} progress={progress} unit="次" />
- </div>
- {!text.report && (
- <IconButton
- className="m-l-2"
- type="start"
- tip="Start"
- onClick={() => {
- User.needLogin().then(() => {
- Question.startLink('preview', text);
- });
- }}
- />
- )}
- {text.report && !text.report.isFinish && (
- <IconButton
- className="m-l-2"
- type="continue"
- tip="Continue"
- onClick={() => {
- User.needLogin().then(() => {
- Question.continueLink('preview', text);
- });
- }}
- />
- )}
- {text.report && !!text.report.isFinish && (
- <IconButton
- className="m-l-2"
- type="restart"
- tip="Restart"
- onClick={() => {
- User.needLogin().then(() => {
- Question.restart('preview', text);
- });
- }}
- />
- )}
- {text.report && !!text.report.isFinish && (
- <IconButton
- className="m-l-5"
- type="report"
- tip="Report"
- onClick={() => {
- User.needLogin().then(() => {
- Question.reportLink('preview', text);
- });
- }}
- />
- )}
- </div>
- );
- },
- },
- {
- title: '授课时间',
- key: 'time',
- render: (text, record) => {
- return (
- <div className="sub">
- <div className="t-2 t-s-12">{formatDate(record.startTime, 'YYYY-MM-DD')}</div>
- <div className="t-6 t-s-12">
- {formatDate(record.startTime, 'HH:mm:ss')} ~ {formatDate(record.endTime, 'HH:mm:ss')}
- </div>
- </div>
- );
- },
- },
- {
- title: '课后笔记',
- key: 'note',
- render: (text, record) => {
- return record.noteList && record.noteList.length > 0 ? (
- <a onClick={() => this.props.onNote(record)}>查看</a>
- ) : (<span>查看</span>);
- },
- },
- {
- title: '课后补充',
- key: 'supply',
- render: (text, record) => {
- return record.supplyList && record.supplyList.length > 0 ? (
- <a onClick={() => this.props.onSupply(record)}>查看</a>
- ) : (<span>查看</span>);
- },
- },
- ],
- answer: [
- { title: '学习内容', key: 'title' },
- {
- title: '答疑文档',
- key: 'questionFile',
- render: (text, record) => {
- return (
- <a href={text} target="_blank">
- {record.questionFileName}
- </a>
- );
- },
- },
- {
- title: '授课时间',
- key: 'time',
- render: (text, record) => {
- return `${formatDate(record.startTime, 'YYYY-MM-DD HH:mm:ss')} ~ ${formatDate(record.endTime, 'HH:mm:ss')}`;
- },
- },
- {
- title: '课后补充',
- key: 'supply',
- render: (text, record) => {
- return record.supplyList ? <a onClick={() => this.props.onSupply(record)}>查看</a> : <span>查看</span>;
- },
- },
- ],
- };
- this.listMap = {
- novice: [1, 3],
- coach: [1, 6, 3],
- system: [1, 7, 3, 4],
- answer: [1, 2, 3],
- };
- const index = props.data.appointments.length - 1;
- this.state = {
- open: props.data.status === 'ing',
- tab: 'ing',
- index,
- list: this.listMap[this.props.data.course.vsType],
- showTips:
- props.data.commentTips === 0 &&
- (props.data.appointments.length === Math.ceil(props.data.number / 2) ||
- props.data.appointments.length === props.data.number),
- };
- }
- closeCommentTips() {
- My.courseCommentTips(this.props.data.id).then(() => {
- this.setState({ showTips: false });
- });
- }
- render() {
- const { data = {} } = this.props;
- switch (data.status) {
- case 'ing':
- return this.renderIng();
- case 'not':
- return this.renderNot();
- case 'end':
- return this.renderEnd();
- case 'suspend':
- return this.renderSuspend();
- default:
- return <div />;
- }
- }
- renderIng() {
- const { data, onComment, closeCommentTips } = this.props;
- const { tab, showTips, open } = this.state;
- return (
- <div className="education-item ing">
- <div className="title">
- <div className="tag">学习中</div>
- <div className="text">
- {data.course.title}
- {data.vsNo > 0 ? `V${data.vsNo}` : ''}
- {data.number > 0 ? `(${data.number}课时)` : ''}
- </div>
- <div className="right">
- <More
- menu={[{ label: '评价', key: 'comment' }, { label: '停课', key: 'suspend' }]}
- onClick={value => {
- const { key } = value;
- if (key === 'comment') {
- onComment();
- }
- }}
- />
- </div>
- </div>
- {showTips && (
- <div className="continue">
- <Icon className="close m-r-5 t-3" type="close-circle" theme="filled" onClick={() => closeCommentTips()} />
- 课程已过半,可以来写写评价啦<a onClick={() => onComment()}>去写评价 ></a>
- </div>
- )}
- <div className="detail">
- <div className="left">
- <Assets name="sun_blue" src={data.course.cover} />
- <div className="info">
- <div className="t1">授课老师</div>
- <div className="t2">{data.teacher.realname}</div>
- <div className="t1">有效期</div>
- <div className="t2">{data.useExpireDays}Days</div>
- </div>
- </div>
- <div className="right">
- <div className="item">
- <GIcon name="speed-block" active noHover />
- <div className="text">
- <span>{data.appointments.length}</span>/{data.number}
- </div>
- </div>
- <div className="item">
- <GIcon name="time-block" active noHover />
- <div className="text">
- <span>{data.appointments.length > 0 ? parseInt(data.totalDays / data.appointments.length, 10) : 0}</span>天/课时
- </div>
- </div>
- </div>
- <div className="open">
- <GIcon name={open ? 'up' : 'down'} onClick={() => this.setState({ open: !open })} />
- </div>
- </div>
- {open && (data.course.vsType === 'system' || data.course.vsType === 'answer') && (
- <Tabs
- className="t-l"
- type="line"
- theme="theme"
- size="small"
- width={80}
- active={tab}
- tabs={[{ key: 'ing', title: '授课中' }, { key: 'end', title: '已结课' }]}
- onChange={key => this.setState({ tab: key })}
- />
- )}
- {open && (tab === 'ing' ? this.renderTimeLine() : this.renderTable())}
- </div>
- );
- }
- renderNot() {
- const { data } = this.props;
- return (
- <div className="education-item not">
- <div className="title">
- <div className="tag">未开通</div>
- <div className="text">
- {data.course.title}
- {data.vsNo > 0 ? `V${data.vsNo}` : ''}
- {data.number > 0 ? `(${data.number}课时)` : ''}
- </div>
- </div>
- <div className="detail">
- <div className="left">
- <Assets name="sun_blue" src={data.course.cover} />
- <div className="info">
- <div className="t1">授课老师</div>
- <div className="t2">{data.teacher.realname}</div>
- <div>
- <div className="d-i-b m-r-2">
- <div className="t-2">课时</div>
- <div className="t-1 t-s-16">{data.number}</div>
- </div>
- <div className="d-i-b">
- <div className="t-2">总时长</div>
- <div className="t-1 t-s-16">{data.number}Hours</div>
- </div>
- </div>
- </div>
- </div>
- <div className="right">
- <div className="qr-code">
- <Assets name="qrcode" src={data.teacher.qr} />
- <div className="i">
- <div className="t1">请尽快与老师预约上课时间</div>
- <div className="t2">请于 {formatDate(data.endTime, 'YYYY-MM-DD')} 前开通课程</div>
- </div>
- </div>
- </div>
- </div>
- {/* {this.renderTimeLine()} */}
- </div>
- );
- }
- renderEnd() {
- const { data, onComment, closeCommentTips } = this.props;
- const { open, tab, showTips } = this.state;
- return (
- <div className="education-item end">
- <div className="title">
- <div className="tag">已结课</div>
- <div className="text">
- {data.course.title}
- {data.vsNo > 0 ? `V${data.vsNo}` : ''}
- {data.number > 0 ? `(${data.number}课时)` : ''}
- </div>
- <div className="right">
- <More
- menu={[{ label: '评价', key: 'comment' }]}
- onClick={value => {
- const { key } = value;
- if (key === 'comment') {
- onComment();
- }
- }}
- />
- </div>
- </div>
- {showTips && (
- <div className="continue">
- <Icon className="close m-r-5 t-3" type="close-circle" theme="filled" onClick={() => closeCommentTips()} />
- 课程已结束,可以来写写评价啦<a onClick={() => onComment()}>去写评价 ></a>
- </div>
- )}
- <div className="detail">
- <div className="left">
- <Assets name="sun_blue" src={data.course.cover} />
- <div className="info">
- <div className="t1">授课老师</div>
- <div className="t2">{data.teacher.realname}</div>
- <div className="t1">有效期</div>
- <div className="t2">{data.useExpireDays}Days</div>
- </div>
- </div>
- <div className="right">
- <div className="item">
- <GIcon name="speed-block" active noHover />
- <div className="text">
- <span>{data.appointments.length}</span>/{data.number}
- </div>
- </div>
- <div className="item">
- <GIcon name="time-block" active noHover />
- <div className="text">
- <span>{data.appointments.length > 0 ? parseInt(data.totalDays / data.appointments.length, 10) : 0}</span>天/课时
- </div>
- </div>
- </div>
- <div className="open">
- <GIcon name={open ? 'up' : 'down'} onClick={() => this.setState({ open: !open })} />
- </div>
- </div>
- {open && (data.course.vsType === 'system' || data.course.vsType === 'answer') && (
- <Tabs
- className="t-l"
- type="line"
- theme="theme"
- size="small"
- width={80}
- active={tab}
- tabs={[{ key: 'ing', title: '授课中' }, { key: 'end', title: '已结课' }]}
- onChange={key => this.setState({ tab: key })}
- />
- )}
- {open && (tab === 'ing' ? this.renderTimeLine() : this.renderTable())}
- </div>
- );
- }
- renderSuspend() {
- const { data, onRestore, onComment } = this.props;
- return (
- <div className="education-item end">
- <div className="title">
- <div className="tag">已停课</div>
- <div className="text">
- {data.course.title}
- {data.vsNo > 0 ? `V${data.vsNo}` : ''}
- {data.number > 0 ? `(${data.number}课时)` : ''}
- <Button size="small" onClick={() => onRestore()}>
- 恢复上课
- </Button>
- </div>
- <div className="t-s-12">
- <span className="t-3">申请时间:</span>
- <span className="t-2 m-r-1">{formatDate(data.suspendTime, 'YYYY-MM-DD HH:mm:ss')}</span>
- <span className="t-3">已停课:</span>
- <span>{parseInt((new Date().getTime() - new Date(data.suspendTime).getTime()) / 86400000, 10)}Days/30</span>
- </div>
- <div className="right">
- <More
- menu={[{ label: '评价', key: 'comment' }]}
- onClick={value => {
- const { key } = value;
- if (key === 'comment') {
- onComment();
- }
- }}
- />
- </div>
- </div>
- <div className="detail">
- <div className="left">
- <Assets name="sun_blue" src={data.course.cover} />
- <div className="info">
- <div className="t1">授课老师</div>
- <div className="t2">{data.teacher.realname}</div>
- <div className="t1">有效期</div>
- <div className="t2">{data.useExpireDays}Days</div>
- </div>
- </div>
- <div className="right">
- <div className="item">
- <GIcon name="speed-block" active noHover />
- <div className="text">
- <span>{data.appointments.length}</span>/{data.number}
- </div>
- </div>
- <div className="item">
- <GIcon name="time-block" active noHover />
- <div className="text">
- <span>{data.appointments.length > 0 ? parseInt(data.totalDays / data.appointments.length, 10) : 0}</span>天/课时
- </div>
- </div>
- </div>
- </div>
- </div>
- );
- }
- renderTimeLine() {
- const { data = {}, onUploadNote, onUploadSupply, onUploadQuestion, setCCTalkName } = this.props;
- const { list = [], index } = this.state;
- const appointment = data.appointments[index] || {};
- let status = '';
- return [
- <div className="class-hour">
- {data.number > 1 && (
- <div className="text">
- 课时 {appointment.no}:{appointment.title}
- </div>
- )}
- {data.number > 1 && (
- <div className="right">
- <GIcon name="prev" onClick={() => this.setState({ index: index === 0 ? index : index - 1 })} />
- <span>上一课时</span>
- <span>下一课时</span>
- <GIcon
- name="next"
- onClick={() => this.setState({ index: index >= data.appointments.length - 1 ? index : index + 1 })}
- />
- </div>
- )}
- </div>,
- <div className="time-line">
- {list.map(item => {
- if (status === '') {
- // 上一阶段完成
- status = statusMap[item](appointment, data);
- } else {
- // 上一阶段未完成
- status = 'end';
- }
- return (
- <TimeLineItem
- type={`${item}`}
- user={this.props.user}
- appointment={appointment}
- data={data}
- status={status}
- onUploadNote={onUploadNote}
- onUploadSupply={onUploadSupply}
- onUploadQuestion={onUploadQuestion}
- setCCTalkName={setCCTalkName}
- />
- );
- })}
- </div>,
- ];
- }
- renderTable() {
- const { data = {} } = this.props;
- const { appointments = [] } = data;
- return (
- <UserTable size="small" columns={this.columns[data.course.vsType]} data={appointments.filter(row => row.id)} />
- );
- }
- }
- class TimeLineItem extends Component {
- constructor(props) {
- super(props);
- this.state = {};
- }
- onClick(key) {
- const { onClick } = this.props;
- const { status } = this.props;
- if (status === 'not') return;
- if (onClick) onClick(key);
- }
- render() {
- const { type } = this.props;
- const { status } = this.props;
- return (
- <div className={`time-line-item ${status}`}>
- <div className="icon-title">
- <GIcon name={iconMap[type]} active={!status} noHover />
- <div className="title">{titleMap[type]}</div>
- </div>
- <div className="time-line-detail">{this.renderDetail()}</div>
- </div>
- );
- }
- renderDetail() {
- const {
- data = {},
- appointment = {},
- type,
- onUploadNote,
- onUploadSupply,
- onDeleteNote,
- onDeleteSupply,
- onUploadQuestion,
- setCCTalkName,
- } = this.props;
- const { status } = this.props;
- const { paper } = appointment;
- switch (type) {
- case '1':
- switch (status) {
- case 'end':
- case 'not':
- return (
- <span>
- 请尽快与老师预约上课时间,老师微信:{data.teacher.wechat}扫码加微信{' '}
- <Popover content={<Assets name="qrcode" src={data.teacher.qr} />}>
- <span>
- <Assets className="m-l-1" name="erweima" />
- </span>
- </Popover>
- </span>
- );
- default:
- return (
- <span>
- {formatDate(appointment.startTime, 'YYYY-MM-DD HH:mm:ss')} ~{' '}
- {formatDate(appointment.endTime, 'HH:mm:ss')}
- </span>
- );
- }
- case '2':
- switch (status) {
- case 'end':
- return <span className="link">点此上传</span>;
- case 'not':
- return (
- <FileUpload
- onUpload={file => {
- return Common.upload({ file }).then(result => onUploadQuestion(appointment, result.url, file.name));
- }}
- >
- <span className="link">点此上传</span>
- </FileUpload>
- );
- default:
- return (
- <a href={appointment.questionFile} target="_blank">
- {appointment.questionFileName || '文件'}
- </a>
- );
- }
- case '3':
- switch (status) {
- case 'end':
- return data.cctalkName ? (
- <span>
- CCtalk 频道号 :{appointment.cctalkChannel}{' '}
- <a className="link" href="" target="_black">
- CC talk使用手册
- </a>
- </span>
- ) : (<div>
- <input
- style={{ width: 200 }}
- className="b-c-1 p-l-1 p-r-1 t-s-12 m-r-1"
- placeholder="请输入CCtalk用户名查看授课频道"
- onChange={e => {
- this.setState({ cctalkName: e.target.value });
- }}
- />
- <Button size="small" radius disabled>
- 提交
- </Button>
- </div>);
- case 'not':
- return data.cctalkName ? (
- <span>
- CCtalk 频道号 :{appointment.cctalkChannel}{' '}
- <a className="link" href="" target="_black">
- CC talk使用手册
- </a>
- </span>
- ) : (<div>
- <input
- style={{ width: 200 }}
- className="b-c-1 p-l-1 p-r-1 t-s-12 m-r-1"
- placeholder="请输入CCtalk用户名查看授课频道"
- onChange={e => {
- this.setState({ cctalkName: e.target.value });
- }}
- />
- <Button
- size="small"
- radius
- onClick={() => {
- if (this.state.cctalkName) setCCTalkName(appointment, this.state.cctalkName);
- }}
- >
- 提交
- </Button>
- </div>);
- default:
- return (
- <span>
- CCtalk 频道号 :{appointment.cctalkChannel}{' '}
- <a className="link" href="" target="_black">
- CC talk使用手册
- </a>
- </span>
- );
- }
- case '4':
- switch (status) {
- case 'end':
- return <span className="link">点此上传</span>;
- case 'not':
- return (
- <span
- className="link"
- onClick={() => {
- onUploadNote(appointment, { appointmentId: appointment.id, recordId: appointment.recordId });
- }}
- >
- 点此上传
- </span>
- );
- default:
- return (
- <div>
- <div>
- <span
- className="link"
- onClick={() => {
- onUploadNote(appointment, { appointmentId: appointment.id, recordId: appointment.recordId });
- }}
- >
- 点此上传
- </span>
- </div>
- <div className="note-list">
- {appointment.noteList.map(row => {
- return (
- <Note
- user={this.props.user}
- teacher={data.teacher}
- data={row}
- reply={!row.userId}
- actionList={
- row.userId ? [{ key: 'edit', label: '编辑' }, { key: 'delete', label: '删除' }] : null
- }
- onAction={key => {
- switch (key) {
- case 'edit':
- onUploadNote(appointment, row);
- break;
- case 'delete':
- onDeleteNote(appointment, row);
- break;
- case 'reply':
- onUploadNote(appointment, {
- parentId: row.id,
- appointmentId: appointment.id,
- recordId: appointment.recordId,
- });
- break;
- default:
- }
- }}
- />
- );
- })}
- </div>
- </div>
- );
- }
- case '5':
- switch (status) {
- case 'end':
- return <span className="link">写留言</span>;
- case 'not':
- return (
- <span
- className="link"
- onClick={() => {
- onUploadSupply(appointment, { appointmentId: appointment.id, recordId: appointment.recordId });
- }}
- >
- 写留言
- </span>
- );
- default:
- return (
- <div>
- <div>
- <span
- className="link"
- onClick={() => {
- onUploadSupply(appointment, { appointmentId: appointment.id, recordId: appointment.recordId });
- }}
- >
- 写留言
- </span>
- </div>
- <div className="note-list">
- {appointment.supplyList.map(row => {
- return (
- <Note
- user={this.props.user}
- teacher={data.teacher}
- data={row}
- reply={!row.userId}
- actionList={
- row.userId ? [{ key: 'edit', label: '编辑' }, { key: 'delete', label: '删除' }] : null
- }
- onAction={key => {
- switch (key) {
- case 'edit':
- onUploadSupply(appointment, row);
- break;
- case 'delete':
- onDeleteSupply(appointment, row);
- break;
- case 'reply':
- onUploadSupply(appointment, {
- parentId: row.id,
- appointmentId: appointment.id,
- recordId: appointment.recordId,
- });
- break;
- default:
- }
- }}
- />
- );
- })}
- </div>
- </div>
- );
- }
- case '6':
- return [
- <div>
- <span>基本情况</span>
- <a href={status !== 'end' ? '' : ''} className="link">
- 填写
- </a>
- </div>,
- <div>
- <span>备考细节</span>
- <a href={status !== 'end' ? '' : ''} className="link">
- 填写
- </a>
- </div>,
- ];
- case '7':
- return (
- <ProgressText
- progress={paper ? formatPercent(paper.report.userNumber, paper.report.questionNumber) : 0}
- size="small"
- />
- );
- default:
- return <div />;
- }
- }
- }
|