page.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. import React from 'react';
  2. import './index.less';
  3. import Assets from '@src/components/Assets';
  4. import Page from '@src/containers/Page';
  5. import Footer from '../../../components/Footer';
  6. import { Contact } from '../../../components/Other';
  7. import Select from '../../../components/Select';
  8. import Modal from '../../../components/Modal';
  9. import { Button } from '../../../components/Button';
  10. export default class extends Page {
  11. constructor(props) {
  12. super(props);
  13. this.state = { open: false, showTip: true };
  14. this.keyMap = {};
  15. window.onkeydown = this.onKeydown.bind(this);
  16. window.onkeyup = this.onKeyup.bind(this);
  17. }
  18. onKeydown(e) {
  19. let active = false;
  20. if (this.keyMap[e.keyCode]) return false;
  21. switch (e.keyCode) {
  22. case 32:
  23. active = true;
  24. break;
  25. case 37:
  26. active = true;
  27. break;
  28. case 39:
  29. active = true;
  30. break;
  31. default:
  32. break;
  33. }
  34. if (active) {
  35. this.keyMap[e.keyCode] = true;
  36. return false;
  37. }
  38. return true;
  39. }
  40. onKeyup(e) {
  41. let active = false;
  42. switch (e.keyCode) {
  43. case 32:
  44. active = true;
  45. this.onOpen();
  46. break;
  47. case 37:
  48. active = true;
  49. this.onPrev();
  50. break;
  51. case 39:
  52. active = true;
  53. this.onNext();
  54. break;
  55. default:
  56. break;
  57. }
  58. if (active) {
  59. this.keyMap[e.keyCode] = false;
  60. return false;
  61. }
  62. return true;
  63. }
  64. onOpen() {
  65. this.setState({ open: !this.state.open });
  66. }
  67. onNext() {}
  68. onPrev() {}
  69. renderView() {
  70. const { showTip } = this.state;
  71. return (
  72. <div>
  73. <div className="top content t-8">
  74. 机经 > 本期机经 > <span className="t-1">逻辑</span>
  75. <Select className="f-r m-t-1" size="small" theme="white" value={'1'} list={[{ title: '123', key: '1' }]} />
  76. </div>
  77. <div className="center content">
  78. <div className="t-1 t-s-18 m-b-1">【逻辑】0515 起逻辑机经整理</div>
  79. {this.renderDetail()}
  80. <Assets className="prev" name="footer_previous_highlight_1" onClick={() => this.onPrev()} />
  81. <Assets className="next" name="footer_next_highlight_1" onClick={() => this.onNext()} />
  82. </div>
  83. <Contact />
  84. <Footer />
  85. <Modal
  86. show={showTip}
  87. title="提示"
  88. onConfirm={() => this.setState({ showTip: false })}
  89. confirmText="好的,知道了"
  90. btnAlign="center"
  91. >
  92. <div className="t-2 t-s-18">敲击键盘← →可翻页;</div>
  93. <div className="t-2 t-s-18">敲击空格键第一次查看解析,敲击空格键第二次收起解析。</div>
  94. </Modal>
  95. </div>
  96. );
  97. }
  98. renderDetail() {
  99. const { open } = this.state;
  100. return (
  101. <div className="detail">
  102. <div className="m-b-1">
  103. <span className="t-1 t-s-18 m-r-1">NO.34 题目题目题目</span>
  104. <span className="t-3 t-s-12">2019-02-21 19:19:20</span>
  105. <Button radius className="f-r" onClick={() => this.onOpen()}>
  106. {open ? '收起' : '展开'}解析
  107. </Button>
  108. </div>
  109. <div className="t-2 t-s-16 m-b-2">
  110. GMAT考试由分析写作、推理、数学和语文四部分组成。分别为: a)分析性写作评价(Analytical Writing
  111. Assessment)A:GMAT考试由分析写作、推理、数学和语文四部分组成。分别为: a)分析性写作评价(Analytical Writing
  112. Assessment)GMAT考试由分析写作、推理、数学和语文四部分组成。分别为: a)分析性写作评价(Analytical Writing
  113. Assessment)A:GMAT考试由分析写作、推理、数学和语文四部分组成。分别为: a)分析性写作评价(Analytical Writing
  114. Assessment)A:GMAT考试由分析写作、推理、数学和语文四部分组成。分别为: a)分析性写作评价
  115. </div>
  116. <div hidden={!open} className="p-20 b-c-3">
  117. <div className="t t-1 t-s-16 f-w-b m-b-5">官方解析</div>
  118. <div className="t-1 t-s-16">
  119. A.By whom they were supposedly named is a passive construction that is unnecessarily indirect and wordy,
  120. especially immediately following another passive construction; the singular its does not agree with the
  121. plural antecedent the Glass House Mountains. B.This version of the sentence loses the causal connection,
  122. failing to explain why James Cook gave the mountains their particular name. C.As the object of a preposition
  123. and not the subject of the clause, James Cook does not work as the noun that the verbal phrase beginning
  124. with naming can describe; the preposition since loses the important causal logic of the sentence. D.Correct.
  125. This concise sentence uses active- voice construction in the relative clause and maintains agreement between
  126. the pronoun their and its antecedent. E The pronoun it does not agree with the plural Mountains and the
  127. following pronoun their.
  128. </div>
  129. </div>
  130. </div>
  131. );
  132. }
  133. }