page.js 23 KB

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