|
@@ -12,6 +12,7 @@ import Tabs from '../../../components/Tabs';
|
|
|
import Icon from '../../../components/Icon';
|
|
|
import Switch from '../../../components/Switch';
|
|
|
import Select from '../../../components/Select';
|
|
|
+import { Button } from '../../../components/Button';
|
|
|
import AnswerSelect from '../../../components/AnswerSelect';
|
|
|
import AnswerList from '../../../components/AnswerList';
|
|
|
import AnswerButton from '../../../components/AnswerButton';
|
|
@@ -65,6 +66,7 @@ export default class extends Page {
|
|
|
const { id } = this.params;
|
|
|
Question.getDetailById(id).then(userQuestion => {
|
|
|
const { question, questionNos, paper, note, report, setting } = userQuestion;
|
|
|
+ paper.paperModule = 'examination';
|
|
|
let { questionNo } = userQuestion;
|
|
|
if (!questionNo) ([questionNo] = questionNos);
|
|
|
if (!question.answer) question.answer = { questions: [] };
|
|
@@ -74,7 +76,7 @@ export default class extends Page {
|
|
|
const { content } = question;
|
|
|
// 还原做题顺序
|
|
|
content.questions.forEach((q, i) => {
|
|
|
- q.select = sortListWithOrder(question.select, setting.questions[i]);
|
|
|
+ q.select = sortListWithOrder(q.select, setting.questions[i]);
|
|
|
});
|
|
|
question.answer.questions.forEach((q, i) => {
|
|
|
Object.keys(q).forEach((k) => {
|
|
@@ -123,9 +125,9 @@ export default class extends Page {
|
|
|
}
|
|
|
|
|
|
submitFeedbackError() {
|
|
|
- const { feedback = {}, question = {}, questionNo = {} } = this.state;
|
|
|
+ const { feedback = {}, userQuestion = {}, questionNo = {} } = this.state;
|
|
|
if (feedback.originContent === '' || feedback.content === '' || feedback.target === '') return;
|
|
|
- My.addFeedbackErrorQuestion(question.questionModule, questionNo.id, questionNo.title, feedback.target, feedback.originContent, feedback.content).then(() => {
|
|
|
+ My.addFeedbackErrorQuestion(userQuestion.questionModule, questionNo.id, questionNo.title, feedback.target, feedback.originContent, feedback.content).then(() => {
|
|
|
this.setState({ feedbackModal: false, feedbackOkModal: true });
|
|
|
}).catch(err => {
|
|
|
this.setState({ feedbackError: err.message });
|
|
@@ -133,8 +135,8 @@ export default class extends Page {
|
|
|
}
|
|
|
|
|
|
submitNote(close) {
|
|
|
- const { question = {}, questionNo = {}, note = {} } = this.state;
|
|
|
- My.updateQuestionNote(question.questionModule, questionNo.id, note).then(() => {
|
|
|
+ const { userQuestion = {}, questionNo = {}, note = {} } = this.state;
|
|
|
+ My.updateQuestionNote(userQuestion.questionModule, questionNo.id, note).then(() => {
|
|
|
if (close) this.setState({ noteModal: false });
|
|
|
}).catch(err => {
|
|
|
this.setState({ noteError: err.message });
|
|
@@ -147,14 +149,14 @@ export default class extends Page {
|
|
|
}
|
|
|
|
|
|
toggleCollect() {
|
|
|
- const { userQuestion = {}, question = {}, questionNo = {} } = this.state;
|
|
|
+ const { userQuestion = {}, questionNo = {} } = this.state;
|
|
|
if (!userQuestion.collect) {
|
|
|
- My.addQuestionCollect(question.questionModule, questionNo.id).then(() => {
|
|
|
+ My.addQuestionCollect(userQuestion.questionModule, questionNo.id).then(() => {
|
|
|
userQuestion.collect = true;
|
|
|
this.setState({ userQuestion });
|
|
|
});
|
|
|
} else {
|
|
|
- My.delQuestionCollect(question.questionModule, questionNo.id).then(() => {
|
|
|
+ My.delQuestionCollect(userQuestion.questionModule, questionNo.id).then(() => {
|
|
|
userQuestion.collect = false;
|
|
|
this.setState({ userQuestion });
|
|
|
});
|
|
@@ -217,23 +219,15 @@ export default class extends Page {
|
|
|
}
|
|
|
|
|
|
renderHeader() {
|
|
|
- const { report = {} } = this.state;
|
|
|
- switch (report.paperModule) {
|
|
|
- case 'examination':
|
|
|
- return this.renderExaminationHeader();
|
|
|
- default:
|
|
|
- return this.renderExerciseHeader();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- renderExaminationHeader() {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- renderExerciseHeader() {
|
|
|
- const { userQuestion = {}, questionNo = {}, paper = {}, showIds, questionNos = [], question = {} } = this.state;
|
|
|
- return <div className="layout-header">
|
|
|
+ const { userQuestion = {}, questionNo = {}, paper = {}, report = {}, showIds, questionNos = [], question = {} } = this.state;
|
|
|
+ return <div className={'layout-header'}>
|
|
|
<div className="left">
|
|
|
+ {paper.paperModule && paper.paperModule !== 'examination' && <div className="btn"><Button radius onClick={() => {
|
|
|
+ linkTo(`/paper/report/${report.id}`);
|
|
|
+ }}>返回练习报告</Button></div>}
|
|
|
+ {paper.paperModule && paper.paperModule === 'examination' && <div className="btn"><Button radius onClick={() => {
|
|
|
+ linkTo(`/paper/report/${report.id}`);
|
|
|
+ }}>返回成绩单</Button></div>}
|
|
|
<div className="no">No.{userQuestion.stageNo || userQuestion.no}</div>
|
|
|
<div className="title"><Assets name='book' />{paper.title}</div>
|
|
|
</div>
|
|
@@ -268,8 +262,8 @@ export default class extends Page {
|
|
|
}
|
|
|
|
|
|
renderBase() {
|
|
|
- const { questionStatus, userQuestion = {}, showIds } = this.state;
|
|
|
- return <div className="layout" onClick={() => {
|
|
|
+ const { questionStatus, userQuestion = {}, paper = {}, showIds } = this.state;
|
|
|
+ return <div className={`layout ${paper.paperModule}`} onClick={() => {
|
|
|
if (showIds) this.setState({ showIds: false });
|
|
|
}}>
|
|
|
{this.renderHeader()}
|