page.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. import React from 'react';
  2. import './index.less';
  3. import { Icon } from 'antd';
  4. import Page from '@src/containers/Page';
  5. import Assets from '@src/components/Assets';
  6. import UserLayout from '../../../layouts/User';
  7. import UserAction from '../../../components/UserAction';
  8. import menu from '../index';
  9. import Tabs from '../../../components/Tabs';
  10. import More from '../../../components/More';
  11. import Button from '../../../components/Button';
  12. import Switch from '../../../components/Switch';
  13. import TotalSort from '../../../components/TotalSort';
  14. import Modal from '../../../components/Modal';
  15. import UserTable from '../../../components/UserTable';
  16. const updateColumns = [
  17. { title: '更新时间', key: '1', width: 120 },
  18. { title: '位置', key: '2', width: 120 },
  19. { title: '原内容', key: '3', width: 120 },
  20. { title: '更改为', key: '4', width: 120 },
  21. { title: '更新至', key: '5', width: 90 },
  22. ];
  23. export default class extends Page {
  24. initState() {
  25. return {
  26. tab: '1',
  27. sortMap: {},
  28. filterMap: {},
  29. data: [
  30. { num: '30', version: '7', title: 'OG16/17/18/19语法千行', date: '2019-08-31 09:26:13' },
  31. { num: '30', version: '7', title: 'OG16/17/18/19语法千行', date: '2019-08-31 09:26:13' },
  32. { num: '30', version: '7', title: 'OG16/17/18/19语法千行', date: '2019-08-31 09:26:13' },
  33. ],
  34. };
  35. }
  36. onFilter(value) {
  37. this.setState({ filterMap: value });
  38. }
  39. onSort(value) {
  40. this.setState({ sortMap: value });
  41. }
  42. onTabChange(tab) {
  43. this.setState({ tab });
  44. }
  45. renderView() {
  46. const { config } = this.props;
  47. return <UserLayout active={config.key} menu={menu} center={this.renderDetail()} />;
  48. }
  49. renderDetail() {
  50. const { tab } = this.state;
  51. return (
  52. <div className="table-layout">
  53. <Tabs
  54. border
  55. type="division"
  56. theme="theme"
  57. size="small"
  58. space={2.5}
  59. width={100}
  60. active={tab}
  61. tabs={[
  62. { key: '1', title: '资料' },
  63. { key: '2', title: '机经' },
  64. { key: '3', title: '模考' },
  65. { key: '4', title: 'VIP' },
  66. { key: '5', title: '考分计算器' },
  67. ]}
  68. onChange={key => this.onTabChange(key)}
  69. />
  70. {this[`renderTab${tab}`]()}
  71. <Modal maskClosable close={false} body={false} width={630} onClose={() => {}}>
  72. <UserTable
  73. size="small"
  74. columns={updateColumns}
  75. data={[
  76. {
  77. 1: '2019-07-12 11:38:51',
  78. 2: 'P30 第 20 行',
  79. 3: 'the number of wolf population',
  80. 4: '删除',
  81. 5: '版本3',
  82. },
  83. {
  84. 1: '2019-07-12 11:38:51',
  85. 2: 'P30 第 20 行',
  86. 3: 'the number of wolf population',
  87. 4: '删除',
  88. 5: '版本3',
  89. },
  90. {
  91. 1: '2019-07-12 11:38:51',
  92. 2: 'P30 第 20 行',
  93. 3: 'the number of wolf population',
  94. 4: '删除',
  95. 5: '版本3',
  96. },
  97. ]}
  98. />
  99. </Modal>
  100. <Modal title="评价" onConfirm={() => {}} onCancel={() => {}}>
  101. <textarea className="b-c-1 w-10 p-10" rows={6} placeholder="您的看法对我们来说很重要!" />
  102. <div className="b-b m-t-2" />
  103. </Modal>
  104. <Modal title="提交成功" confirmText="好的,知道了" btnAlign="center" onConfirm={() => {}}>
  105. <div className="t-2 t-s-18">
  106. <Icon type="check" className="t-5 m-r-5" />
  107. 您的每一次反馈都是千行进步的动力。
  108. </div>
  109. </Modal>
  110. </div>
  111. );
  112. }
  113. renderTab1() {
  114. const { data = [], filterMap = {}, sortMap = {} } = this.state;
  115. return (
  116. <div className="tab-1-layout">
  117. <UserAction
  118. selectList={[
  119. {
  120. label: '学科',
  121. key: '1',
  122. select: [{ title: '123', key: '1' }, { title: '123', key: '2' }, { title: '123', key: '2' }],
  123. },
  124. {
  125. label: '资料形式',
  126. key: '2',
  127. select: [{ title: '123', key: '1' }, { title: '123', key: '2' }, { title: '123', key: '2' }],
  128. },
  129. ]}
  130. sortList={[{ right: true, label: '销量', key: '1' }, { right: true, label: '更新时间', key: '2' }]}
  131. sortMap={sortMap}
  132. filterMap={filterMap}
  133. onFilter={value => this.onFilter(value)}
  134. onSort={value => this.onSort(value)}
  135. right={
  136. <div className="email">
  137. 邮箱订阅 <Switch />
  138. </div>
  139. }
  140. />
  141. <div className="data-layout">
  142. {data.map(item => {
  143. return (
  144. <div className="data-item">
  145. <Assets name="sun_blue" />
  146. <div className="fixed">
  147. <div className="btns">
  148. <Button size="small" radius>
  149. 阅读
  150. </Button>
  151. <div className="white">下载</div>
  152. </div>
  153. </div>
  154. <div className="title">
  155. <span>版本{item.version}</span>
  156. {item.title}
  157. </div>
  158. <div className="date">{item.date}</div>
  159. <More menu={[{ label: '纠错', key: '1' }, { label: '评价', key: '2' }, { label: '更新', key: '3' }]} />
  160. </div>
  161. );
  162. })}
  163. </div>
  164. </div>
  165. );
  166. }
  167. renderTab2() {
  168. const { data = [] } = this.state;
  169. return (
  170. <div className="tab-2-layout">
  171. <UserAction
  172. left={
  173. <div className="total-log">
  174. <span>最新换库</span>
  175. <span>2019-07-22</span>
  176. <span>
  177. 已换库<b>10</b>天
  178. </span>
  179. </div>
  180. }
  181. />
  182. <div className="data-layout">
  183. {data.map(item => {
  184. return (
  185. <div className="data-item">
  186. <Assets name="sun_blue" />
  187. <div className="title">
  188. 已更新至<b>{item.num}</b>题
  189. </div>
  190. <div className="date">{item.date}</div>
  191. <More menu={[{ label: '更新', key: '1' }, { label: '反馈', key: '2' }, { label: '评价', key: '3' }]} />
  192. </div>
  193. );
  194. })}
  195. </div>
  196. <div className="tip-layout">
  197. <div className="t1">还未购买本月机经</div>
  198. <div className="desc">¥ 888 / 月</div>
  199. <Button radius size="lager" width={150}>
  200. 立即购买
  201. </Button>
  202. </div>
  203. <div className="tip-layout">
  204. <div className="t2">请于2019-11-20前开通</div>
  205. <Button radius size="lager" width={150}>
  206. 立即开通
  207. </Button>
  208. </div>
  209. </div>
  210. );
  211. }
  212. renderTab3() {
  213. return (
  214. <div className="tab-3-layout">
  215. <UserAction right={<div className="email">待开通</div>} />
  216. <div className="tip-layout">
  217. <div className="t1">未购买</div>
  218. <div className="desc">¥ 888 / 月</div>
  219. <Button radius size="lager" width={150}>
  220. 立即购买
  221. </Button>
  222. </div>
  223. <div className="tip-layout">
  224. <div className="t2">请于2019-11-20前开通</div>
  225. <Button radius size="lager" width={150}>
  226. 立即开通
  227. </Button>
  228. </div>
  229. <div className="tip-layout">
  230. <div className="t1">使用中</div>
  231. <div className="t2">距离到期还有 10 天</div>
  232. </div>
  233. <div className="tip-layout">
  234. <div className="t3">已过期</div>
  235. <div className="date">2019-05-11 ~ 2019-09-11</div>
  236. <div className="desc">¥ 800/3个月</div>
  237. <Button radius size="lager" width={150}>
  238. 立即购买
  239. </Button>
  240. </div>
  241. </div>
  242. );
  243. }
  244. renderTab4() {
  245. return (
  246. <div className="tab-4-layout">
  247. <div className="tip-layout">
  248. <div className="t2">未购买</div>
  249. <Button radius size="lager" width={150}>
  250. 立即购买
  251. </Button>
  252. </div>
  253. <div className="tip-layout">
  254. <div className="t1">使用中</div>
  255. <div className="desc">2019-05-20 到期</div>
  256. <Button radius size="lager" width={150}>
  257. 续费
  258. </Button>
  259. </div>
  260. <div className="tip-layout">
  261. <div className="t1">已过期</div>
  262. <div className="desc">2019-05-11 ~ 2019-09-11</div>
  263. <Button radius size="lager" width={150}>
  264. 立即购买
  265. </Button>
  266. </div>
  267. </div>
  268. );
  269. }
  270. renderTab5() {
  271. return (
  272. <div className="tab-5-layout">
  273. <TotalSort />
  274. </div>
  275. );
  276. }
  277. }