|
@@ -1,11 +1,12 @@
|
|
|
import React from 'react';
|
|
|
+import { Link } from 'react-router-dom';
|
|
|
import './index.less';
|
|
|
import LineChart from '@src/components/LineChart';
|
|
|
import BarChart from '@src/components/BarChart';
|
|
|
import PieChart from '@src/components/PieChart';
|
|
|
import Assets from '@src/components/Assets';
|
|
|
import Page from '@src/containers/Page';
|
|
|
-import { formatDate, formatPercent, formatSeconds, formatMinute, formatSecond, getMap } from '@src/services/Tools';
|
|
|
+import { formatDate, formatPercent, formatSeconds, formatMinute, formatSecond, formatMinuteSecond, getMap } from '@src/services/Tools';
|
|
|
import { Icon, Tooltip } from 'antd';
|
|
|
import { Question } from '../../../stores/question';
|
|
|
import { Button } from '../../../components/Button';
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
} from '../../../../Constant';
|
|
|
|
|
|
const QuestionDifficultMap = getMap(QuestionDifficult, 'value', 'label');
|
|
|
+const QuestionDifficultSort = getMap(QuestionDifficult, 'value', 'sort');
|
|
|
|
|
|
function BarOption3(titles, source, data1, data2, color1, color2) {
|
|
|
return {
|
|
@@ -502,7 +504,7 @@ function pieOption2(title, value1, value2, value3) {
|
|
|
|
|
|
export default class extends Page {
|
|
|
initState() {
|
|
|
- return { tab: 'main', report: { paperModule: 'sentence' } };
|
|
|
+ return { tab: 'main', report: { paperModule: '' } };
|
|
|
}
|
|
|
|
|
|
initData() {
|
|
@@ -530,6 +532,31 @@ export default class extends Page {
|
|
|
case 'question':
|
|
|
|
|
|
Question.questionReport(id).then(result => {
|
|
|
+ switch (result.paperModule) {
|
|
|
+ case 'sentence':
|
|
|
+ result = result.map((row) => {
|
|
|
+ row.struct = row.detail.subject && row.detail.predicate && row.detail.object ? 0 : 1;
|
|
|
+ row.logic = row.detail.options ? 0 : 1;
|
|
|
+
|
|
|
+ row.note = row.note ? 1 : 0;
|
|
|
+ row.collect = row.collect ? 1 : 0;
|
|
|
+ return row;
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case 'textbook':
|
|
|
+ case 'exercise':
|
|
|
+ result = result.map((row) => {
|
|
|
+ row.correct = row.isCorrect ? 0 : 1;
|
|
|
+ row.diff = QuestionDifficultSort[row.question.difficult];
|
|
|
+
|
|
|
+ row.note = row.note ? 1 : 0;
|
|
|
+ row.collect = row.collect ? 1 : 0;
|
|
|
+ return row;
|
|
|
+ });
|
|
|
+ this.refreshExercise(result);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ }
|
|
|
this.setState({ list: result });
|
|
|
});
|
|
|
break;
|
|
@@ -569,15 +596,48 @@ export default class extends Page {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ questionSort(field) {
|
|
|
+ let { order } = this.state;
|
|
|
+ const { list = [] } = this.state;
|
|
|
+ if (order === field) {
|
|
|
+ order = 'no';
|
|
|
+
|
|
|
+ } else {
|
|
|
+ order = field;
|
|
|
+
|
|
|
+ }
|
|
|
+ list.sort((a, b) => {
|
|
|
+ const aValue = a[order];
|
|
|
+ const bValue = a[order];
|
|
|
+ if (aValue === bValue) {
|
|
|
+ return a.no < b.no ? -1 : a.no > b.no ? 1 : 0;
|
|
|
+ }
|
|
|
+ return aValue > bValue ? -1 : 1;
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.setState({ order, list });
|
|
|
+ }
|
|
|
+
|
|
|
renderView() {
|
|
|
- const { report = {} } = this.state;
|
|
|
- console.log(report);
|
|
|
+ const { report = {}, search = {} } = this.state;
|
|
|
+ const { info } = search;
|
|
|
switch (report.paperModule) {
|
|
|
case 'sentence':
|
|
|
+ if (info === 'question') {
|
|
|
+ return this.renderSentenceQuestion();
|
|
|
+ }
|
|
|
return this.renderSentence();
|
|
|
case 'textbook':
|
|
|
+ if (info === 'question') {
|
|
|
+ return this.renderExerciseQuestion();
|
|
|
+ }
|
|
|
return this.renderTextbook();
|
|
|
case 'exercise':
|
|
|
+ if (info === 'question') {
|
|
|
+ return this.renderExerciseQuestion();
|
|
|
+ }
|
|
|
return this.renderExercise();
|
|
|
case 'examination':
|
|
|
return this.renderExamination();
|
|
@@ -690,11 +750,14 @@ export default class extends Page {
|
|
|
}
|
|
|
|
|
|
renderSentenceQuestion() {
|
|
|
+ const { report, list, order } = this.state;
|
|
|
return <div className='sentence question'>
|
|
|
<div className='header'>
|
|
|
<div className='content'>
|
|
|
<div className='title'>题目回顾</div>
|
|
|
- <Button className='back' radius>返回长难句报告</Button>
|
|
|
+ <Button className='back' radius onClick={() => {
|
|
|
+ linkTo(`/paper/report/${report.id}`);
|
|
|
+ }}>返回长难句报告</Button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div className='body'>
|
|
@@ -704,63 +767,39 @@ export default class extends Page {
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th>序号</th>
|
|
|
- <th width='360'>题目</th>
|
|
|
- <th>句子结构<GIcon name='arrow-up' /></th>
|
|
|
- <th>逻辑关系<GIcon name='arrow-down' /></th>
|
|
|
- <th>用时<GIcon name='arrow-up' /></th>
|
|
|
- <th>收藏<GIcon name='arrow-up' /></th>
|
|
|
- <th>笔记<GIcon name='arrow-up' /></th>
|
|
|
+ <th width='420'>题目</th>
|
|
|
+ <th className="point" onClick={() => {
|
|
|
+ this.questionSort('struct');
|
|
|
+ }}>句子结构<GIcon name={order === 'struct' ? 'arrow-down' : 'arrow-up'} active={order === 'struct'} /></th>
|
|
|
+ <th className="point" onClick={() => {
|
|
|
+ this.questionSort('logic');
|
|
|
+ }}>逻辑关系<GIcon name={order === 'logic' ? 'arrow-down' : 'arrow-up'} active={order === 'logic'} /></th>
|
|
|
+ <th className="point" onClick={() => {
|
|
|
+ this.questionSort('userTime');
|
|
|
+ }}>用时<GIcon name={order === 'userTime' ? 'arrow-down' : 'arrow-up'} active={order === 'userTime'} /></th>
|
|
|
+ <th className="point" onClick={() => {
|
|
|
+ this.questionSort('collect');
|
|
|
+ }}>收藏<GIcon name={order === 'collect' ? 'arrow-down' : 'arrow-up'} active={order === 'collect'} /></th>
|
|
|
+ <th className="point" onClick={() => {
|
|
|
+ this.questionSort('note');
|
|
|
+ }}>笔记<GIcon name={order === 'note' ? 'arrow-down' : 'arrow-up'} active={order === 'note'} /></th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody>
|
|
|
- <tr>
|
|
|
- <td>1</td>
|
|
|
- <td>
|
|
|
- <div className='n'> OG18 #678</div>
|
|
|
- <div className='desc'>「图形」None of the attempts to specify the causes of crime explains why most of the people exposed to</div>
|
|
|
- </td>
|
|
|
- <td><GIcon name='error' noHover /></td>
|
|
|
- <td><GIcon name='right' noHover /></td>
|
|
|
- <td>1.3</td>
|
|
|
- <td><GIcon name='star' noHover /></td>
|
|
|
- <td><GIcon name='note' noHover /></td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td>1</td>
|
|
|
- <td>
|
|
|
- <div className='n'> OG18 #678</div>
|
|
|
- <div className='desc'>「图形」None of the attempts to specify the causes of crime explains why most of the people exposed to</div>
|
|
|
- </td>
|
|
|
- <td><GIcon name='error' noHover /></td>
|
|
|
- <td><GIcon name='right' noHover /></td>
|
|
|
- <td>1.3</td>
|
|
|
- <td><GIcon name='star' active /></td>
|
|
|
- <td><GIcon name='note' active /></td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td>1</td>
|
|
|
- <td>
|
|
|
- <div className='n'> OG18 #678</div>
|
|
|
- <div className='desc'>「图形」None of the attempts to specify the causes of crime explains why most of the people exposed to</div>
|
|
|
- </td>
|
|
|
- <td><GIcon name='error' noHover /></td>
|
|
|
- <td><GIcon name='right' noHover /></td>
|
|
|
- <td>1.3</td>
|
|
|
- <td><GIcon name='star' noHover /></td>
|
|
|
- <td><GIcon name='note' noHover /></td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td>1</td>
|
|
|
- <td>
|
|
|
- <div className='n'> OG18 #678</div>
|
|
|
- <div className='desc'>「图形」None of the attempts to specify the causes of crime explains why most of the people exposed to</div>
|
|
|
- </td>
|
|
|
- <td><GIcon name='error' noHover /></td>
|
|
|
- <td><GIcon name='right' noHover /></td>
|
|
|
- <td>1.3</td>
|
|
|
- <td><GIcon name='star' active /></td>
|
|
|
- <td><GIcon name='note' active /></td>
|
|
|
- </tr>
|
|
|
+ {(list || []).map(row => {
|
|
|
+ return <tr>
|
|
|
+ <td>{row.no}</td>
|
|
|
+ <td>
|
|
|
+ <div className='n'><Link to={`/paper/question/${row.id}`}>{row.questionNo.title}</Link></div>
|
|
|
+ <div className='desc'>{row.question.description}</div>
|
|
|
+ </td>
|
|
|
+ <td><GIcon name={row.detail.subject && row.detail.predicate && row.detail.object ? 'right' : 'error'} noHover /></td>
|
|
|
+ <td><GIcon name={row.detail.options ? 'right' : 'error'} noHover /></td>
|
|
|
+ <td>{formatMinuteSecond(row.userTime)}</td>
|
|
|
+ <td><GIcon name='star' active={row.collect} noHover /></td>
|
|
|
+ <td><GIcon name='note' active={row.note} noHover /></td>
|
|
|
+ </tr>;
|
|
|
+ })}
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
@@ -830,7 +869,65 @@ export default class extends Page {
|
|
|
}
|
|
|
|
|
|
renderExerciseQuestion() {
|
|
|
- return <div />;
|
|
|
+ const { report, list, order } = this.state;
|
|
|
+ return <div className='sentence question'>
|
|
|
+ <div className='header'>
|
|
|
+ <div className='content'>
|
|
|
+ <div className='title'>题目回顾</div>
|
|
|
+ <Button className='back' radius onClick={() => {
|
|
|
+ linkTo(`/paper/report/${report.id}`);
|
|
|
+ }}>返回练习报告</Button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className='body'>
|
|
|
+ <div className='content'>
|
|
|
+ <div className='tip'><Assets name='notice' />点击题目查看详情</div>
|
|
|
+ <table>
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>序号</th>
|
|
|
+ <th width='340'>题目</th>
|
|
|
+ <th className="point" onClick={() => {
|
|
|
+ this.questionSort('correct');
|
|
|
+ }}>正误<GIcon name={order === 'correct' ? 'arrow-down' : 'arrow-up'} active={order === 'correct'} /></th>
|
|
|
+ <th className="point" onClick={() => {
|
|
|
+ this.questionSort('diff');
|
|
|
+ }}>难度<GIcon name={order === 'diff' ? 'arrow-down' : 'arrow-up'} active={order === 'diff'} /></th>
|
|
|
+ <th className="point" onClick={() => {
|
|
|
+ this.questionSort('userTime');
|
|
|
+ }}>用时<GIcon name={order === 'userTime' ? 'arrow-down' : 'arrow-up'} active={order === 'userTime'} /></th>
|
|
|
+ <th className="point" onClick={() => {
|
|
|
+ this.questionSort('place');
|
|
|
+ }}>主要考点<GIcon name={order === 'place' ? 'arrow-down' : 'arrow-up'} active={order === 'place'} /></th>
|
|
|
+ <th className="point" onClick={() => {
|
|
|
+ this.questionSort('collect');
|
|
|
+ }}>收藏<GIcon name={order === 'collect' ? 'arrow-down' : 'arrow-up'} active={order === 'collect'} /></th>
|
|
|
+ <th className="point" onClick={() => {
|
|
|
+ this.questionSort('note');
|
|
|
+ }}>笔记<GIcon name={order === 'note' ? 'arrow-down' : 'arrow-up'} active={order === 'note'} /></th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ {(list || []).map(row => {
|
|
|
+ return <tr>
|
|
|
+ <td>{row.no}</td>
|
|
|
+ <td>
|
|
|
+ <div className='n'><Link to={`/paper/question/${row.id}`}>{row.questionNo.title}</Link></div>
|
|
|
+ <div className='desc'>{row.question.description}</div>
|
|
|
+ </td>
|
|
|
+ <td><GIcon name={row.isCorrect ? 'right' : 'error'} noHover /></td>
|
|
|
+ <td>{row.question.difficult}</td>
|
|
|
+ <td>{formatMinuteSecond(row.userTime)}</td>
|
|
|
+ <td>{row.question.place}</td>
|
|
|
+ <td><GIcon name='star' active={row.collect} noHover /></td>
|
|
|
+ <td><GIcon name='note' active={row.note} noHover /></td>
|
|
|
+ </tr>;
|
|
|
+ })}
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>;
|
|
|
}
|
|
|
|
|
|
renderExerciseDetail() {
|