page.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  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', 'short');
  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 } = this.state;
  194. const { list = [] } = this.state;
  195. if (checked) {
  196. list.forEach(item => {
  197. if (selectList.indexOf(item.key) >= 0) return;
  198. selectList.push(item.key);
  199. });
  200. } else {
  201. list.forEach(item => {
  202. const index = selectList.indexOf(item.key);
  203. if (index < 0) return;
  204. selectList.splice(index, 1);
  205. });
  206. }
  207. this.setState({ selectList, allChecked: checked });
  208. }
  209. onSelect(selectList) {
  210. this.setState({ selectList, allCheckbox: false });
  211. }
  212. onAction(key) {
  213. const { info } = this.props.user;
  214. const { selectList } = this.state;
  215. switch (key) {
  216. case 'help':
  217. this.setState({ showTips: true });
  218. return;
  219. case 'clear':
  220. if (selectList.length === 0) {
  221. this.setState({ showWarn: true, warn: { title: '移除', content: '不可少于1题,请重新选择' } });
  222. return;
  223. }
  224. this.setState({ showClearCollectConfirm: true, clearInfo: { questionNoIds: selectList } });
  225. break;
  226. case 'group':
  227. if (!info.vip) {
  228. this.setState({ showVip: true });
  229. return;
  230. }
  231. if (selectList.length < 10) {
  232. this.setState({ showWarn: true, warn: { title: '组卷练习', content: '不可小于10题,请重新选择' } });
  233. return;
  234. }
  235. if (selectList.length > 50) {
  236. this.setState({ showWarn: true, warn: { title: '组卷练习', content: '不可多余50题,请重新选择' } });
  237. return;
  238. }
  239. if (selectList.length === 0) {
  240. this.setState({ showWarn: true, warn: { title: '组卷练习', content: '不可同时选中语文题和数学题,请重新选择。' } });
  241. return;
  242. }
  243. this.setState({ showGroupConfirm: true, groupInfo: { questionNoIds: selectList } });
  244. break;
  245. case 'export':
  246. if (!info.vip) {
  247. this.setState({ showVip: true });
  248. return;
  249. }
  250. if (selectList.length < 1) {
  251. this.setState({ showWarn: true, warn: { title: '导出', content: '不可小于1题,请重新选择' } });
  252. return;
  253. }
  254. if (selectList.length > 100) {
  255. this.setState({ showWarn: true, warn: { title: '导出', content: '不可多余100题,请重新选择' } });
  256. return;
  257. }
  258. if (info.bindReal) {
  259. this.setState({ showExportConfirm: true, exportInfo: { info: exportType.map(row => row.key), questionNoIds: selectList } });
  260. } else {
  261. this.setState({ showExportAuthConfirm: true, exportInfo: { info: exportType.filter(row => !row.auth).map(row => row.key), questionNoIds: selectList } });
  262. }
  263. break;
  264. default:
  265. }
  266. }
  267. clearCollectQuestion() {
  268. const { exportInfo } = this.state;
  269. My.clearQuestionCollect(exportInfo.questionNoIds)
  270. .then(() => {
  271. this.refresh();
  272. })
  273. .then(e => {
  274. this.setState({ warn: { title: '移除', content: e.message }, showClearCollectConfirm: false });
  275. });
  276. }
  277. group() {
  278. const { groupInfo } = this.state;
  279. My.groupQuestionCollect(groupInfo)
  280. .then((result) => {
  281. Question.startLink('collect', result);
  282. this.setState({ showGroupConfirm: false });
  283. })
  284. .catch(e => {
  285. this.setState({ warn: { title: '组卷练习', content: e.message }, showGroupConfirm: false });
  286. });
  287. }
  288. export() {
  289. const { exportInfo } = this.state;
  290. this.setState({ showExportWait: true, showExportConfirm: false, showExportAuthConfirm: false });
  291. My.exportQuestionCollect(exportInfo)
  292. .then((result) => {
  293. openLink(`/export/${result.id}`);
  294. this.setState({ showExportWait: false });
  295. })
  296. .catch(e => {
  297. this.setState({ warn: { title: '导出', content: e.message }, showExportWait: false });
  298. });
  299. }
  300. collectArticle(row, checked) {
  301. if (checked) {
  302. My.addExperienceCollect(row.id).then(() => {
  303. this.refresh();
  304. });
  305. } else {
  306. My.delExperienceCollect(row.id).then(() => {
  307. this.refresh();
  308. });
  309. }
  310. }
  311. prevArticle() {
  312. const { list, article } = this.state;
  313. let index = -1;
  314. list.forEach((row, i) => {
  315. if (row.id === article.id) {
  316. index = i;
  317. }
  318. });
  319. if (index === 0) return;
  320. this.setState({ article: list[index - 1] });
  321. }
  322. nextArticle() {
  323. const { list, article } = this.state;
  324. let index = -1;
  325. list.forEach((row, i) => {
  326. if (row.id === article.id) {
  327. index = i;
  328. }
  329. });
  330. if (index === list.length - 1) return;
  331. this.setState({ article: list[index + 1] });
  332. }
  333. renderView() {
  334. const { config } = this.props;
  335. return <UserLayout active={config.key} menu={menu} center={this.renderTable()} />;
  336. }
  337. renderTable() {
  338. const { tab } = this.state;
  339. return (
  340. <div className="table-layout">
  341. <Tabs
  342. border
  343. type="division"
  344. theme="theme"
  345. size="small"
  346. space={2.5}
  347. width={100}
  348. active={tab}
  349. tabs={[{ key: 'question', title: '题目' }, { key: 'article', title: '文章' }]}
  350. onChange={key => this.onTabChange(key)}
  351. />
  352. {this[`renderTab${tab}`]()}
  353. {this.renderModal()}
  354. </div>
  355. );
  356. }
  357. renderTabquestion() {
  358. const { info } = this.props.user;
  359. const {
  360. questionSubjectSelect,
  361. questionSubjectMap = {},
  362. moduleSelect,
  363. filterMap = {},
  364. sortMap = {},
  365. list = [],
  366. } = this.state;
  367. const { selectList = [], allChecked, page, total } = this.state;
  368. return (
  369. <div className="tab-1-layout">
  370. <UserAction
  371. search
  372. defaultSearch={filterMap.keyword}
  373. selectList={[
  374. {
  375. children: [
  376. {
  377. key: 'subject',
  378. placeholder: '学科',
  379. select: questionSubjectSelect,
  380. },
  381. {
  382. placeholder: '题型',
  383. key: 'questionType',
  384. be: 'subject',
  385. selectMap: questionSubjectMap,
  386. },
  387. ],
  388. },
  389. {
  390. label: '范围',
  391. key: 'module',
  392. select: moduleSelect,
  393. },
  394. {
  395. right: true,
  396. key: 'timerange',
  397. select: TimeRange,
  398. },
  399. ]}
  400. filterMap={filterMap}
  401. onFilter={value => this.onFilter(value)}
  402. onSearch={value => this.onSearch(value)}
  403. />
  404. <UserAction
  405. allCheckbox
  406. allChecked={allChecked}
  407. help
  408. btnList={[
  409. { title: '移除', key: 'clear' },
  410. { title: '组卷', key: 'group', tag: 'vip', disabled: !info.vip },
  411. { title: '导出', key: 'export', tag: 'vip', disabled: !info.vip },
  412. ]}
  413. onAll={checked => this.onAll(checked)}
  414. onAction={key => this.onAction(key)}
  415. />
  416. <UserTable
  417. select
  418. columns={columns}
  419. sortMap={sortMap}
  420. data={list}
  421. current={page}
  422. pageSize={this.state.search.size}
  423. total={total}
  424. selectList={selectList}
  425. onSelect={l => this.onSelect(l)}
  426. onSort={v => this.onSort(v)}
  427. onChange={p => this.onChangePage(p)}
  428. />
  429. </div>
  430. );
  431. }
  432. renderTabarticle() {
  433. const { filterMap = {}, sortMap = {}, list = [] } = this.state;
  434. return (
  435. <div className="tab-1-layout">
  436. <UserAction
  437. sortList={[
  438. {
  439. key: 'create_time',
  440. label: '收藏时间',
  441. },
  442. {
  443. key: 'update_time',
  444. label: '更新时间',
  445. },
  446. ]}
  447. sortMap={sortMap}
  448. filterMap={filterMap}
  449. onFilter={value => this.onFilter(value)}
  450. onSort={value => this.onSort(value)}
  451. />
  452. {list.map(item => {
  453. return <Article data={item} onClick={() => this.setState({ showDetail: true, article: item })} onUnCollect={() => this.collectArticle(item, false)} />;
  454. })}
  455. </div>
  456. );
  457. }
  458. renderModal() {
  459. const { article = {}, showTips, showWarn, warn = {}, showClearCollectConfirm, clearInfo = {}, showGroupConfirm, groupInfo = {}, showExportConfirm, showExportAuthConfirm, exportInfo = {}, showExportWait, showExamination, showVip, showReal } = this.state;
  460. const { info } = this.props.user;
  461. return [
  462. <ArticleDetail show={this.state.showDetail} data={article} onClose={() => this.setState({ showDetail: false })} onPrev={() => this.prevArticle()} onNext={() => this.nextArticle()} />,
  463. <Modal show={showTips} title="操作提示" confirmText="好的,知道了" btnAlign="center" onConfirm={() => this.setState({ showTips: false })}>
  464. <div className="flex-layout m-b-2">
  465. <div className="flex-block">
  466. <div className="t-1 t-s-18">组卷功能</div>
  467. <div className="t-2">操作数量:10-50;</div>
  468. <div className="t-2">注意事项:可跨题型、不可跨学科。</div>
  469. </div>
  470. <div className="flex-block">
  471. <div className="t-1 t-s-18">导出功能</div>
  472. <div className="t-2">操作数量:1-100;</div>
  473. <div className="t-2">注意事项:“综合推理IR”暂时无法导出。</div>
  474. </div>
  475. </div>
  476. <div className="t-3">
  477. *您可点击
  478. <Icon type="question-circle" theme="filled" />
  479. 查阅以上信息。
  480. </div>
  481. </Modal>,
  482. <Modal show={showWarn} title={warn.title} confirmText="好的,知道了" btnAlign="center" onConfirm={() => this.setState({ showWarn: false })}>
  483. <div className="t-2 t-s-18">{warn.content}</div>
  484. </Modal>,
  485. <Modal show={showGroupConfirm} title="组卷练习" confirmText="开始练习" onConfirm={() => this.group()} onCancel={() => this.setState({ showGroupConfirm: false })}>
  486. <div className="t-2 t-s-18">
  487. 您共选择了 <span className="t-4">{groupInfo.questionNoIds ? groupInfo.questionNoIds.length : 0}</span> 道题目,是否开始练习?
  488. </div>
  489. <div className="t-2 t-s-16">
  490. <Checkbox checked className="m-r-5" />
  491. 剔除已组卷练习 <Select
  492. theme="white"
  493. value={groupInfo.filterTimes}
  494. list={[{ key: 2, title: '2' }, { key: 3, title: '3' }]}
  495. onChange={(key) => {
  496. groupInfo.filterTimes = key;
  497. this.setState({ groupInfo });
  498. }}
  499. />{' '}
  500. 次以上的错题
  501. </div>
  502. </Modal>,
  503. <Modal show={showClearCollectConfirm} title="移出" onConfirm={() => this.clearCollectQuestion()} onCancel={() => this.setState({ showClearCollectConfirm: false })}>
  504. <div className="t-2 t-s-18">
  505. 当前选中的 <span className="t-4">{clearInfo.questionNoIds ? clearInfo.questionNoIds.length : 0}</span> 道题即将被移出收藏,移出后无法恢复,是否继续?
  506. </div>
  507. </Modal>,
  508. <Modal show={showExportWait} title="导出" confirmText="好的,知道了" btnAlign="center" onConfirm={() => this.setState({ showExportWait: false })}>
  509. <div className="t-2 t-s-18">正在下载中,请不要关闭当前页面!</div>
  510. </Modal>,
  511. <Modal show={showExportConfirm} title="导出" confirmText="导出" onConfirm={() => this.export()} onCancel={() => this.setState({ showExportConfirm: false })}>
  512. <div className="t-2 t-s-18 m-b-5">
  513. 当前共选中 <span className="t-4">{exportInfo.questionNoIds ? exportInfo.questionNoIds.length : 0}</span> 道题,请确认需要导出的内容:
  514. </div>
  515. <div className="t-2 t-s-16">
  516. {exportType.map(item => {
  517. return (
  518. <div className="d-i-b m-b-5" style={{ width: 135 }}>
  519. <Checkbox checked={exportInfo.info ? exportInfo.info.indexOf(item.key) >= 0 : false} className="m-r-5" onChange={() => {
  520. const index = exportInfo.info.indexOf(item.key);
  521. if (index >= 0) {
  522. exportInfo.info.splice(index, 1);
  523. } else {
  524. exportInfo.info.push(item.key);
  525. }
  526. this.setState({ exportInfo });
  527. }} />
  528. {item.title}
  529. </div>
  530. );
  531. })}
  532. </div>
  533. </Modal>,
  534. <Modal show={showExportAuthConfirm} title="导出" confirmText="导出" onConfirm={() => this.export()} onCancel={() => this.setState({ showExportAuthConfirm: false })}>
  535. <div className="t-2 t-s-18 m-b-5">
  536. 当前共选中 <span className="t-4">{exportInfo.questionNoIds ? exportInfo.questionNoIds.length : 0}</span> 道题,请确认需要导出的内容:
  537. </div>
  538. <div className="t-2 t-s-16 m-b-2">
  539. {exportType
  540. .filter(item => !item.auth)
  541. .map(item => {
  542. return (
  543. <div className="d-i-b m-b-2" style={{ width: 135 }}>
  544. <Checkbox checked={exportInfo.info ? exportInfo.info.indexOf(item.key) >= 0 : false} className="m-r-5" onChange={() => {
  545. const index = exportInfo.info.indexOf(item.key);
  546. if (index >= 0) {
  547. exportInfo.info.splice(index, 1);
  548. } else {
  549. exportInfo.info.push(item.key);
  550. }
  551. this.setState({ exportInfo });
  552. }} />
  553. {item.title}
  554. </div>
  555. );
  556. })}
  557. </div>
  558. <div className="b-b m-b-2 m-t-2" />
  559. <div className="t-3 m-b-1">
  560. 以下内容需实名认证后才可导出: <a className="f-r" onClick={() => this.setState({ showExportAuthConfirm: false, showReal: true })}>去认证 ></a>
  561. </div>
  562. <div className="t-2 t-s-16 m-b-2">
  563. {exportType
  564. .filter(item => item.auth)
  565. .map(item => {
  566. return (
  567. <div className="d-i-b" style={{ width: 135 }}>
  568. <Checkbox disabled className="m-r-5" />
  569. {item.title}
  570. </div>
  571. );
  572. })}
  573. </div>
  574. </Modal>,
  575. <Examination
  576. show={showExamination}
  577. data={info}
  578. onConfirm={() => this.setState({ showExamination: false })}
  579. onCancel={() => this.setState({ showExamination: false })}
  580. onClose={() => this.setState({ showExamination: false })}
  581. />,
  582. <RealAuth show={showReal} data={info} onConfirm={() => this.setState({ showReal: false })} />,
  583. <VipRenew
  584. show={showVip}
  585. data={info}
  586. onReal={() => this.setState({ showVip: false, showReal: true })}
  587. onPrepare={() => this.setState({ showVip: false, showExamination: true })}
  588. onClose={() => this.setState({ showVip: false })}
  589. />,
  590. ];
  591. }
  592. }
  593. class ArticleDetail extends Component {
  594. render() {
  595. const { show, data, onClose, onPrev, onNext } = this.props;
  596. return (
  597. <Modal
  598. className="article-detail-modal"
  599. body={false}
  600. show={show}
  601. width={720}
  602. maskClosable
  603. close={false}
  604. onClose={onClose}
  605. center
  606. >
  607. <Icon type="left" className="prev" onClick={() => onPrev && onPrev()} />
  608. <Icon type="right" className="next" onClick={() => onNext && onNext()} />
  609. <div className="t-1 t-s-20 m-b-5">{data.title}</div>
  610. <div className="t-1 t-s-12 m-b-2">
  611. <span className="m-r-2">{data.user ? data.user.nickname : data.nickname}</span>
  612. <span className="m-r-2">{PrepareStatusMap[data.prepareStatus]}</span>
  613. <span className="m-r-2">备考:{!!data.experienceDay && formatMonth(data.experienceDay, false)}</span>
  614. <span className="m-r-2">{data.experienceScore}分 /提分 {ExperiencePercentMap[data.experiencePercent]}</span>
  615. {data.link && <a className="t-4" href={data.link} target="_blank">更多信息</a>}
  616. </div>
  617. <div className="t-2 t-s-18 detail" dangerouslySetInnerHTML={{ __html: data.content }} />
  618. </Modal>
  619. );
  620. }
  621. }
  622. class Article extends Component {
  623. render() {
  624. const { data, onClick, onUnCollect } = this.props;
  625. return (
  626. <div className="article-item p-t-2 b-b" onClick={() => onClick && onClick()}>
  627. <div className="t-1 t-s-14 f-w-b">
  628. {data.title}
  629. <div className="f-r t-3 t-s-12 f-w-d">
  630. <span>{formatDate(data.updateTime, 'YYYY-MM-DD HH:mm:ss')}</span>
  631. <span className="m-l-2">阅读 {data.viewNumber}</span>
  632. <span className="m-l-2" onClick={(e) => {
  633. e.stopPropagation();
  634. onUnCollect();
  635. }}>取消收藏</span>
  636. </div>
  637. </div>
  638. <div className="t-1 t-s-12 m-b-2">
  639. <span className="m-r-2">{data.user ? data.user.nickname : data.nickname}</span>
  640. <span className="m-r-2">{PrepareStatusMap[data.prepareStatus]}</span>
  641. <span className="m-r-2">备考:{formatMonth(data.experienceDay, false)}</span>
  642. <span className="m-r-2">{data.experienceScore}分 /提分 {ExperiencePercentMap[data.experiencePercent]}</span>
  643. </div>
  644. <div className="t-2 m-b-2 detail" dangerouslySetInnerHTML={{ __html: data.content }} />
  645. </div>
  646. );
  647. }
  648. }