page.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. import React, { Component } from 'react';
  2. import './index.less';
  3. import { Icon, Checkbox } from 'antd';
  4. import Page from '@src/containers/Page';
  5. import Assets from '@src/components/Assets';
  6. import { timeRange, getMap, formatPercent, formatMonth, formatDate, formatSeconds } from '@src/services/Tools';
  7. import UserLayout from '../../../layouts/User';
  8. import UserTable from '../../../components/UserTable';
  9. import UserAction from '../../../components/UserAction';
  10. import { RealAuth } from '../../../components/OtherModal';
  11. import Examination from '../../../components/Examination';
  12. import VipRenew from '../../../components/VipRenew';
  13. import menu, { refreshQuestionType } from '../index';
  14. import Tabs from '../../../components/Tabs';
  15. import Modal from '../../../components/Modal';
  16. import Select from '../../../components/Select';
  17. import GIcon from '../../../components/Icon';
  18. import { TimeRange, QuestionType, PrepareStatus, ExperiencePercent } from '../../../../Constant';
  19. import { My } from '../../../stores/my';
  20. import { Question } from '../../../stores/question';
  21. const QuestionTypeMap = getMap(QuestionType, 'value', 'label');
  22. const PrepareStatusMap = getMap(PrepareStatus, 'value', 'label');
  23. const ExperiencePercentMap = getMap(ExperiencePercent, 'value', 'label');
  24. const columns = [
  25. {
  26. key: 'question_type',
  27. title: '题型',
  28. render: (text, record) => {
  29. return QuestionTypeMap[record.questionType];
  30. },
  31. fixSort: true,
  32. },
  33. {
  34. key: 'title',
  35. title: '题目ID',
  36. fixSort: true,
  37. },
  38. {
  39. key: 'description',
  40. title: '内容',
  41. },
  42. {
  43. key: 'time',
  44. title: '耗时',
  45. sort: true,
  46. render: (text, record) => {
  47. const user = record.stat.userTime / record.stat.userNumber;
  48. const all = record.questionNo.totalTime / record.questionNo.totalNumber;
  49. return <div className="sub">
  50. <div className="t-2 t-s-12">{formatSeconds(user)}<Assets height={10} width={10} name={user > all ? 'up' : 'down'} /></div>
  51. <div className="t-6 t-s-12">全站{formatSeconds(all)}</div>
  52. </div>;
  53. },
  54. },
  55. {
  56. key: 'correct',
  57. title: '错误率',
  58. sort: true,
  59. render: (text, record) => {
  60. return <div className="sub">
  61. <div className="t-2 t-s-12">{formatPercent(record.stat.userNumber - record.stat.userCorrect, record.stat.userNumber, false)}</div>
  62. <div className="t-6 t-s-12">{record.stat.userNumber - record.stat.userCorrect}/{record.stat.userNumber}</div>
  63. </div>;
  64. },
  65. },
  66. {
  67. key: 'latest_time',
  68. title: '最近做题',
  69. render: (text) => {
  70. return <div className="sub">
  71. <div className="t-2 t-s-12">{text.split(' ')[0]}</div>
  72. <div className="t-6 t-s-12">{text.split(' ')[1]}</div>
  73. </div>;
  74. },
  75. },
  76. {
  77. key: '',
  78. title: '',
  79. render: (text, record) => {
  80. return <div><GIcon name="note" active={record.note} /></div>;
  81. },
  82. },
  83. ];
  84. const exportType = [
  85. { key: 'question', title: '题目' },
  86. { key: 'official', title: '官方解析' },
  87. { key: 'note', title: '我的笔记' },
  88. { key: 'qx', title: '千行解析', auth: true },
  89. { key: 'association', title: '题源联想', auth: true },
  90. { key: 'qa', title: '相关问答', auth: true },
  91. ];
  92. export default class extends Page {
  93. constructor(props) {
  94. props.size = 10;
  95. super(props);
  96. }
  97. initState() {
  98. return {
  99. tab: 'question',
  100. module: 'exercise',
  101. timerange: 'today',
  102. filterMap: {},
  103. sortMap: {},
  104. list: [],
  105. selectList: [],
  106. allChecked: false,
  107. showDetail: false,
  108. };
  109. }
  110. initData() {
  111. const data = Object.assign(this.state, this.state.search);
  112. data.filterMap = this.state.search;
  113. if (data.order) {
  114. data.sortMap = { [data.order]: data.direction };
  115. }
  116. if (data.timerange) {
  117. data.filterMap.timerange = data.timerange;
  118. }
  119. switch (data.tab) {
  120. case 'question':
  121. return this.refreshQuestion(data);
  122. case 'article':
  123. return this.refreshArticle(data);
  124. default:
  125. return null;
  126. }
  127. }
  128. refreshQuestion(data) {
  129. const [startTime, endTime] = timeRange(data.timerange);
  130. refreshQuestionType(this, data.subject, data.questionType, {
  131. all: true,
  132. needSentence: true,
  133. allSubject: true,
  134. }).then(({ questionTypes }) => {
  135. this.setState({ moduleSelect: [{ title: '练习', key: 'exercise' }, { title: '模考', key: 'examination' }] });
  136. My.listQuestionCollect(
  137. Object.assign(
  138. { module: data.module, questionTypes, startTime, endTime },
  139. this.state.search,
  140. {
  141. order: Object.keys(data.sortMap)
  142. .map(key => {
  143. if (key === 'title') return 'pid desc, no desc';
  144. return `${key} ${data.sortMap[key]}`;
  145. })
  146. .join(','),
  147. },
  148. ),
  149. ).then(result => {
  150. result.list = result.list.map(row => {
  151. row.key = row.questionNoId;
  152. row.questionType = row.question.questionType;
  153. row.title = row.questionNo.title;
  154. row.description = row.question.description;
  155. row.latest_time = formatDate(row.latestTime, 'YYYY-MM-DD HH:mm:ss');
  156. return row;
  157. });
  158. this.setState({ list: result.list, total: result.total });
  159. });
  160. });
  161. }
  162. refreshArticle(data) {
  163. const [startTime, endTime] = timeRange(data.timerange);
  164. My.listExperienceCollect(Object.assign({ startTime, endTime }, this.state.search)).then(result => {
  165. this.setState({ list: result.list, total: result.total });
  166. });
  167. }
  168. onTabChange(tab) {
  169. const data = { tab };
  170. this.refreshQuery(data);
  171. }
  172. onFilter(value) {
  173. this.search(value, false);
  174. this.initData();
  175. }
  176. onSearch(value) {
  177. this.search({ keyword: value }, false);
  178. this.initData();
  179. }
  180. onSort(value) {
  181. const keys = Object.keys(value);
  182. // this.search({ order: keys.length ? keys.join('|') : null, direction: keys.length ? Object.values(value).join('|') : null });
  183. const { sortMap } = this.state;
  184. const index = keys.length > 1 && sortMap[keys[0]] ? 1 : 0;
  185. this.search({ order: keys.length ? keys[index] : null, direction: keys.length ? value[keys[index]] : null }, false);
  186. this.initData();
  187. }
  188. onChangePage(page) {
  189. this.search({ page }, false);
  190. this.initData();
  191. }
  192. onAll(checked) {
  193. const selectList = [];
  194. if (checked) {
  195. const { list = [] } = this.state;
  196. list.forEach(item => {
  197. if (selectList.indexOf(item.key) >= 0) return;
  198. selectList.push(item.key);
  199. });
  200. }
  201. this.setState({ selectList, allChecked: checked });
  202. }
  203. onSelect(selectList) {
  204. this.setState({ selectList });
  205. }
  206. onAction(key) {
  207. const { info } = this.props.user;
  208. const { selectList } = this.state;
  209. switch (key) {
  210. case 'help':
  211. this.setState({ showTips: true });
  212. return;
  213. case 'clear':
  214. if (selectList.length === 0) {
  215. this.setState({ showWarn: true, warn: { title: '移除', content: '不可少于1题,请重新选择' } });
  216. return;
  217. }
  218. this.setState({ showClearCollectConfirm: true, clearInfo: { questionNoIds: selectList } });
  219. break;
  220. case 'group':
  221. if (!info.vip) {
  222. this.setState({ showVip: true });
  223. return;
  224. }
  225. if (selectList.length < 10) {
  226. this.setState({ showWarn: true, warn: { title: '组卷练习', content: '不可小于10题,请重新选择' } });
  227. return;
  228. }
  229. if (selectList.length > 50) {
  230. this.setState({ showWarn: true, warn: { title: '组卷练习', content: '不可多余50题,请重新选择' } });
  231. return;
  232. }
  233. if (selectList.length === 0) {
  234. this.setState({ showWarn: true, warn: { title: '组卷练习', content: '不可同时选中语文题和数学题,请重新选择。' } });
  235. return;
  236. }
  237. this.setState({ showGroupConfirm: true, groupInfo: { questionNoIds: selectList } });
  238. break;
  239. case 'export':
  240. if (!info.vip) {
  241. this.setState({ showVip: true });
  242. return;
  243. }
  244. if (selectList.length < 1) {
  245. this.setState({ showWarn: true, warn: { title: '导出', content: '不可小于1题,请重新选择' } });
  246. return;
  247. }
  248. if (selectList.length > 100) {
  249. this.setState({ showWarn: true, warn: { title: '导出', content: '不可多余100题,请重新选择' } });
  250. return;
  251. }
  252. if (info.bindReal) {
  253. this.setState({ showExportConfirm: true, exportInfo: { info: exportType.map(row => row.key), questionNoIds: selectList } });
  254. } else {
  255. this.setState({ showExportAuthConfirm: true, exportInfo: { info: exportType.filter(row => !row.auth).map(row => row.key), questionNoIds: selectList } });
  256. }
  257. break;
  258. default:
  259. }
  260. }
  261. clearCollectQuestion() {
  262. const { exportInfo } = this.state;
  263. My.clearQuestionCollect(exportInfo.questionNoIds)
  264. .then(() => {
  265. this.refresh();
  266. })
  267. .then(e => {
  268. this.setState({ warn: { title: '移除', content: e.message }, showClearCollectConfirm: false });
  269. });
  270. }
  271. group() {
  272. const { groupInfo } = this.state;
  273. My.groupQuestionCollect(groupInfo)
  274. .then((result) => {
  275. Question.startLink('collect', result);
  276. this.setState({ showGroupConfirm: false });
  277. })
  278. .catch(e => {
  279. this.setState({ warn: { title: '组卷练习', content: e.message }, showGroupConfirm: false });
  280. });
  281. }
  282. export() {
  283. const { exportInfo } = this.state;
  284. this.setState({ showExportWait: true, showExportConfirm: false, showExportAuthConfirm: false });
  285. My.exportQuestion(exportInfo)
  286. .then((result) => {
  287. openLink(`/export/${result.id}`);
  288. this.setState({ showExportWait: false });
  289. })
  290. .catch(e => {
  291. this.setState({ warn: { title: '导出', content: e.message }, showExportWait: false });
  292. });
  293. }
  294. collectArticle(row, checked) {
  295. if (checked) {
  296. My.addExperienceCollect(row.id).then(() => {
  297. this.refresh();
  298. });
  299. } else {
  300. My.delExperienceCollect(row.id).then(() => {
  301. this.refresh();
  302. });
  303. }
  304. }
  305. prevArticle() {
  306. const { list, article } = this.state;
  307. let index = -1;
  308. list.forEach((row, i) => {
  309. if (row.id === article.id) {
  310. index = i;
  311. }
  312. });
  313. if (index === 0) return;
  314. this.setState({ article: list[index - 1] });
  315. }
  316. nextArticle() {
  317. const { list, article } = this.state;
  318. let index = -1;
  319. list.forEach((row, i) => {
  320. if (row.id === article.id) {
  321. index = i;
  322. }
  323. });
  324. if (index === list.length - 1) return;
  325. this.setState({ article: list[index + 1] });
  326. }
  327. renderView() {
  328. const { config } = this.props;
  329. return <UserLayout active={config.key} menu={menu} center={this.renderTable()} />;
  330. }
  331. renderTable() {
  332. const { tab } = this.state;
  333. return (
  334. <div className="table-layout">
  335. <Tabs
  336. border
  337. type="division"
  338. theme="theme"
  339. size="small"
  340. space={2.5}
  341. width={100}
  342. active={tab}
  343. tabs={[{ key: 'question', title: '题目' }, { key: 'article', title: '文章' }]}
  344. onChange={key => this.onTabChange(key)}
  345. />
  346. {this[`renderTab${tab}`]()}
  347. {this.renderModal()}
  348. </div>
  349. );
  350. }
  351. renderTabquestion() {
  352. const { info } = this.props.user;
  353. const {
  354. questionSubjectSelect,
  355. questionSubjectMap = {},
  356. moduleSelect,
  357. filterMap = {},
  358. sortMap = {},
  359. list = [],
  360. } = this.state;
  361. const { selectList = [], allChecked, page, total } = this.state;
  362. return (
  363. <div className="tab-1-layout">
  364. <UserAction
  365. search
  366. defaultSearch={filterMap.keyword}
  367. selectList={[
  368. {
  369. children: [
  370. {
  371. key: 'subject',
  372. placeholder: '学科',
  373. select: questionSubjectSelect,
  374. },
  375. {
  376. placeholder: '题型',
  377. key: 'questionType',
  378. be: 'subject',
  379. selectMap: questionSubjectMap,
  380. },
  381. ],
  382. },
  383. {
  384. label: '范围',
  385. key: 'module',
  386. select: moduleSelect,
  387. },
  388. {
  389. right: true,
  390. key: 'timerange',
  391. select: TimeRange,
  392. },
  393. ]}
  394. filterMap={filterMap}
  395. onFilter={value => this.onFilter(value)}
  396. onSearch={value => this.onSearch(value)}
  397. />
  398. <UserAction
  399. allCheckbox
  400. allChecked={allChecked}
  401. help
  402. btnList={[
  403. { title: '移除', key: 'clear' },
  404. { title: '组卷', key: 'group', tag: 'vip', disabled: !info.vip },
  405. { title: '导出', key: 'export', tag: 'vip', disabled: !info.vip },
  406. ]}
  407. onAll={checked => this.onAll(checked)}
  408. onAction={key => this.onAction(key)}
  409. />
  410. <UserTable
  411. select
  412. columns={columns}
  413. sortMap={sortMap}
  414. data={list}
  415. current={page}
  416. pageSize={this.state.search.size}
  417. total={total}
  418. selectList={selectList}
  419. onSelect={l => this.onSelect(l)}
  420. onSort={v => this.onSort(v)}
  421. onChange={p => this.onChangePage(p)}
  422. />
  423. </div>
  424. );
  425. }
  426. renderTabarticle() {
  427. const { filterMap = {}, sortMap = {}, list = [] } = this.state;
  428. return (
  429. <div className="tab-1-layout">
  430. <UserAction
  431. sortList={[
  432. {
  433. key: 'create_time',
  434. label: '收藏时间',
  435. },
  436. {
  437. key: 'update_time',
  438. label: '更新时间',
  439. },
  440. ]}
  441. sortMap={sortMap}
  442. filterMap={filterMap}
  443. onFilter={value => this.onFilter(value)}
  444. onSort={value => this.onSort(value)}
  445. />
  446. {list.map(item => {
  447. return <Article data={item} onClick={() => this.setState({ showDetail: true, article: item })} onUnCollect={() => this.collectArticle(item, false)} />;
  448. })}
  449. </div>
  450. );
  451. }
  452. renderModal() {
  453. const { article = {}, showTips, showWarn, warn = {}, showClearCollectConfirm, clearInfo = {}, showGroupConfirm, groupInfo = {}, showExportConfirm, showExportAuthConfirm, exportInfo = {}, showExportWait, showExamination, showVip, showReal } = this.state;
  454. const { info } = this.props.user;
  455. return [
  456. <ArticleDetail show={this.state.showDetail} data={article} onClose={() => this.setState({ showDetail: false })} onPrev={() => this.prevArticle()} onNext={() => this.nextArticle()} />,
  457. <Modal show={showTips} title="操作提示" confirmText="好的,知道了" btnAlign="center" onConfirm={() => this.setState({ showTips: false })}>
  458. <div className="flex-layout m-b-2">
  459. <div className="flex-block">
  460. <div className="t-1 t-s-18">组卷功能</div>
  461. <div className="t-2">操作数量:10-50;</div>
  462. <div className="t-2">注意事项:可跨题型、不可跨学科。</div>
  463. </div>
  464. <div className="flex-block">
  465. <div className="t-1 t-s-18">导出功能</div>
  466. <div className="t-2">操作数量:1-100;</div>
  467. <div className="t-2">注意事项:“综合推理IR”暂时无法导出。</div>
  468. </div>
  469. </div>
  470. <div className="t-3">
  471. *您可点击
  472. <Icon type="question-circle" theme="filled" />
  473. 查阅以上信息。
  474. </div>
  475. </Modal>,
  476. <Modal show={showWarn} title={warn.title} confirmText="好的,知道了" btnAlign="center" onConfirm={() => this.setState({ showWarn: false })}>
  477. <div className="t-2 t-s-18">{warn.content}</div>
  478. </Modal>,
  479. <Modal show={showGroupConfirm} title="组卷练习" confirmText="开始练习" onConfirm={() => this.group()} onCancel={() => this.setState({ showGroupConfirm: false })}>
  480. <div className="t-2 t-s-18">
  481. 您共选择了 <span className="t-4">{groupInfo.questionNoIds ? groupInfo.questionNoIds.length : 0}</span> 道题目,是否开始练习?
  482. </div>
  483. <div className="t-2 t-s-16">
  484. <Checkbox checked className="m-r-5" />
  485. 剔除已组卷练习 <Select
  486. theme="white"
  487. value={groupInfo.filterTimes}
  488. list={[{ key: 2, title: '2' }, { key: 3, title: '3' }]}
  489. onChange={(key) => {
  490. groupInfo.filterTimes = key;
  491. this.setState({ groupInfo });
  492. }}
  493. />{' '}
  494. 次以上的错题
  495. </div>
  496. </Modal>,
  497. <Modal show={showClearCollectConfirm} title="移出" onConfirm={() => this.clearCollectQuestion()} onCancel={() => this.setState({ showClearCollectConfirm: false })}>
  498. <div className="t-2 t-s-18">
  499. 当前选中的 <span className="t-4">{clearInfo.questionNoIds ? clearInfo.questionNoIds.length : 0}</span> 道题即将被移出收藏,移出后无法恢复,是否继续?
  500. </div>
  501. </Modal>,
  502. <Modal show={showExportWait} title="导出" confirmText="好的,知道了" btnAlign="center" onConfirm={() => this.setState({ showExportWait: false })}>
  503. <div className="t-2 t-s-18">正在下载中,请不要关闭当前页面!</div>
  504. </Modal>,
  505. <Modal show={showExportConfirm} title="导出" confirmText="导出" onConfirm={() => this.export()} onCancel={() => this.setState({ showExportConfirm: false })}>
  506. <div className="t-2 t-s-18 m-b-5">
  507. 当前共选中 <span className="t-4">{exportInfo.questionNoIds ? exportInfo.questionNoIds.length : 0}</span> 道题,请确认需要导出的内容:
  508. </div>
  509. <div className="t-2 t-s-16">
  510. {exportType.map(item => {
  511. return (
  512. <div className="d-i-b m-b-5" style={{ width: 135 }}>
  513. <Checkbox checked={exportInfo.info ? exportInfo.info.indexOf(item.key) >= 0 : false} className="m-r-5" onChange={() => {
  514. const index = exportInfo.info.indexOf(item.key);
  515. if (index >= 0) {
  516. exportInfo.info.splice(index, 1);
  517. } else {
  518. exportInfo.info.push(item.key);
  519. }
  520. this.setState({ exportInfo });
  521. }} />
  522. {item.title}
  523. </div>
  524. );
  525. })}
  526. </div>
  527. </Modal>,
  528. <Modal show={showExportAuthConfirm} title="导出" confirmText="导出" onConfirm={() => this.export()} onCancel={() => this.setState({ showExportAuthConfirm: false })}>
  529. <div className="t-2 t-s-18 m-b-5">
  530. 当前共选中 <span className="t-4">{exportInfo.questionNoIds ? exportInfo.questionNoIds.length : 0}</span> 道题,请确认需要导出的内容:
  531. </div>
  532. <div className="t-2 t-s-16 m-b-2">
  533. {exportType
  534. .filter(item => !item.auth)
  535. .map(item => {
  536. return (
  537. <div className="d-i-b m-b-2" style={{ width: 135 }}>
  538. <Checkbox checked={exportInfo.info ? exportInfo.info.indexOf(item.key) >= 0 : false} className="m-r-5" onChange={() => {
  539. const index = exportInfo.info.indexOf(item.key);
  540. if (index >= 0) {
  541. exportInfo.info.splice(index, 1);
  542. } else {
  543. exportInfo.info.push(item.key);
  544. }
  545. this.setState({ exportInfo });
  546. }} />
  547. {item.title}
  548. </div>
  549. );
  550. })}
  551. </div>
  552. <div className="b-b m-b-2 m-t-2" />
  553. <div className="t-3 m-b-1">
  554. 以下内容需实名认证后才可导出: <a className="f-r" onClick={() => this.setState({ showExportAuthConfirm: false, showReal: true })}>去认证 ></a>
  555. </div>
  556. <div className="t-2 t-s-16 m-b-2">
  557. {exportType
  558. .filter(item => item.auth)
  559. .map(item => {
  560. return (
  561. <div className="d-i-b" style={{ width: 135 }}>
  562. <Checkbox disabled className="m-r-5" />
  563. {item.title}
  564. </div>
  565. );
  566. })}
  567. </div>
  568. </Modal>,
  569. <Examination
  570. show={showExamination}
  571. data={info}
  572. onConfirm={() => this.setState({ showExamination: false })}
  573. onCancel={() => this.setState({ showExamination: false })}
  574. onClose={() => this.setState({ showExamination: false })}
  575. />,
  576. <RealAuth show={showReal} data={info} onConfirm={() => this.setState({ showReal: false })} />,
  577. <VipRenew
  578. show={showVip}
  579. data={info}
  580. onReal={() => this.setState({ showVip: false, showReal: true })}
  581. onPrepare={() => this.setState({ showVip: false, showExamination: true })}
  582. onClose={() => this.setState({ showVip: false })}
  583. />,
  584. ];
  585. }
  586. }
  587. class ArticleDetail extends Component {
  588. render() {
  589. const { show, data, onClose, onPrev, onNext } = this.props;
  590. return (
  591. <Modal
  592. className="article-detail-modal"
  593. body={false}
  594. show={show}
  595. width={720}
  596. maskClosable
  597. close={false}
  598. onClose={onClose}
  599. center
  600. >
  601. <Icon type="left" className="prev" onClick={() => onPrev && onPrev()} />
  602. <Icon type="right" className="next" onClick={() => onNext && onNext()} />
  603. <div className="t-1 t-s-20 m-b-5">{data.title}</div>
  604. <div className="t-1 t-s-12 m-b-2">
  605. <span className="m-r-2">{data.user ? data.user.nickname : data.nickname}</span>
  606. <span className="m-r-2">{PrepareStatusMap[data.prepareStatus]}</span>
  607. <span className="m-r-2">备考:{formatMonth(data.experienceDay, false)}</span>
  608. <span className="m-r-2">{data.experienceScore}分 /提分 {ExperiencePercentMap[data.experiencePercent]}</span>
  609. <span className="t-4">更多信息</span>
  610. </div>
  611. <div className="t-2 t-s-18 detail" dangerouslySetInnerHTML={{ __html: data.content }} />
  612. </Modal>
  613. );
  614. }
  615. }
  616. class Article extends Component {
  617. render() {
  618. const { data, onClick, onUnCollect } = this.props;
  619. return (
  620. <div className="article-item p-t-2 b-b" onClick={() => onClick && onClick()}>
  621. <div className="t-1 t-s-14 f-w-b">
  622. {data.title}
  623. <div className="f-r t-3 t-s-12 f-w-d">
  624. <span>{formatDate(data.updateTime, 'YYYY-MM-DD HH:mm:ss')}</span>
  625. <span className="m-l-2">阅读 {data.viewNumber}</span>
  626. <span className="m-l-2" onClick={() => onUnCollect()}>取消收藏</span>
  627. </div>
  628. </div>
  629. <div className="t-1 t-s-12 m-b-2">
  630. <span className="m-r-2">{data.user ? data.user.nickname : data.nickname}</span>
  631. <span className="m-r-2">{PrepareStatusMap[data.prepareStatus]}</span>
  632. <span className="m-r-2">备考:{formatMonth(data.experienceDay, false)}</span>
  633. <span className="m-r-2">{data.experienceScore}分 /提分 {ExperiencePercentMap[data.experiencePercent]}</span>
  634. </div>
  635. <div className="t-2 m-b-2 detail" dangerouslySetInnerHTML={{ __html: data.content }} />
  636. </div>
  637. );
  638. }
  639. }