index.js 24 KB

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