page.js 26 KB

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