1
0

index.js 1.2 KB

123456789101112131415161718192021222324252627282930
  1. import React, { Component } from 'react';
  2. import './index.less';
  3. import Assets from '@src/components/Assets';
  4. import More from '../More';
  5. import { formatDate } from '../../../../src/services/Tools';
  6. import GIcon from '../Icon';
  7. export default class Note extends Component {
  8. render() {
  9. const { data = { file: true }, teacher, theme = 'default', reply, actionList, onAction } = this.props;
  10. const { info } = this.props.user;
  11. return (
  12. <div className={`note-detail ${theme}`}>
  13. <Assets className="note-avatar" name="sun_blue" src={data.userId ? info.avatar : teacher.avatar} />
  14. {onAction && actionList && <More menu={actionList} onClick={onAction} />}
  15. {onAction && reply && <GIcon className="reply" onClick={() => onAction('reply')} />}
  16. <div className="t-2 t-s-12 m-b-1">
  17. {data.userId ? info.nickname : teacher.realname} <span className="t-3">{formatDate(data.createTime, 'YYYY-MM-DD HH:mm')}</span>
  18. </div>
  19. <div className="t-1 t-s-12 m-b-1">
  20. {data.reply && <div className="reply">{data.reply}</div>}
  21. {data.content}
  22. </div>
  23. <a hidden={!data.file} className="link t-s-12">
  24. {data.name}
  25. </a>
  26. </div>
  27. );
  28. }
  29. }