page.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import { Carousel, Tooltip } from 'antd';
  4. import { Link } from 'react-router-dom';
  5. import Fullscreen from 'react-fullscreen-crossbrowser';
  6. import './index.less';
  7. import Page from '@src/containers/Page';
  8. import { formatSeconds, formatPercent, formatDate, sortListWithOrder } from '@src/services/Tools';
  9. import Assets from '@src/components/Assets';
  10. import Navigation from '../../../components/Navigation';
  11. import Tabs from '../../../components/Tabs';
  12. import Icon from '../../../components/Icon';
  13. import Switch from '../../../components/Switch';
  14. import Select from '../../../components/Select';
  15. import AnswerSelect from '../../../components/AnswerSelect';
  16. import AnswerList from '../../../components/AnswerList';
  17. import AnswerButton from '../../../components/AnswerButton';
  18. import AnswerTable from '../../../components/AnswerTable';
  19. import OtherAnswer from '../../../components/OtherAnswer';
  20. import { AskTarget } from '../../../../Constant';
  21. import { Question } from '../../../stores/question';
  22. import { My } from '../../../stores/my';
  23. import Sentence from '../process/sentence';
  24. export default class extends Page {
  25. initState() {
  26. return {
  27. step: 0,
  28. hideAnalysis: true,
  29. analysisTab: 'official',
  30. showAnswer: false,
  31. noteField: AskTarget[0].key,
  32. showIds: false,
  33. // question: {
  34. // content: {
  35. // typeset: 'one',
  36. // },
  37. // // questionType: 'awa',
  38. // answer: {
  39. // subject: [[{ text: 'like', uuid: 'hKyz' }]],
  40. // options: ['parallel'],
  41. // },
  42. // stem: "<p><span uuid='kBJe'>I</span> <span uuid='hKyz'>like</span> <span uuid='fQXh'>book</span></p>",
  43. // },
  44. // userQuestion: {
  45. // userAnswer: {
  46. // subject: [{ text: 'I', uuid: 'kBJe' }],
  47. // options: ['compare'],
  48. // },
  49. // no: 2,
  50. // },
  51. // paper: {
  52. // title: '长难句练习',
  53. // questionNumber: 20,
  54. // },
  55. // report: {
  56. // paperModule: 'sentence',
  57. // },
  58. };
  59. }
  60. initData() {
  61. const { id } = this.params;
  62. Question.getDetailById(id).then(userQuestion => {
  63. const { question, questionNos, paper, note, report, setting } = userQuestion;
  64. let { questionNo } = userQuestion;
  65. if (!questionNo) ([questionNo] = questionNos);
  66. if (!question.answer) question.answer = { questions: [] };
  67. if (!question.answerDistributed) question.answerDistributed = { questions: [] };
  68. if (!userQuestion.userAnswer) userQuestion.userAnswer = { questions: [] };
  69. if ((report.setting || {}).disorder) {
  70. const { content } = question;
  71. // 还原做题顺序
  72. content.questions.forEach((q, i) => {
  73. q.select = sortListWithOrder(question.select, setting.questions[i]);
  74. });
  75. question.answer.questions.forEach((q, i) => {
  76. Object.keys(q).forEach((k) => {
  77. if (q[k]) q[k] = sortListWithOrder(q[k], setting.questions[i]);
  78. });
  79. });
  80. question.answerDistributed.questions.forEach((q, i) => {
  81. Object.keys(q).forEach((k) => {
  82. if (q[k]) q[k] = sortListWithOrder(q[k], setting.questions[i]);
  83. });
  84. });
  85. userQuestion.userAnswer.questions.forEach((q, i) => {
  86. Object.keys(q).forEach((k) => {
  87. if (q[k]) q[k] = sortListWithOrder(q[k], setting.questions[i]);
  88. });
  89. });
  90. }
  91. this.setState({ userQuestion, question, questionNo, note, paper, questionNos });
  92. });
  93. }
  94. prevQuestion() {
  95. const { userQuestion } = this.state;
  96. if (userQuestion.no === 1) return;
  97. Question.getDetailByNo(userQuestion.reportId, userQuestion.no - 1).then((r) => {
  98. linkTo(`/paper/question/${r.id}`);
  99. });
  100. }
  101. nextQuestion() {
  102. const { userQuestion } = this.state;
  103. if (userQuestion.questionNumber === userQuestion.no) return;
  104. Question.getDetailByNo(userQuestion.reportId, userQuestion.no + 1).then((r) => {
  105. linkTo(`/paper/question/${r.id}`);
  106. });
  107. }
  108. submitAsk() {
  109. const { userQuestion = {}, ask = {} } = this.state;
  110. if (ask.originContent === '' || ask.content === '' || ask.target === '') return;
  111. My.addQuestionAsk(userQuestion.id, ask.target, userQuestion.questionModule, ask.originContent, ask.content).then(() => {
  112. this.setState({ askModal: false, askOkModal: true });
  113. }).catch(err => {
  114. this.setState({ askError: err.message });
  115. });
  116. }
  117. submitFeedbackError() {
  118. const { feedback = {}, question = {}, questionNo = {} } = this.state;
  119. if (feedback.originContent === '' || feedback.content === '' || feedback.target === '') return;
  120. My.addFeedbackErrorQuestion(question.id, questionNo.title, feedback.target, feedback.originContent, feedback.content).then(() => {
  121. this.setState({ feedbackModal: false, feedbackOkModal: true });
  122. }).catch(err => {
  123. this.setState({ feedbackError: err.message });
  124. });
  125. }
  126. submitNote(close) {
  127. const { userQuestion = {}, note = {} } = this.state;
  128. My.updateQuestionNote(userQuestion.questionModule, userQuestion.questionNoId, note).then(() => {
  129. if (close) this.setState({ noteModal: false });
  130. }).catch(err => {
  131. this.setState({ noteError: err.message });
  132. });
  133. }
  134. toggleFullscreen() {
  135. const { isFullscreenEnabled } = this.state;
  136. this.setState({ isFullscreenEnabled: !isFullscreenEnabled });
  137. }
  138. toggleCollect() {
  139. const { userQuestion = {} } = this.state;
  140. if (!userQuestion.collect) {
  141. My.addQuestionCollect(userQuestion.questionModule, userQuestion.questionNoId).then(() => {
  142. userQuestion.collect = true;
  143. this.setState({ userQuestion });
  144. });
  145. } else {
  146. My.delQuestionCollect(userQuestion.questionModule, userQuestion.questionNoId).then(() => {
  147. userQuestion.collect = false;
  148. this.setState({ userQuestion });
  149. });
  150. }
  151. }
  152. formatStem(text) {
  153. if (!text) return '';
  154. const { showAnswer, question = { content: {} }, userQuestion } = this.state;
  155. const { table = {}, questions = [] } = question.content;
  156. text = text.replace(/#select#/g, "<span class='#select#' />");
  157. text = text.replace(/#table#/g, "<span class='#table#' />");
  158. setTimeout(() => {
  159. const selectList = document.getElementsByClassName('#select#');
  160. const tableList = document.getElementsByClassName('#table#');
  161. for (let i = 0; i < selectList.length; i += 1) {
  162. if (!questions[i]) break;
  163. ReactDOM.render(
  164. <AnswerSelect
  165. list={questions[i].select}
  166. type={'single'}
  167. selected={(userQuestion.userAnswer || { questions: [] }).questions[i]}
  168. answer={(question.answer || { questions: [] }).questions[i]}
  169. fix
  170. show={showAnswer} />,
  171. selectList[i],
  172. );
  173. }
  174. if (table.row && table.col && table.header) {
  175. const columns = table.header.map((title, index) => {
  176. return { title, key: index };
  177. });
  178. for (let i = 0; i < tableList.length; i += 1) {
  179. ReactDOM.render(<AnswerTable list={columns} columns={columns} data={table.data} />, tableList[i]);
  180. }
  181. }
  182. }, 1);
  183. return text;
  184. }
  185. renderView() {
  186. return (
  187. <Fullscreen
  188. enabled={this.state.isFullscreenEnabled}
  189. onChange={isFullscreenEnabled => this.setState({ isFullscreenEnabled })}
  190. >
  191. {this.renderDetail()}
  192. </Fullscreen>
  193. );
  194. }
  195. renderDetail() {
  196. const { report = {} } = this.state;
  197. switch (report.paperModule) {
  198. case 'sentence':
  199. return <Sentence {...this.state} flow={this} scene='answer' mode='question' />;
  200. default:
  201. return <div className='base'>{this.renderBase()}</div>;
  202. }
  203. }
  204. renderHeader() {
  205. const { report = {} } = this.state;
  206. switch (report.paperModule) {
  207. case 'examination':
  208. return this.renderExaminationHeader();
  209. default:
  210. return this.renderExerciseHeader();
  211. }
  212. }
  213. renderExaminationHeader() {
  214. }
  215. renderExerciseHeader() {
  216. const { userQuestion = {}, questionNo = {}, paper = {}, showIds, questionNos = [] } = this.state;
  217. return <div className="layout-header">
  218. <div className="left">
  219. <div className="no">No.{userQuestion.stageNo || userQuestion.no}</div>
  220. <div className="title"><Assets name='book' />{paper.title}</div>
  221. </div>
  222. <div className="center">
  223. <div className="menu-wrap">
  224. ID:{questionNo.title}
  225. {questionNos && questionNos.length > 0 && <Icon name="more" onClick={() => {
  226. this.setState({ showIds: true });
  227. }} />}
  228. {showIds && <div className='menu-content'>
  229. <p>题源汇总</p>
  230. {(questionNos || []).map((row) => <p>ID:{row.title}</p>)}
  231. </div>}
  232. </div>
  233. </div>
  234. <div className="right">
  235. <span className="b">
  236. 用时:<span dangerouslySetInnerHTML={{ __html: formatSeconds(userQuestion.userTime).replace(/([0-9]+)([msh])/g, '<span class="s">$1</span>$2') }} />
  237. {/* 用时:<span className="s">1</span>m<span className="s">39</span>s */}
  238. </span>
  239. <span className="b">
  240. 全站:<span dangerouslySetInnerHTML={{ __html: formatSeconds(questionNo.totalTime / questionNo.totalNumber).replace(/([0-9]+)([msh])/g, '<span class="s">$1</span>$2') }} />
  241. {/* 全站:<span className="s">1</span>m<span className="s">39</span>s */}
  242. </span>
  243. <span className="b">
  244. <span className="s">{formatPercent(questionNo.totalCorrect, questionNo.totalNumber)}</span>%
  245. </span>
  246. <Icon name="question" />
  247. <Icon name="star" active={userQuestion.collect} onClick={() => this.toggleCollect()} />
  248. </div>
  249. </div>;
  250. }
  251. renderBase() {
  252. const { questionStatus, userQuestion = {}, showIds } = this.state;
  253. return <div className="layout" onClick={() => {
  254. if (showIds) this.setState({ showIds: false });
  255. }}>
  256. {this.renderHeader()}
  257. <div className="layout-body">{this.renderBody()}</div>
  258. <div className="layout-footer">
  259. <div className="left">
  260. <Tooltip overlayClassName='gray' placement='top' title='全屏'>
  261. <a>
  262. <Icon name={this.state.isFullscreenEnabled ? 'sceen-restore' : 'sceen-full'} onClick={() => this.toggleFullscreen()} />
  263. </a>
  264. </Tooltip>
  265. </div>
  266. <div className="center">
  267. <AnswerButton className="item" onClick={() => this.setState({ noteModal: true })}>笔记</AnswerButton>
  268. {questionStatus >= 0 && <AnswerButton className="item" onClick={() => {
  269. if (questionStatus > 0) {
  270. this.setState({ askModal: true });
  271. } else {
  272. this.setState({ askFailModal: true });
  273. }
  274. }}>提问</AnswerButton>}
  275. <AnswerButton className="item" onClick={() => this.setState({ feedbackModal: true })}>纠错</AnswerButton>
  276. </div>
  277. <div className="right">
  278. {userQuestion.no !== 1 && <Icon name="prev" onClick={() => this.prevQuestion()} />}
  279. {userQuestion.questionNumber !== userQuestion.no && <Icon name="next" onClick={() => this.nextQuestion()} />}
  280. </div>
  281. </div>
  282. {this.state.askModal && this.renderAsk()}
  283. {this.state.askOkModal && this.renderAskOk()}
  284. {this.state.askFailModal && this.renderAskFail()}
  285. {this.state.feedbackModal && this.renderFeedbackError()}
  286. {this.state.feedbackOkModal && this.renderFeedbackErrorOk()}
  287. {this.state.noteModal && this.renderNote()}
  288. </div>;
  289. }
  290. renderBody() {
  291. const { question = { content: {} } } = this.state;
  292. const { typeset = 'one' } = question.content;
  293. const { hideAnalysis } = this.state;
  294. const show = typeset === 'one' ? true : !hideAnalysis;
  295. return (
  296. <div className="layout-content">
  297. <div className='two'>
  298. {this.renderContent()}
  299. {question.questionType !== 'awa' && this.renderAnswer()}
  300. {question.questionType === 'awa' && this.renderAWA()}
  301. </div>
  302. {question.questionType !== 'awa' && this.renderAnalysis()}
  303. {typeset === 'two' && question.questionType !== 'awa' && (
  304. <div className="fixed-analysis" onClick={() => this.setState({ hideAnalysis: !hideAnalysis })}>
  305. {show ? '收起解析 >' : '查看解析 <'}
  306. </div>
  307. )}
  308. </div>
  309. );
  310. }
  311. renderAnalysis() {
  312. const { question = { content: {} }, analysisTab } = this.state;
  313. const { typeset = 'one' } = question.content;
  314. const { hideAnalysis } = this.state;
  315. const show = typeset === 'one' ? true : !hideAnalysis;
  316. return (
  317. <div className={`block block-analysis two-analysis ${show ? 'show' : ''}`}>
  318. <Tabs
  319. type="division"
  320. active={analysisTab}
  321. space={2}
  322. tabs={[
  323. { key: 'official', name: '官方解析' },
  324. { key: 'qx', name: '千行解析' },
  325. { key: 'association', name: '题源联想' },
  326. { key: 'qa', name: '相关回答' },
  327. ]}
  328. onChange={(key) => {
  329. this.setState({ analysisTab: key });
  330. }}
  331. />
  332. <div className="detail">
  333. {typeset === 'two' && this.renderAnswer()}
  334. {this.renderText()}
  335. </div>
  336. </div>
  337. );
  338. }
  339. renderText() {
  340. const { analysisTab, question = {}, userQuestion = {} } = this.state;
  341. const { asks = [], associations = [] } = userQuestion;
  342. let content;
  343. switch (analysisTab) {
  344. case 'official':
  345. content = <div className="detail-block text-block" dangerouslySetInnerHTML={{ __html: question.officialContent }} />;
  346. break;
  347. case 'qx':
  348. content = <div className="detail-block text-block" dangerouslySetInnerHTML={{ __html: question.qxContent }} />;
  349. break;
  350. case 'association':
  351. content = <div className="detail-block">
  352. <Carousel>
  353. {associations.map(association => {
  354. return <div className="text-block" dangerouslySetInnerHTML={{ __html: association.stem }} />;
  355. })}
  356. </Carousel>
  357. </div>;
  358. break;
  359. case 'qa':
  360. content = <div className="detail-block answer-block">
  361. {asks.map((ask, index) => {
  362. return <OtherAnswer key={index} data={ask} />;
  363. })}
  364. </div>;
  365. break;
  366. default:
  367. break;
  368. }
  369. return content;
  370. }
  371. renderAnswer() {
  372. const { question = { content: {} }, showAnswer, userQuestion = {} } = this.state;
  373. const { questions = [], type, typeset = 'one' } = question.content;
  374. console.log(userQuestion);
  375. return <div className="block block-answer">
  376. {typeset === 'two' ? <Switch checked={showAnswer} onChange={(value) => {
  377. this.setState({ showAnswer: value });
  378. }}>{showAnswer ? '显示答案' : '关闭答案'}</Switch> : ''}
  379. {questions.map((item, index) => {
  380. return (
  381. <div>
  382. <div className="text m-b-2">{item.description}</div>
  383. <AnswerList
  384. show={showAnswer}
  385. selected={(userQuestion.userAnswer || { questions: [] }).questions[index]}
  386. answer={(question.answer || { questions: [] }).questions[index]}
  387. distributed={(question.answerDistributed || { questions: [] }).questions[index]}
  388. list={item.select}
  389. type={type}
  390. first={item.first}
  391. second={item.second}
  392. direction={item.direction}
  393. />
  394. </div>
  395. );
  396. })}
  397. </div>;
  398. }
  399. renderContent() {
  400. const { question = { content: {} }, showAnswer, step } = this.state;
  401. const { typeset = 'one' } = question.content;
  402. const { steps = [] } = question.content;
  403. return (
  404. <div className="block block-content">
  405. {typeset === 'one' && question.questionType !== 'awa' ? <Switch checked={showAnswer} onChange={(value) => {
  406. this.setState({ showAnswer: value });
  407. }}>{showAnswer ? '显示答案' : '关闭答案'}</Switch> : ''}
  408. {question.questionType === 'awa' && <h2>Analytical Writing Assessment</h2>}
  409. {steps.length > 0 && <Navigation theme='detail' list={question.content.steps} active={step} onChange={(v) => this.setState({ step: v })} />}
  410. <div className="text" style={{ height: 2000 }} dangerouslySetInnerHTML={{ __html: this.formatStem(steps.length > 0 ? steps[step].stem : question.stem) }} />
  411. </div>
  412. );
  413. }
  414. renderAWA() {
  415. const { showAnswer, userQuestion = { detail: {}, userAnswer: {} } } = this.state;
  416. return <div className="block block-awa">
  417. <Switch checked={showAnswer} onChange={(value) => {
  418. this.setState({ showAnswer: value });
  419. }}>{showAnswer ? '显示答案' : '关闭答案'}</Switch>
  420. <div className="body">
  421. <h2>Your Response</h2>
  422. {showAnswer && <div className='detail'>
  423. <div className='info'>
  424. <span className="b">
  425. 用时:<span dangerouslySetInnerHTML={{ __html: formatSeconds(userQuestion.userTime).replace(/([0-9]+)([msh])/g, '<span class="s">$1</span>$2') }} />
  426. {/* 用时:<span className="s">1</span>m<span className="s">39</span>s */}
  427. </span>
  428. <span className="b">
  429. 单词数:<span className="s">{Number((userQuestion.detail || {}).words || 0)}</span>词
  430. </span>
  431. </div>
  432. <div className='content-awa' dangerouslySetInnerHTML={{ __html: userQuestion.userAnswer.awa || '' }} />
  433. </div>}
  434. {!showAnswer && <div className='show-awa'>选择「显示答案」查看自己的作文</div>}
  435. </div>
  436. </div>;
  437. }
  438. renderAsk() {
  439. const { ask = {} } = this.state;
  440. return (
  441. <div className="modal ask">
  442. <div className="mask" />
  443. <div className="body">
  444. <div className="title">提问</div>
  445. <div className="desc">
  446. <div className="select-inline">我想对<Select excludeSelf size="small" theme="white" value={ask.target} list={AskTarget} onChange={(item) => {
  447. ask.target = item.value;
  448. this.setState({ ask });
  449. }} />进行提问</div>
  450. <div className="label">有疑问的具体内容是:</div>
  451. <textarea className="textarea" value={ask.originContent} placeholder="请复制粘贴有疑问的内容。" onChange={(e) => {
  452. ask.originContent = e.target.value;
  453. this.setState({ ask });
  454. }} />
  455. <div className="label">针对以上内容的问题是:</div>
  456. <textarea className="textarea" value={ask.content} placeholder="提问频率高的问题会被优先回答哦。" onChange={(e) => {
  457. ask.content = e.target.value;
  458. this.setState({ ask });
  459. }} />
  460. </div>
  461. <div className="bottom">
  462. <AnswerButton theme="cancel" size="lager" onClick={() => this.setState({ askModal: false })}>
  463. 取消
  464. </AnswerButton>
  465. <AnswerButton size="lager" onClick={() => this.submitAsk()}>提交</AnswerButton>
  466. </div>
  467. </div>
  468. </div>
  469. );
  470. }
  471. renderAskOk() {
  472. return (
  473. <div className="modal ask-ok">
  474. <div className="mask" />
  475. <div className="body">
  476. <div className="title">提问</div>
  477. <div className="content">
  478. <div className="left">
  479. <div className="text">已提交成功!</div>
  480. <div className="text">关注公众号,老师回答后会立即收到通知。</div>
  481. <div className="text">我们也会通过站内信的方式通知你。</div>
  482. <div className="small">成为学员享受极速答疑特权。<Link>了解更多</Link></div>
  483. </div>
  484. <div className="right">
  485. <div className="text">扫码关注公众号</div>
  486. <div className="text">千行GMAT</div>
  487. </div>
  488. </div>
  489. <div className="confirm">
  490. <AnswerButton size="lager" theme="confirm" onClick={() => {
  491. this.setState({ askOkModal: false });
  492. }}>
  493. 好的,知道了
  494. </AnswerButton>
  495. </div>
  496. </div>
  497. </div>
  498. );
  499. }
  500. renderAskFail() {
  501. return (
  502. <div className="modal ask-ok">
  503. <div className="mask" />
  504. <div className="body">
  505. <div className="title">提问</div>
  506. <div className="content">
  507. <div className="left">
  508. <div className="text">提问功能正在维护中。</div>
  509. <div className="text">可先查阅“相关问答” 或 成为学员享受极速 答疑特权。</div>
  510. <Link to="/">了解更多></Link>
  511. </div>
  512. <div className="right">
  513. <div className="text">扫码关注公众号</div>
  514. <div className="text">千行GMAT</div>
  515. </div>
  516. </div>
  517. <div className="confirm">
  518. <AnswerButton size="lager" theme="confirm" onClick={() => {
  519. this.setState({ askFailModal: false });
  520. }}>
  521. 好的,知道了
  522. </AnswerButton>
  523. </div>
  524. </div>
  525. </div>
  526. );
  527. }
  528. renderFeedbackError() {
  529. const { feedback = {} } = this.state;
  530. return (
  531. <div className="modal error">
  532. <div className="mask" />
  533. <div className="body">
  534. <div className="title">纠错</div>
  535. <div className="desc">
  536. <div className="select-inline">我想对<Select excludeSelf size="small" theme="white" value={feedback.target} list={AskTarget} onChange={(item) => {
  537. feedback.target = item.value;
  538. this.setState({ feedback });
  539. }} />进行提问</div>
  540. <div className="label">错误内容是:</div>
  541. <textarea className="textarea" value={feedback.originContent} placeholder="你可以适当扩大复制范围以使我们准确定位,感谢。" />
  542. <div className="label">应该改为:</div>
  543. <textarea className="textarea" placeholder="只需提供正确内容即可" />
  544. </div>
  545. <div className="bottom">
  546. <AnswerButton theme="cancel" size="lager" onClick={() => {
  547. this.setState({ feedbackModal: false });
  548. }}>
  549. 取消
  550. </AnswerButton>
  551. <AnswerButton size="lager" onClick={() => {
  552. this.submitFeedbackError();
  553. }}>提交</AnswerButton>
  554. </div>
  555. </div>
  556. </div>
  557. );
  558. }
  559. renderFeedbackErrorOk() {
  560. return (
  561. <div className="modal error-ok">
  562. <div className="mask" />
  563. <div className="body">
  564. <div className="title">纠错</div>
  565. <div className="content">
  566. <div className="left">
  567. <div className="text"><Assets name='right' svg />已提交成功!</div>
  568. <div className="text">感谢您的耐心反馈,我们会尽快核实并以站内信的方式告知结果。</div>
  569. <div className="text">您也可以关注公众号及时获取结果。</div>
  570. </div>
  571. <div className="right">
  572. <div className="text">扫码关注公众号</div>
  573. <div className="text">千行GMAT</div>
  574. </div>
  575. </div>
  576. <div className="confirm">
  577. <AnswerButton size="lager" theme="confirm" onClick={() => {
  578. this.setState({ feedbackOkModal: false });
  579. }}>
  580. 好的,知道了
  581. </AnswerButton>
  582. </div>
  583. </div>
  584. </div>
  585. );
  586. }
  587. renderNote() {
  588. const { noteField, note = {} } = this.state;
  589. return (
  590. <div className="modal note">
  591. <div className="mask" />
  592. <div className="body">
  593. <div className="title">笔记</div>
  594. <div className="content">
  595. <div className="tabs">
  596. {AskTarget.map(item => {
  597. return (
  598. <div className={`tab ${noteField === item.key ? 'active' : ''}`} onClick={() => {
  599. this.setState({ noteField: item.key });
  600. }}>
  601. <div className="text">{item.label}</div>
  602. <div className="date">{note[`${item.key}Time`] ? formatDate(note[`${item.key}Time`]) : ''}</div>
  603. </div>
  604. );
  605. })}
  606. </div>
  607. <div className="input">
  608. <textarea className="textarea" value={note[`${noteField}Content`] || ''} placeholder="记下笔记,方便以后复习" onChange={(e) => {
  609. note[`${noteField}Time`] = new Date();
  610. note[`${noteField}Content`] = e.target.value;
  611. this.setState({ note });
  612. }} />
  613. <div className="bottom">
  614. <AnswerButton theme="cancel" size="lager" onClick={() => {
  615. this.setState({ noteModal: false });
  616. }}>
  617. 取消
  618. </AnswerButton>
  619. <AnswerButton size="lager" onClick={() => {
  620. this.submitNote();
  621. }}>编辑</AnswerButton>
  622. <AnswerButton size="lager" onClick={() => {
  623. this.submitNote(true);
  624. }}>保存</AnswerButton>
  625. </div>
  626. </div>
  627. </div>
  628. </div>
  629. </div>
  630. );
  631. }
  632. }