page.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  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 { formatPercent, formatDate, formatSeconds, getMap } from '@src/services/Tools';
  8. import { asyncSMessage } from '@src/services/AsyncTools';
  9. import moment from 'moment';
  10. import Date from '../../../components/Date';
  11. import UserLayout from '../../../layouts/User';
  12. import Tabs from '../../../components/Tabs';
  13. import Button from '../../../components/Button';
  14. import { Icon as GIcon } from '../../../components/Icon';
  15. import UserTable from '../../../components/UserTable';
  16. import Examination from '../../../components/Examination';
  17. import menu from '../index';
  18. import { BindPhone, BindEmail, EditInfo, RealAuth, EditAvatar, InviteModal } from '../../../components/OtherModal';
  19. import VipRenew from '../../../components/VipRenew';
  20. import { My } from '../../../stores/my';
  21. import { Main } from '../../../stores/main';
  22. import { QuestionType } from '../../../../Constant';
  23. const QuestionTypeMap = getMap(QuestionType, 'value', 'label');
  24. class LogItem extends Component {
  25. constructor(props) {
  26. super(props);
  27. this.columns = [
  28. { title: '', key: 'title' },
  29. { title: '语法SC', key: 'sc' },
  30. { title: '逻辑CR', key: 'cr' },
  31. { title: '阅读RC', key: 'rc' },
  32. ];
  33. this.state = { open: false };
  34. }
  35. render() {
  36. const { data = {} } = this.props;
  37. const { total = [], type } = data;
  38. const { open } = this.state;
  39. return (
  40. <div className="log-item">
  41. <div className="total">
  42. {total.map(item => {
  43. return (
  44. <div className="text" style={{ width: item.width }} dangerouslySetInnerHTML={{ __html: item.title }} />
  45. );
  46. })}
  47. </div>
  48. <div className="open">
  49. <GIcon name={open ? 'small-up' : 'small-down'} onClick={() => this.setState({ open: !open })} />
  50. </div>
  51. {type === 'exercise' && this.renderExercise()}
  52. {type === 'examination' && this.renderExamination()}
  53. {type === 'course' && this.renderCourse()}
  54. </div>
  55. );
  56. }
  57. renderExercise() {
  58. const { data } = this.props;
  59. const { detail = [] } = data;
  60. const { open } = this.state;
  61. return (
  62. <div hidden={!open} className="table">
  63. <UserTable size="small" columns={this.columns} data={detail} />
  64. <div className="t-r">
  65. <Link to="/exercise">继续练习></Link>
  66. </div>
  67. </div>
  68. );
  69. }
  70. renderExamination() {
  71. const { data } = this.props;
  72. const { detail = [] } = data;
  73. const { open } = this.state;
  74. return (
  75. <div hidden={!open} className="table">
  76. {detail.map(row => {
  77. return [
  78. <div className="title p-l-5 m-b-1 t-1 t-s-18 f-w-b">
  79. {row.title}<div className="f-r t-3 t-s-12 f-w-d">{row.time}</div>
  80. </div>,
  81. <UserTable
  82. size="small"
  83. columns={[
  84. { key: '', title: '', render: () => '得分/排名' },
  85. { key: 'total', title: 'Total', render: (text, record) => `${record.totalScore}/${record.totalRank}th` },
  86. { key: 'ir', title: 'IR', render: (text, record) => `${record.irScore}/${record.irRank}th` },
  87. { key: '4', title: 'Verbal', render: (text, record) => `${record.verbalScore}/${record.verbalRank}th` },
  88. { key: '5', title: 'Quant', render: (text, record) => `${record.quantScore}/${record.quantRank}th` },
  89. ]}
  90. data={[row.score]}
  91. />];
  92. })}
  93. <div className="t-r">
  94. <Link to="/examination">继续练习></Link>
  95. </div>
  96. </div>
  97. );
  98. }
  99. renderCourse() {
  100. const { data } = this.props;
  101. const { detail = [] } = data;
  102. const { open } = this.state;
  103. return (
  104. <div hidden={!open} className="table">
  105. <UserTable
  106. header={false}
  107. size="small"
  108. even="odd"
  109. columns={[
  110. { key: 'type', width: 100 },
  111. { key: 'title', width: 310 },
  112. {
  113. key: 'time',
  114. width: 120,
  115. render: (text) => {
  116. return <div className="sub">
  117. <div className="t-2 t-s-12">{text.split(' ')[0]}</div>
  118. <div className="t-6 t-s-12">{text.split(' ')[1]}</div>
  119. </div>;
  120. },
  121. }]}
  122. data={detail}
  123. />
  124. <div className="t-r">
  125. {data.isCourse ? <Link to="/my/course">{'继续学习>'}</Link> : <Link to="/course">{'去购买'}</Link>}
  126. </div>
  127. </div>
  128. );
  129. }
  130. }
  131. export default class extends Page {
  132. constructor(props) {
  133. super(props);
  134. this.colors = ['#3C39CC', '#9E9CFF', '#4292F0', '#4374EC', '#6865FD', '#8D65FD', '#6BABF6', '#7BBEFF', '#6BABF6'];
  135. }
  136. initState() {
  137. return {
  138. day: 'today',
  139. showExamination: false,
  140. timeList: [
  141. { title: '长难句', time: '3h60min', ratio: 10, color: '#3C39CC' },
  142. { title: '综合推理IR', time: '3h60min', ratio: 10, color: '#9E9CFF' },
  143. { title: '语法SC', time: '3h60min', ratio: 10, color: '#4292F0' },
  144. { title: '作文AWA', time: '3h60min', ratio: 10, color: '#4374EC' },
  145. { title: '阅读RC', time: '3h60min', ratio: 10, color: '#6865FD' },
  146. { title: '模考', time: '3h60min', ratio: 10, color: '#8D65FD' },
  147. { title: '逻辑CR', time: '3h60min', ratio: 10, color: '#6BABF6' },
  148. { title: '自由组卷', time: '3h60min', ratio: 10, color: '#7BBEFF' },
  149. { title: '数学Quant', time: '3h60min', ratio: 10, color: '#6BABF6' },
  150. ],
  151. logList: [
  152. {
  153. total: [
  154. { title: '<span>练习和订正</span>', width: 130 },
  155. { title: '<b>60</b>min', width: 90 },
  156. { title: '<b>30</b>题', width: 80 },
  157. { title: '超过了<b>30%</b>的用户' },
  158. ],
  159. detail: [
  160. { title: '做题数', sc: '10', cr: '10', rc: '20' },
  161. { title: '平均正确率', sc: '86%', cr: '86%', rc: '86%' },
  162. { title: '平均用时', sc: '1min', cr: '1min20s', rc: '1min' },
  163. ],
  164. },
  165. {
  166. total: [
  167. { title: '<span>模考和订正</span>', width: 130 },
  168. { title: '<b>60</b>min', width: 90 },
  169. { title: '<b>30</b>套卷', width: 80 },
  170. { title: '超过了<b>30%</b>的用户' },
  171. ],
  172. detail: [
  173. { title: '做题数', sc: '10', cr: '10', rc: '20' },
  174. { title: '平均正确率', sc: '86%', cr: '86%', rc: '86%' },
  175. { title: '平均用时', sc: '1min', cr: '1min20s', rc: '1min' },
  176. ],
  177. },
  178. {
  179. total: [
  180. { title: '<span>课程学习</span>', width: 130 },
  181. { title: '<b>60</b>min', width: 90 },
  182. { title: '<b>30</b>课', width: 80 },
  183. { title: '超过了<b>30%</b>的用户' },
  184. ],
  185. detail: [
  186. { title: '做题数', sc: '10', cr: '10', rc: '20' },
  187. { title: '平均正确率', sc: '86%', cr: '86%', rc: '86%' },
  188. { title: '平均用时', sc: '1min', cr: '1min20s', rc: '1min' },
  189. ],
  190. },
  191. ],
  192. };
  193. }
  194. initData() {
  195. // 获取学习数据
  196. My.getStudyTotal().then((total) => {
  197. total.categorys = total.categorys.map((row, index) => {
  198. row.ratio = (row.time * 100) / total.time;
  199. row.time = formatSeconds(row.time);
  200. row.color = this.colors[index];
  201. return row;
  202. });
  203. this.setState({ total });
  204. });
  205. My.getStudyWeek(0).then(latest => {
  206. const diff = latest.time - latest.avgTime;
  207. const diffPercent =
  208. diff > 0
  209. ? formatPercent(latest.time - latest.avgTime, latest.avgTime, true)
  210. : formatPercent(latest.avgTime - latest.time, latest.avgTime, true);
  211. this.setState({ latest, diff, diffPercent });
  212. My.getStudyWeek(1).then(last => {
  213. const diffLast = latest.time - last.time;
  214. const diffLastPercent =
  215. diffLast > 0
  216. ? formatPercent(latest.time - last.time, last.time, true)
  217. : formatPercent(last.time - latest.time, last.time, true);
  218. this.setState({ last, diffLast, diffLastPercent });
  219. });
  220. });
  221. // 获取广告
  222. Main.getAd('my-self').then(result => {
  223. this.setState({ ads: result });
  224. });
  225. // 获取未读消息
  226. My.message({ page: 1, size: 2, read: 0 }).then(result => {
  227. this.setState({ messages: result.list });
  228. });
  229. this.refreshDay(this.state.day);
  230. }
  231. readAllMessage() {
  232. My.readAllMessage().then(() => {
  233. asyncSMessage('操作成功');
  234. });
  235. }
  236. refreshDay(value) {
  237. let time = '';
  238. switch (value) {
  239. case 'today':
  240. time = moment().format('YYYY-MM-DD');
  241. break;
  242. case 'yesterday':
  243. time = moment()
  244. .add(-1, 'days')
  245. .format('YYYY-MM-DD');
  246. break;
  247. case 'before':
  248. time = moment()
  249. .add(-2, 'days')
  250. .format('YYYY-MM-DD');
  251. break;
  252. default:
  253. time = value.format('YYYY-MM-DD');
  254. value = 'other';
  255. }
  256. My.getStudy(time).then(result => {
  257. const study = [];
  258. const exerciseMap = {};
  259. result.exerciseList.forEach(row => {
  260. exerciseMap[row.title] = row;
  261. });
  262. study.push({
  263. type: 'exercise',
  264. total: [
  265. { title: '<span>练习和订正</span>', width: 130 },
  266. {
  267. title: result.exerciseTime
  268. ? formatSeconds(result.exerciseTime).replace(/([0-9]+)(m|min|h|hour|s)/g, '<b>$1</b>$2')
  269. : '<b>-</b>',
  270. width: 90,
  271. },
  272. { title: `<b>${result.exerciseQuestion || '-'}</b>题`, width: 80 },
  273. {
  274. title: `超过了<b>${result.exerciseExceed ? formatPercent(result.exerciseExceed.rank, result.exerciseExceed.total) : '-%'}</b>的用户`,
  275. },
  276. ],
  277. detail: [
  278. {
  279. title: '做题数',
  280. sc: exerciseMap.sc ? exerciseMap.sc.number : '-',
  281. cr: exerciseMap.cr ? exerciseMap.cr.number : '-',
  282. rc: exerciseMap.rc ? exerciseMap.rc.number : '-',
  283. },
  284. {
  285. title: '平均正确率',
  286. sc: exerciseMap.sc ? formatPercent(exerciseMap.sc.correct, exerciseMap.sc.number) : '-%',
  287. cr: exerciseMap.cr ? formatPercent(exerciseMap.cr.correct, exerciseMap.cr.number) : '-%',
  288. rc: exerciseMap.rc ? formatPercent(exerciseMap.rc.correct, exerciseMap.rc.number) : '-%',
  289. },
  290. {
  291. title: '平均用时',
  292. sc: exerciseMap.sc ? exerciseMap.sc.time / exerciseMap.sc.number : '-',
  293. cr: exerciseMap.cr ? exerciseMap.cr.time / exerciseMap.cr.number : '-',
  294. rc: exerciseMap.rc ? exerciseMap.rc.time / exerciseMap.rc.number : '-',
  295. },
  296. ],
  297. });
  298. study.push({
  299. type: 'examination',
  300. total: [
  301. { title: '<span>模考和订正</span>', width: 130 },
  302. {
  303. title: result.examinationTime
  304. ? formatSeconds(result.examinationTime).replace(/([0-9]+)(m|min|h|hour|s)/g, '<b>$1</b>$2')
  305. : '<b>-</b>',
  306. width: 90,
  307. },
  308. { title: `<b>${result.examinationPaper || '-'}</b>套卷`, width: 80 },
  309. {
  310. title: `超过了<b>${result.examinationExceed ? formatPercent(result.examinationExceed.rank, result.examinationExceed.total) : '-%'}</b>的用户`,
  311. },
  312. ],
  313. detail: result.examinationList.map(row => {
  314. return {
  315. title: row.title,
  316. time: formatDate(row.report.createTime, 'YYYY-MM-DD HH:mm:ss'),
  317. score: row.report.score,
  318. };
  319. }),
  320. });
  321. study.push({
  322. type: 'course',
  323. total: [
  324. { title: '<span>课程学习</span>', width: 130 },
  325. {
  326. title: result.courseTime
  327. ? formatSeconds(result.courseTime).replace(/([0-9]+)(m|min|h|hour|s)/g, '<b>$1</b>$2')
  328. : '<b>-</b>',
  329. width: 90,
  330. },
  331. { title: `<b>${result.courseNumber || '-'}</b>课时`, width: 80 },
  332. {
  333. title: `超过了<b>${result.courseExceed ? formatPercent(result.courseExceed.rank, result.courseExceed.total) : '-%'}</b>的用户`,
  334. },
  335. ],
  336. detail: result.courseList.map(row => {
  337. return {
  338. type: QuestionTypeMap[row.extend],
  339. title: `课时${row.no}: ${row.title}`,
  340. time: formatDate(row.createTime, 'YYYY-MM-DD HH:mm:ss'),
  341. };
  342. }),
  343. });
  344. this.setState({ study });
  345. });
  346. this.setState({ day: value, time, showCal: false });
  347. }
  348. renderView() {
  349. const { config } = this.props;
  350. return (
  351. <UserLayout
  352. active={config.key}
  353. menu={menu}
  354. center={[this.renderTop(), this.renderLog(), this.renderTime()]}
  355. right={[this.renderInfo(), this.renderVip(), this.renderMessage()]}
  356. ads={(this.state.ads || []).map(row => {
  357. return (
  358. <a href={row.link} target="_blank">
  359. <Assets src={row.image} />
  360. </a>
  361. );
  362. })}
  363. />
  364. );
  365. }
  366. renderTop() {
  367. const { info } = this.props.user;
  368. return !info.bindPrepare && <div className="total-layout" onClick={() => this.setState({ showExamination: true })}><Assets /></div>;
  369. }
  370. renderLog() {
  371. const { study = [{}, { type: 'examination' }, { type: 'course' }] } = this.state;
  372. const {
  373. latest = {},
  374. diff = 0,
  375. diffPercent = 0,
  376. diffLast = 0,
  377. diffLastPercent = 0,
  378. day,
  379. time,
  380. showCal,
  381. } = this.state;
  382. return (
  383. <div className="log-layout">
  384. <div className="header">
  385. <div className="title">学习记录</div>
  386. <div className="right">
  387. <span
  388. dangerouslySetInnerHTML={{
  389. __html: `本周学习时间${formatSeconds(latest.time).replace(/([0-9]+)(m|min|h|hour|s)/g, '<b>$1</b>$2')}`,
  390. }}
  391. />
  392. <span>
  393. 同比上周<b>{diffLastPercent}</b>% <Assets name={diffLast > 0 ? 'up' : 'down'} />
  394. </span>
  395. <span>
  396. 同比全站<b>{diffPercent}</b>% <Assets name={diff > 0 ? 'up' : 'down'} />
  397. </span>
  398. </div>
  399. </div>
  400. <div className="action">
  401. <Tabs
  402. className="d-i-b"
  403. type="tag"
  404. width={54}
  405. space={5}
  406. active={day}
  407. tabs={[
  408. { title: '今天', key: 'today' },
  409. { title: '昨天', key: 'yesterday' },
  410. { title: '前天', key: 'before' },
  411. ]}
  412. onChange={value => {
  413. this.refreshDay(value);
  414. }}
  415. />
  416. <div className="right">
  417. <Assets
  418. className="right"
  419. name="calendar"
  420. onClick={() => {
  421. this.setState({ showCal: true });
  422. }}
  423. />
  424. {day === 'other' && <span className="right">{formatDate(time, 'YYYY-MM-DD')}</span>}
  425. {showCal && (
  426. <Date
  427. show
  428. hideInput
  429. theme="filled"
  430. value={moment(time)}
  431. disabledDate={date => date.unix() <= moment.unix()}
  432. onChange={date => {
  433. this.refreshDay(date);
  434. }}
  435. />
  436. )}
  437. </div>
  438. </div>
  439. {study.map((data, index) => {
  440. return <LogItem key={index} data={data} />;
  441. })}
  442. </div>
  443. );
  444. }
  445. renderTime() {
  446. const { total = {} } = this.state;
  447. return (
  448. <div className="time-layout">
  449. <div className="header">
  450. <div className="title">
  451. 时间分配
  452. <Tooltip overlayClassName="gray" title="包括听课、练习与订正">
  453. <Icon type="question-circle" theme="filled" />
  454. </Tooltip>
  455. </div>
  456. <div className="right">
  457. 自 {total.createTIme && formatDate(total.createTime, 'YYYY-MM-DD')} ,您已在千行学习<b>{total.days}</b>
  458. 天,累计
  459. <span
  460. dangerouslySetInnerHTML={{
  461. __html: formatSeconds(total.time).replace(/([0-9]+)(m|min|h|hour|s)/g, '<b>$1</b>$2'),
  462. }}
  463. />
  464. </div>
  465. </div>
  466. <div className="body">
  467. <div className="line">
  468. {(total.categorys || []).map(item => {
  469. return (
  470. <Tooltip overlayClassName="gray" title={`${item.title} ${item.time}`}>
  471. <i style={{ background: item.color, width: `${item.ratio}%` }} />
  472. </Tooltip>
  473. );
  474. })}
  475. </div>
  476. <div className="list">
  477. {(total.categorys || []).map(item => {
  478. return (
  479. <div className="item">
  480. <div className="color" style={{ background: item.color }} />
  481. <div className="title">{item.title}</div>
  482. <div className="date">{item.time}</div>
  483. </div>
  484. );
  485. })}
  486. </div>
  487. </div>
  488. </div>
  489. );
  490. }
  491. renderInfo() {
  492. const { info = {} } = this.props.user;
  493. const { showExamination, showPhone, showEmail, showEdit, showReal, showAvatar, showInvite, showVip } = this.state;
  494. return (
  495. <div className="info-layout">
  496. <div className="body">
  497. <div className="info c-p">
  498. <Assets
  499. name="sun_blue"
  500. src={info.avatar}
  501. onClick={() => {
  502. this.setState({ showEdit: true });
  503. }}
  504. />
  505. <div className="detail">
  506. <div
  507. className="name c-p"
  508. onClick={() => {
  509. this.setState({ showEdit: true });
  510. }}
  511. >
  512. {info.nickname}{' '}
  513. </div>
  514. <div className="id">ID: {info.id} </div>
  515. </div>
  516. </div>
  517. <div className="auth">
  518. <span className="invite">
  519. <Button
  520. radius
  521. size="small"
  522. onClick={() => {
  523. this.setState({ showInvite: true });
  524. }}
  525. >
  526. 邀请
  527. </Button>
  528. </span>
  529. <GIcon name="user-wechat" noHover active={info.bindWechat} />
  530. <GIcon
  531. name="user-phone"
  532. active={info.bindMobile}
  533. onClick={() => {
  534. this.setState({ showPhone: true });
  535. }}
  536. />
  537. <GIcon
  538. name="user-realname"
  539. active={info.bindReal}
  540. onClick={() => {
  541. this.setState({ showReal: true });
  542. }}
  543. />
  544. <GIcon
  545. name="user-email"
  546. active={!!info.email}
  547. onClick={() => {
  548. this.setState({ showEmail: true });
  549. }}
  550. />
  551. <GIcon
  552. name="user-info"
  553. active={info.bindPrepare}
  554. onClick={() => {
  555. this.setState({ showExamination: true });
  556. }}
  557. />
  558. </div>
  559. {!info.bindReal && <div className="t-3 t-s-12 m-t-1">完成实名认证送6个月VIP <a onClick={() => this.setState({ showReal: true })}>去完成</a></div>}
  560. </div>
  561. {info.vip &&
  562. <div className="footer">
  563. <Assets className="m-r-5" name="VIP" />
  564. {info.vip && <span className="date">{formatDate(info.vip, 'YYYY-MM-DD')}到期</span>}
  565. <a
  566. onClick={() => {
  567. this.setState({ showVip: true });
  568. }}
  569. >
  570. 续费
  571. </a>
  572. </div>
  573. }
  574. <Examination
  575. show={showExamination}
  576. data={info}
  577. onConfirm={() => this.setState({ showExamination: false })}
  578. onCancel={() => this.setState({ showExamination: false })}
  579. onClose={() => this.setState({ showExamination: false })}
  580. />
  581. <BindPhone
  582. show={showPhone}
  583. data={info}
  584. onConfirm={() => this.setState({ showPhone: false })}
  585. onCancel={() => this.setState({ showPhone: false })}
  586. />
  587. <BindEmail
  588. show={showEmail}
  589. data={info}
  590. onConfirm={() => this.setState({ showEmail: false })}
  591. onCancel={() => this.setState({ showEmail: false })}
  592. />
  593. <EditInfo
  594. show={showEdit}
  595. data={info}
  596. image={this.state.avatarFile}
  597. onSelectImage={file => this.setState({ showEdit: false, showAvatar: true, avatarImage: file })}
  598. onConfirm={() => this.setState({ showEdit: false, avatarFile: null })}
  599. onCancel={() => this.setState({ showEdit: false, avatarFile: null })}
  600. />
  601. <RealAuth show={showReal} data={info} onConfirm={() => this.setState({ showReal: false })} />
  602. <EditAvatar
  603. show={showAvatar}
  604. data={info}
  605. crop={{ width: 200, height: 200 }}
  606. image={this.state.avatarImage}
  607. onConfirm={file => this.setState({ showAvatar: false, showEdit: true, avatarFile: file, avatarImage: null })}
  608. onCancel={() => this.setState({ showAvatar: false, showEdit: true, avatarImage: null })}
  609. />
  610. <InviteModal show={showInvite} data={info} onClose={() => this.setState({ showInvite: false })} />
  611. <VipRenew
  612. show={showVip}
  613. data={info}
  614. onReal={() => this.setState({ showVip: false, showReal: true })}
  615. onPrepare={() => this.setState({ showVip: false, showExamination: true })}
  616. onClose={() => this.setState({ showVip: false })}
  617. />
  618. </div>
  619. );
  620. }
  621. renderVip() {
  622. const { info } = this.props.user;
  623. return !info.vip && <div className="info-layout">
  624. <div className="body">
  625. 开通<Assets className="m-r-5" name="VIP" />解锁海量权限
  626. </div>
  627. <div className="footer">
  628. <Button
  629. radius
  630. size="small"
  631. onClick={() => {
  632. this.setState({ showVip: true });
  633. }}
  634. >
  635. 立即开通
  636. </Button>
  637. </div>
  638. </div>;
  639. }
  640. renderMessage() {
  641. const { messages = [] } = this.state;
  642. const number = (messages || []).length;
  643. return (
  644. number > 0 && (
  645. <div className="message-layout">
  646. <div className="header">
  647. <Assets
  648. name="all"
  649. onCancel={() => {
  650. this.readAllMessage();
  651. }}
  652. />
  653. 全部已读
  654. </div>
  655. <div className="body">
  656. {(messages || []).map(row => {
  657. return (
  658. <div className="item">
  659. <div className="title dot">{row.title}</div>
  660. <div className="date">{formatDate(row.createTime, 'YYYY-MM-DD HH:mm:ss')}</div>
  661. {row.link && (
  662. <GIcon
  663. name="arrow-right-small"
  664. onClick={() => {
  665. openLink(row.link);
  666. }}
  667. />
  668. )}
  669. </div>
  670. );
  671. })}
  672. </div>
  673. <div className="footer">
  674. <Button
  675. radius
  676. size="small"
  677. onClick={() => {
  678. linkTo('/my/message');
  679. }}
  680. >
  681. 全部消息
  682. </Button>
  683. </div>
  684. </div>
  685. )
  686. );
  687. }
  688. }