page.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. import React from 'react';
  2. import './index.less';
  3. import Page from '@src/containers/Page';
  4. import Tabs from '../../../components/Tabs';
  5. import Icon from '../../../components/Icon';
  6. import Switch from '../../../components/Switch';
  7. import AnswerList from '../../../components/AnswerList';
  8. import AnswerButton from '../../../components/AnswerButton';
  9. export default class extends Page {
  10. constructor(props) {
  11. super(props);
  12. this.state = { hideAnalysis: true };
  13. }
  14. renderView() {
  15. return (
  16. <div className="layout">
  17. <div className="layout-header">
  18. <div className="left">
  19. <div className="no">No.36</div>
  20. <div className="title">OG18 - Easy (21-40) </div>
  21. </div>
  22. <div className="center">
  23. ID:PREP 07-124
  24. <Icon name="more" />
  25. </div>
  26. <div className="right">
  27. <span className="b">
  28. 用时:<span className="s">1</span>m<span className="s">39</span>s
  29. </span>
  30. <span className="b">
  31. 全站:<span className="s">1</span>m<span className="s">39</span>s
  32. </span>
  33. <span className="b">
  34. <span className="s">80</span>%
  35. </span>
  36. <Icon name="question" />
  37. <Icon name="star" />
  38. </div>
  39. </div>
  40. <div className="layout-body">{this.renderBody()}</div>
  41. <div className="layout-footer">
  42. <div className="left">
  43. <Icon name="sceen-full" />
  44. </div>
  45. <div className="center">
  46. <AnswerButton className="item">笔记</AnswerButton>
  47. <AnswerButton className="item">提问</AnswerButton>
  48. <AnswerButton className="item">纠错</AnswerButton>
  49. </div>
  50. <div className="right">
  51. <Icon name="prev" />
  52. <Icon name="next" />
  53. </div>
  54. </div>
  55. {this.renderModal()}
  56. </div>
  57. );
  58. }
  59. renderBody() {
  60. const { question = { content: {} } } = this.state;
  61. const { typeset = 'one' } = question.content;
  62. return (
  63. <div className="layout-content">
  64. <div className={`${typeset}`}>
  65. {this.renderContent()}
  66. {this.renderAnswer()}
  67. </div>
  68. {this.renderAnalysis()}
  69. </div>
  70. );
  71. }
  72. renderAnalysis() {
  73. const { question = { content: {} } } = this.state;
  74. const { typeset = 'one' } = question.content;
  75. const { hideAnalysis } = this.state;
  76. const show = typeset === 'one' ? true : !hideAnalysis;
  77. return (
  78. <div className={`block block-analysis ${!show ? 'hide' : ''}`}>
  79. <Tabs
  80. type="card"
  81. active="1"
  82. tabs={[
  83. { key: '1', name: '官方解析', path: '/' },
  84. { key: '2', name: '千行解析', path: '/' },
  85. { key: '3', name: '题源联想', path: '/' },
  86. { key: '4', name: '相关回答', path: '/' },
  87. ]}
  88. />
  89. <div className="detail">
  90. “Offering support services to spouses caring for their other halves may reduce martial stress and prevent
  91. divorce at older ages,” she said. “But it’s also important to recognize that the pressure to divorce may be
  92. health-related and that sick ex-wives may need additional care and services to prevent worsening health and
  93. increased health costs.”
  94. </div>
  95. </div>
  96. );
  97. }
  98. renderAnswer() {
  99. const { question = { content: {} } } = this.state;
  100. const { typeset = 'one' } = question.content;
  101. const { hideAnalysis } = this.state;
  102. const show = typeset === 'one' ? true : hideAnalysis;
  103. return (
  104. <div className={`block block-answer ${!show ? 'hide' : ''}`}>
  105. {typeset === 'two' ? <Switch>显示答案</Switch> : ''}
  106. </div>
  107. );
  108. }
  109. renderContent() {
  110. const { question = { content: {} } } = this.state;
  111. const { typeset = 'one' } = question.content;
  112. return (
  113. <div className="block block-content">
  114. {typeset === 'one' ? <Switch>显示答案</Switch> : ''}
  115. <AnswerList
  116. selected={1}
  117. answer={2}
  118. show
  119. list={[
  120. { text: ' They can become increasingly vulnerable to serious illness.' },
  121. { text: ' They can become increasingly vulnerable to serious illness.' },
  122. { text: ' They can become increasingly vulnerable to serious illness.' },
  123. { text: ' They can become increasingly vulnerable to serious illness.' },
  124. ]}
  125. />
  126. </div>
  127. );
  128. }
  129. renderModal() {
  130. return (
  131. <div className="modal">
  132. <div className="mask" />
  133. <div className="body">
  134. <div className="title">提问</div>
  135. <div className="desc">
  136. <div className="select">我想对进行提问</div>
  137. <div className="label">有疑问的具体内容是:</div>
  138. <textarea className="textarea" placeholder="请复制粘贴有疑问的内容。" />
  139. <div className="label">针对以上内容的问题是:</div>
  140. <textarea className="textarea" placeholder="提问频率高的问题会被优先回答哦。" />
  141. </div>
  142. <div className="bottom">
  143. <AnswerButton theme="cancel" size="lager">
  144. 取消
  145. </AnswerButton>
  146. <AnswerButton size="lager">提交</AnswerButton>
  147. </div>
  148. </div>
  149. </div>
  150. );
  151. }
  152. }