messageDetails.jsx 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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:12},
  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>{theData.admin?theData.admin:'管理员'}</span>
  48. </FormItem>
  49. </div>
  50. <div>
  51. <FormItem labelCol={{ span: 6 }} wrapperCol={{ span: 14 }} label="标题">
  52. <span>{theData.title}</span>
  53. </FormItem>
  54. </div>
  55. <div className="clearfix">
  56. <FormItem labelCol={{ span:6 }} wrapperCol={{ span: 18 }} label="消息内容">
  57. <span>{theData.body}</span>
  58. </FormItem>
  59. </div>
  60. <div className="clearfix">
  61. <FormItem labelCol={{ span:6 }} wrapperCol={{ span: 14 }} label="推送内容">
  62. <span>{theData.resourceName}</span>
  63. </FormItem>
  64. </div>
  65. <div className="clearfix">
  66. <FormItem labelCol={{ span:6 }} wrapperCol={{ span: 18 }} label="推送时间">
  67. <span>{theData.releaseDate}</span>
  68. </FormItem>
  69. </div>
  70. </Spin>
  71. </Form>
  72. </div>
  73. )
  74. }
  75. }));
  76. export default NewDetail;