page.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. import React, { Component } from 'react';
  2. import './index.less';
  3. import Page from '@src/containers/Page';
  4. import { formatDate, formatMonth, getMap } from '@src/services/Tools';
  5. import Ratio from '../../../components/Ratio';
  6. import UserAction from '../../../components/UserAction';
  7. import { PrepareStatus, ExperiencePercent } from '../../../../Constant';
  8. const PrepareStatusMap = getMap(PrepareStatus, 'value', 'label');
  9. const ExperiencePercentMap = getMap(ExperiencePercent, 'value', 'label');
  10. export default class extends Page {
  11. initState() {
  12. return {
  13. tab: '1',
  14. key: '1',
  15. filterMap: {},
  16. list: [{}, {}],
  17. };
  18. }
  19. onChangeTab(tab) {
  20. this.setState({ tab });
  21. }
  22. onChangeItem(key) {
  23. this.setState({ key });
  24. }
  25. renderView() {
  26. return (
  27. <div>
  28. <div className="top content t-8">
  29. 千行课堂 > 全部课程 > OG20综合刷题 > 课时3 > <span className="t-1">心经首页</span>
  30. </div>
  31. {this.renderDetail()}
  32. </div>
  33. );
  34. }
  35. renderDetail() {
  36. const { filterMap, list } = this.state;
  37. return [
  38. <div className="center">
  39. <div className="content">
  40. <div className="total-list">
  41. <div className="total-item">
  42. <div className="title">学员人数</div>
  43. <div className="label">1231431</div>
  44. </div>
  45. <div className="total-item">
  46. <div className="title">考分分布</div>
  47. <Ratio
  48. size="small"
  49. values={[
  50. { color: '#2754E0', label: '750+ 36% 3600人', value: 10 },
  51. { color: '#41A6F3', label: '750+ 36% 3600人', value: 10 },
  52. { color: '#9BD4FF', label: '750+ 36% 3600人', value: 10 },
  53. ]}
  54. />
  55. </div>
  56. <div className="total-item">
  57. <div className="title">出分周期</div>
  58. <div className="label">35天</div>
  59. </div>
  60. <div className="total-item">
  61. <div className="title">考分分布</div>
  62. <Ratio
  63. size="small"
  64. values={[
  65. { color: '#2754E0', label: '750+ 36% 3600人', value: 10 },
  66. { color: '#41A6F3', label: '750+ 36% 3600人', value: 10 },
  67. { color: '#9BD4FF', label: '750+ 36% 3600人', value: 10 },
  68. ]}
  69. />
  70. </div>
  71. </div>
  72. <UserAction
  73. selectList={[
  74. {
  75. children: [
  76. {
  77. key: 'subject',
  78. placeholder: '学科',
  79. select: [],
  80. },
  81. {
  82. placeholder: '题型',
  83. key: 'questionType',
  84. be: 'subject',
  85. selectMap: [],
  86. },
  87. ],
  88. },
  89. {
  90. label: '范围',
  91. children: [
  92. {
  93. key: 'one',
  94. placeholder: '全部',
  95. select: [],
  96. },
  97. {
  98. key: 'two',
  99. be: 'one',
  100. placeholder: '全部',
  101. selectMap: [],
  102. },
  103. ],
  104. },
  105. ]}
  106. filterMap={filterMap}
  107. onFilter={value => this.onFilter(value)}
  108. />
  109. {list.map(item => {
  110. return <Article data={item} onClick={() => {}} onUnCollect={() => this.collectArticle(item, false)} />;
  111. })}
  112. </div>
  113. </div>,
  114. ];
  115. }
  116. }
  117. class Article extends Component {
  118. render() {
  119. const { data, onClick, onCollect } = this.props;
  120. return (
  121. <div className="article-item p-t-2 b-b" onClick={() => onClick && onClick()}>
  122. <div className="t-1 t-s-14 f-w-b">
  123. {data.title}
  124. <div className="f-r t-3 t-s-12 f-w-d">
  125. <span>{formatDate(data.updateTime, 'YYYY-MM-DD HH:mm:ss')}</span>
  126. <span className="m-l-2">阅读 {data.viewNumber}</span>
  127. <span className="m-l-2" onClick={() => onCollect()}>
  128. 收藏
  129. </span>
  130. </div>
  131. </div>
  132. <div className="t-1 t-s-12 m-b-2">
  133. <span className="m-r-2">{data.user ? data.user.nickname : data.nickname}</span>
  134. <span className="m-r-2">{PrepareStatusMap[data.prepareStatus]}</span>
  135. <span className="m-r-2">备考:{formatMonth(data.experienceDay, false)}</span>
  136. <span className="m-r-2">
  137. {data.experienceScore}分 /提分 {ExperiencePercentMap[data.experiencePercent]}
  138. </span>
  139. </div>
  140. <div className="t-2 m-b-2 detail" dangerouslySetInnerHTML={{ __html: data.content }} />
  141. </div>
  142. );
  143. }
  144. }