page.js 27 KB

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