page.js 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. import React, { Component } from 'react';
  2. import { Link } from 'react-router-dom';
  3. import './index.less';
  4. import { Tooltip, Icon } from 'antd';
  5. import Page from '@src/containers/Page';
  6. import Assets from '@src/components/Assets';
  7. import UserLayout from '../../../layouts/User';
  8. import Button from '../../../components/Button';
  9. import { Icon as GIcon } from '../../../components/Icon';
  10. import UserTable from '../../../components/UserTable';
  11. import Examination from '../../../components/Examination';
  12. import Tabs from '../../../components/Tabs';
  13. import menu from '../index';
  14. import { BindPhone, BindEmail, EditInfo, RealAuth, EditAvatar, InviteModal } from '../../../components/OtherModal';
  15. import VipRenew from '../../../components/VipRenew';
  16. class LogItem extends Component {
  17. constructor(props) {
  18. super(props);
  19. this.columns = [
  20. { title: '', key: 'title' },
  21. { title: '语法SC', key: 'sc' },
  22. { title: '逻辑CR', key: 'cr' },
  23. { title: '阅读RC', key: 'rc' },
  24. ];
  25. this.state = { open: false };
  26. }
  27. render() {
  28. const { data = {} } = this.props;
  29. const { total = [], detail = [] } = data;
  30. const { open } = this.state;
  31. return (
  32. <div className="log-item">
  33. <div className="total">
  34. {total.map(item => {
  35. return (
  36. <div className="text" style={{ width: item.width }} dangerouslySetInnerHTML={{ __html: item.title }} />
  37. );
  38. })}
  39. </div>
  40. <div className="open">
  41. <GIcon name={open ? 'small-up' : 'small-down'} onClick={() => this.setState({ open: !open })} />
  42. </div>
  43. <div hidden={!open} className="table">
  44. <UserTable size="small" columns={this.columns} data={detail} />
  45. <div className="t-r">
  46. <Link to="">继续练习></Link>
  47. </div>
  48. </div>
  49. </div>
  50. );
  51. }
  52. }
  53. export default class extends Page {
  54. initState() {
  55. return {
  56. showExamination: false,
  57. timeList: [
  58. { title: '长难句', time: '3h60min', ratio: 10, color: '#3C39CC' },
  59. { title: '综合推理IR', time: '3h60min', ratio: 10, color: '#9E9CFF' },
  60. { title: '语法SC', time: '3h60min', ratio: 10, color: '#4292F0' },
  61. { title: '作文AWA', time: '3h60min', ratio: 10, color: '#4374EC' },
  62. { title: '阅读RC', time: '3h60min', ratio: 10, color: '#6865FD' },
  63. { title: '模考', time: '3h60min', ratio: 10, color: '#8D65FD' },
  64. { title: '逻辑CR', time: '3h60min', ratio: 10, color: '#6BABF6' },
  65. { title: '自由组卷', time: '3h60min', ratio: 10, color: '#7BBEFF' },
  66. { title: '数学Quant', time: '3h60min', ratio: 10, color: '#6BABF6' },
  67. ],
  68. logList: [
  69. {
  70. total: [
  71. { title: '<span>练习和订正</span>', width: 130 },
  72. { title: '<b>60</b>min', width: 90 },
  73. { title: '<b>30</b>题', width: 80 },
  74. { title: '超过了<b>30%</b>的用户' },
  75. ],
  76. detail: [
  77. { title: '做题数', sc: '10', cr: '10', rc: '20' },
  78. { title: '平均正确率', sc: '86%', cr: '86%', rc: '86%' },
  79. { title: '平均用时', sc: '1min', cr: '1min20s', rc: '1min' },
  80. ],
  81. },
  82. {
  83. total: [
  84. { title: '<span>模考和订正</span>', width: 130 },
  85. { title: '<b>60</b>min', width: 90 },
  86. { title: '<b>30</b>套卷', width: 80 },
  87. { title: '超过了<b>30%</b>的用户' },
  88. ],
  89. detail: [
  90. { title: '做题数', sc: '10', cr: '10', rc: '20' },
  91. { title: '平均正确率', sc: '86%', cr: '86%', rc: '86%' },
  92. { title: '平均用时', sc: '1min', cr: '1min20s', rc: '1min' },
  93. ],
  94. },
  95. {
  96. total: [
  97. { title: '<span>课程学习</span>', width: 130 },
  98. { title: '<b>60</b>min', width: 90 },
  99. { title: '<b>30</b>课', width: 80 },
  100. { title: '超过了<b>30%</b>的用户' },
  101. ],
  102. detail: [
  103. { title: '做题数', sc: '10', cr: '10', rc: '20' },
  104. { title: '平均正确率', sc: '86%', cr: '86%', rc: '86%' },
  105. { title: '平均用时', sc: '1min', cr: '1min20s', rc: '1min' },
  106. ],
  107. },
  108. ],
  109. };
  110. }
  111. renderView() {
  112. const { config } = this.props;
  113. return (
  114. <UserLayout
  115. active={config.key}
  116. menu={menu}
  117. center={[this.renderTotal(), this.renderLog(), this.renderTime()]}
  118. right={[this.renderInfo(), this.renderMessage()]}
  119. />
  120. );
  121. }
  122. renderTotal() {
  123. return <div className="total-layout">1</div>;
  124. }
  125. renderLog() {
  126. const { logList = [] } = this.state;
  127. return (
  128. <div className="log-layout">
  129. <div className="header">
  130. <div className="title">学习记录</div>
  131. <div className="right">
  132. <span>
  133. 本周学习时间<b>23</b>Hour
  134. </span>
  135. <span>
  136. 同比上周<b>15</b>% <Assets name="up" />
  137. </span>
  138. <span>
  139. 同比全站<b>15</b>% <Assets name="down" />
  140. </span>
  141. </div>
  142. </div>
  143. <div className="action">
  144. <Tabs
  145. className="d-i-b"
  146. type="tag"
  147. width={54}
  148. space={5}
  149. value={'1'}
  150. tabs={[{ title: '123', key: '1' }, { title: '123', key: '1' }, { title: '123', key: '1' }]}
  151. />
  152. <Assets className="right" name="calendar" />
  153. </div>
  154. {logList.map((log, index) => {
  155. return <LogItem key={index} data={log} />;
  156. })}
  157. </div>
  158. );
  159. }
  160. renderTime() {
  161. const { timeList = [] } = this.state;
  162. return (
  163. <div className="time-layout">
  164. <div className="header">
  165. <div className="title">
  166. 时间分配
  167. <Tooltip overlayClassName="gray" title="包括听课、练习与订正">
  168. <Icon type="question-circle" theme="filled" />
  169. </Tooltip>
  170. </div>
  171. <div className="right">
  172. 自 2019-05-26 ,您已在千行学习<b>23</b>天,累计 <b>32h</b> 30min
  173. </div>
  174. </div>
  175. <div className="body">
  176. <div className="line">
  177. {timeList.map(item => {
  178. return (
  179. <Tooltip overlayClassName="gray" title={`${item.title} ${item.time}`}>
  180. <i style={{ background: item.color, width: `${item.ratio}%` }} />
  181. </Tooltip>
  182. );
  183. })}
  184. </div>
  185. <div className="list">
  186. {timeList.map(item => {
  187. return (
  188. <div className="item">
  189. <div className="color" style={{ background: item.color }} />
  190. <div className="title">{item.title}</div>
  191. <div className="date">{item.time}</div>
  192. </div>
  193. );
  194. })}
  195. </div>
  196. </div>
  197. </div>
  198. );
  199. }
  200. renderInfo() {
  201. const { showExamination } = this.state;
  202. return (
  203. <div className="info-layout">
  204. <div className="body">
  205. <div className="info">
  206. <Assets name="sun_blue" />
  207. <div className="detail">
  208. <div className="name">怕死的胡萝卜 </div>
  209. <div className="id">ID: 2392401 </div>
  210. </div>
  211. </div>
  212. <div className="auth">
  213. <span className="invite">
  214. <Button radius size="small">
  215. 邀请
  216. </Button>
  217. </span>
  218. <Assets name="wechat" />
  219. <Assets name="phone_1" />
  220. <Assets name="realname" />
  221. <Assets name="email" />
  222. <Assets name="information" />
  223. </div>
  224. </div>
  225. <div className="footer">
  226. <Assets className="m-r-5" name="VIP" />
  227. <span className="date">2019-10-15到期</span>
  228. <Link to="">续费</Link>
  229. </div>
  230. <Examination
  231. show={showExamination}
  232. onConfirm={() => this.setState({ showExamination: false })}
  233. onCancel={() => this.setState({ showExamination: false })}
  234. onClose={() => this.setState({ showExamination: false })}
  235. />
  236. <BindPhone
  237. onConfirm={() => this.setState({ showPhone: false })}
  238. onCancel={() => this.setState({ showPhone: false })}
  239. />
  240. <BindEmail
  241. onConfirm={() => this.setState({ showEmail: false })}
  242. onCancel={() => this.setState({ showEmail: false })}
  243. />
  244. <EditInfo
  245. onConfirm={() => this.setState({ showEdit: false })}
  246. onCancel={() => this.setState({ showEdit: false })}
  247. />
  248. <RealAuth onConfirm={() => this.setState({ showReal: false })} />
  249. <EditAvatar
  250. onConfirm={() => this.setState({ showAvatar: false })}
  251. onCancel={() => this.setState({ showAvatar: false })}
  252. />
  253. <InviteModal onClose={() => this.setState({ showInvite: false })} />
  254. <VipRenew onClose={() => this.setState({ showVip: false })} />
  255. </div>
  256. );
  257. }
  258. renderMessage() {
  259. return (
  260. <div className="message-layout">
  261. <div className="header">
  262. <Assets name="all" />
  263. 全部已读
  264. </div>
  265. <div className="body">
  266. <div className="item">
  267. <div className="title dot">老师回答了您的提问</div>
  268. <div className="date">2019-05-15 16:21:06</div>
  269. <GIcon name="arrow-right-small" onClick={() => {}} />
  270. </div>
  271. <div className="item">
  272. <div className="title dot">老师回答了您的提问</div>
  273. <div className="date">2019-05-15 16:21:06</div>
  274. </div>
  275. </div>
  276. <div className="footer">
  277. <Button radius size="small">
  278. 全部消息
  279. </Button>
  280. </div>
  281. </div>
  282. );
  283. }
  284. }