page.js 27 KB

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