index.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. import React, { Component } from 'react';
  2. import './index.less';
  3. import { Icon } from 'antd';
  4. import { SpecialRadioGroup } from '../Radio';
  5. import Modal from '../Modal';
  6. import Button from '../Button';
  7. import TotalSort from '../TotalSort';
  8. import Date from '../Date';
  9. import Ratio from '../Ratio';
  10. export default class extends Component {
  11. constructor(props) {
  12. super(props);
  13. this.stepProp = {
  14. 0: {
  15. title: '我的身份',
  16. },
  17. 1: {
  18. title: '下次考试时间',
  19. },
  20. 2: {
  21. title: '目标成绩',
  22. },
  23. 3: {
  24. title: '最晚出分时间(选填)',
  25. },
  26. 4: {
  27. title: '备考信息',
  28. onConfirm: props.onConfirm,
  29. onCancel: props.onCancel,
  30. confirmText: '关闭',
  31. cancelText: '修改',
  32. },
  33. };
  34. this.state = { step: 0, data: { type: '1', time: '1' } };
  35. }
  36. onChange(type, key) {
  37. const { data, step } = this.state;
  38. data[type] = key;
  39. this.setState({ data, step: step + 1 });
  40. }
  41. onPrev() {
  42. const { step } = this.state;
  43. this.setState({ step: step - 1 });
  44. }
  45. onNext() {
  46. const { step } = this.state;
  47. this.setState({ step: step + 1 });
  48. }
  49. render() {
  50. const { step } = this.state;
  51. const { show, onClose } = this.props;
  52. return (
  53. <Modal
  54. className="examination-modal"
  55. show={show}
  56. width={460}
  57. {...this.stepProp[step]}
  58. onClose={() => onClose && onClose()}
  59. >
  60. <div className="examination-modal-wrapper">{this[`renderStep${step}`]()}</div>
  61. </Modal>
  62. );
  63. }
  64. renderStep0() {
  65. const { data } = this.state;
  66. const { type } = data;
  67. return (
  68. <div className="step-0-layout">
  69. <SpecialRadioGroup
  70. list={[
  71. { label: '学生-Domestic', value: '1' },
  72. { label: '学生-Overseas', value: '2' },
  73. { label: '在职-Domestic', value: '3' },
  74. { label: '在职-Overseas', value: '4' },
  75. { label: 'Gap Year', value: '5' },
  76. ]}
  77. value={type}
  78. width={190}
  79. space={10}
  80. onChange={key => this.onChange('type', key)}
  81. />
  82. <div className="action-layout">
  83. <div className="next" onClick={() => this.onNext()}>
  84. 下一题
  85. <Icon type="right-circle" theme="filled" />
  86. </div>
  87. </div>
  88. </div>
  89. );
  90. }
  91. renderStep1() {
  92. const { data } = this.state;
  93. const { time } = data;
  94. return (
  95. <div className="step-1-layout">
  96. <SpecialRadioGroup
  97. list={[
  98. { label: '近1个月', value: '1' },
  99. { label: '近2个月', value: '2' },
  100. { label: '近3个月', value: '3' },
  101. { label: '半年内', value: '4' },
  102. ]}
  103. value={time}
  104. width={195}
  105. space={10}
  106. onChange={key => this.onChange('time', key)}
  107. />
  108. <div className="action-layout">
  109. <div className="prev" onClick={() => this.onPrev()}>
  110. <Icon type="left-circle" theme="filled" />
  111. 上一题
  112. </div>
  113. <div className="next" onClick={() => this.onNext()}>
  114. 下一题
  115. <Icon type="right-circle" theme="filled" />
  116. </div>
  117. </div>
  118. </div>
  119. );
  120. }
  121. renderStep2() {
  122. return (
  123. <div className="step-2-layout">
  124. <TotalSort />
  125. <div className="action-layout">
  126. <div className="prev" onClick={() => this.onPrev()}>
  127. <Icon type="left-circle" theme="filled" />
  128. 上一题
  129. </div>
  130. <div className="next" onClick={() => this.onNext()}>
  131. 下一题
  132. <Icon type="right-circle" theme="filled" />
  133. </div>
  134. </div>
  135. </div>
  136. );
  137. }
  138. renderStep3() {
  139. return (
  140. <div className="step-3-layout">
  141. <Date />
  142. <div className="action-layout">
  143. <div className="prev" onClick={() => this.onPrev()}>
  144. <Icon type="left-circle" theme="filled" />
  145. 上一题
  146. </div>
  147. <Button size="lager" radius>
  148. 提交
  149. </Button>
  150. </div>
  151. </div>
  152. );
  153. }
  154. renderStep4() {
  155. return (
  156. <div className="step-4-layout">
  157. <div className="tip">
  158. <Icon type="check" />
  159. 7天VIP权限已赠送至您的账户。
  160. </div>
  161. <Ratio
  162. text="身份"
  163. subtext="在职(D)"
  164. values={[
  165. { label: '学生-D; 20%', value: 10, color: '#41A6F3' },
  166. { label: '学生- O; 20%', value: 20, color: '#3F86EA' },
  167. { label: '在职-D; 20%', value: 20, color: '#41A6F3' },
  168. { label: '在职- O; 20%', value: 20, color: '#6DC0FF' },
  169. { label: 'Gap Year; 20%', value: 20, color: '#9BD4FF' },
  170. ]}
  171. />
  172. <Ratio
  173. text="考试时间"
  174. subtext="近1个月"
  175. values={[
  176. { label: '近1个月; 20%', value: 10, color: '#6865FD' },
  177. { label: '近2个月; 20%', value: 20, color: '#322EF2' },
  178. { label: '近3个月; 20%', value: 20, color: '#8F65FF' },
  179. { label: '半年内; 20%', value: 20, color: '#8C8AFF' },
  180. ]}
  181. />
  182. <Ratio
  183. text="目标成绩"
  184. subtext="670分"
  185. values={[
  186. { label: '600+; 20%', value: 10, color: '#2754E0' },
  187. { label: '650+; 20%', value: 20, color: '#3F86EA' },
  188. { label: '700+; 20%', value: 20, color: '#41A6F3' },
  189. { label: '700+; 20%', value: 20, color: '#6DC0FF' },
  190. ]}
  191. />
  192. <Ratio
  193. text="出分日期"
  194. subtext="2019-11"
  195. values={[
  196. { label: '近1个月; 20%', value: 10, color: '#6865FD' },
  197. { label: '近2个月; 20%', value: 20, color: '#322EF2' },
  198. { label: '近3个月; 20%', value: 20, color: '#8F65FF' },
  199. { label: '半年内; 20%', value: 20, color: '#8C8AFF' },
  200. { label: '半年内; 20%', value: 20, color: '#8C8AFF' },
  201. { label: '1年内; 20%', value: 20, color: '#8F65FF' },
  202. { label: '不清楚', value: 20, color: '#C3C1D1' },
  203. ]}
  204. />
  205. </div>
  206. );
  207. }
  208. }