messageDetails.jsx 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import React from 'react';
  2. import {
  3. Spin,
  4. Form,
  5. } from 'antd';
  6. import '../../policy/policy.less';
  7. const NewDetail = Form.create()(React.createClass({
  8. getInitialState() {
  9. return {
  10. visible: false,
  11. loading: false,
  12. };
  13. },
  14. cancelFun(){
  15. this.props.closeDesc(false,false);
  16. },
  17. componentWillMount() {
  18. if (this.props.data.id) {
  19. } else {
  20. this.state.data = {};
  21. };
  22. },
  23. componentWillReceiveProps(nextProps) {
  24. if (!this.props.visible && nextProps.visible) {
  25. this.state.textFileList = [];
  26. this.state.videoFileList = [];
  27. if (nextProps.data.id) {
  28. } else {
  29. this.state.data = {};
  30. };
  31. this.props.form.resetFields();
  32. };
  33. },
  34. render() {
  35. const theData = this.props.data || {};
  36. const FormItem = Form.Item
  37. const formItemLayout = {
  38. labelCol: { span: 6 },
  39. wrapperCol: { span: 12 },
  40. };
  41. return (
  42. <div className='login'>
  43. <Form layout="horizontal" id="demand-form">
  44. <Spin spinning={this.state.loading}>
  45. <div className="clearfix">
  46. <FormItem className="half-item" {...formItemLayout} label="推送类型">
  47. <span>app站内消息</span>
  48. </FormItem>
  49. <FormItem className="half-item" {...formItemLayout} label="创建人">
  50. <span>{theData.admin?theData.admin:'管理员'}</span>
  51. </FormItem>
  52. </div>
  53. <div>
  54. <FormItem className="half-item" {...formItemLayout} label="标题">
  55. <span>{theData.title}</span>
  56. </FormItem>
  57. </div>
  58. <div className="clearfix">
  59. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="消息内容">
  60. <span>{theData.body}</span>
  61. </FormItem>
  62. </div>
  63. <div className="clearfix">
  64. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="推送时间">
  65. <span>{theData.releaseDate}</span>
  66. </FormItem>
  67. </div>
  68. </Spin>
  69. </Form>
  70. </div>
  71. )
  72. }
  73. }));
  74. export default NewDetail;