page.js 23 KB

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