yee il y a 7 ans
Parent
commit
975a850902

+ 13 - 13
js/component/manageCenter/idea/content.jsx

@@ -9,7 +9,7 @@ class Content extends Component {
         super();
         this.state = {
             loading: false,
-            component: 'div',
+            component: <div></div>,
         };
     }
     componentWillMount() {
@@ -25,7 +25,7 @@ class Content extends Component {
                 require.ensure([], () => {
                     const Star = require('./bigShot/star').default;
                     this.setState({
-                        component: Star
+                        component: <Star />
                     });
                 });
                 break;
@@ -33,7 +33,7 @@ class Content extends Component {
                 require.ensure([], () => {
                     const Lecture = require('./bigShot/lecture').default;
                     this.setState({
-                        component: Lecture
+                        component: <Lecture />
                     });
                 });
                 break;
@@ -41,39 +41,39 @@ class Content extends Component {
                 require.ensure([], () => {
                     const Banner = require('./bannerManage/bannerManage').default;
                     this.setState({
-                        component: Banner
+                        component: <Banner />
                     });
                 });
                 break;
             case 'flash':
                 require.ensure([], () => {
-                    const Flash = require('./news/flash').default;
+                    const News = require('./news/news').default;
                     this.setState({
-                        component: Flash
+                        component: <News newsType={1} />
                     });
                 });
                 break;
             case 'nationalPolicy':
                 require.ensure([], () => {
-                    const NationalPolicy = require('./news/nationalPolicy').default;
+                    const News = require('./news/news').default;
                     this.setState({
-                        component: NationalPolicy
+                        component: <News newsType={4} />
                     });
                 });
                 break;
             case 'localPolicy':
                 require.ensure([], () => {
-                    const LocalPolicy = require('./news/localPolicy').default;
+                    const News = require('./news/news').default;
                     this.setState({
-                        component: LocalPolicy
+                        component: <News newsType={5} />
                     });
                 });
                 break;
             case 'contact':
                 require.ensure([], () => {
-                    const Contact = require('./news/contact').default;
+                    const News = require('./news/news').default;
                     this.setState({
-                        component: Contact
+                        component: <News newsType={2} />
                     });
                 });
                 break;
@@ -85,7 +85,7 @@ class Content extends Component {
             <div className="manage-content">
                 <LeftTab handlekey={this.getKey.bind(this)} />
                 <div className="content-right">
-                    <this.state.component />
+                    {this.state.component}
                 </div>
             </div>
         )

+ 0 - 20
js/component/manageCenter/idea/news/contact.jsx

@@ -1,20 +0,0 @@
-import React from 'react';
-import { Icon, Button, Spin, message, Table, Input, Modal, DatePicker, Upload, Select } from 'antd';
-import { beforeUpload, getBase64 } from '../../../tools';
-import moment from 'moment';
-import ajax from 'jquery/src/ajax/xhr.js';
-import $ from 'jquery/src/ajax';
-
-const LocalPolicy = React.createClass({
-    getInitialState() {
-        return {};
-    },
-    render() {
-        return (
-            <div className="admin-content" >
-            </div>
-        );
-    }
-});
-
-export default LocalPolicy;

+ 0 - 396
js/component/manageCenter/idea/news/flash.jsx

@@ -1,396 +0,0 @@
-import React from 'react';
-import { Icon, Button, Spin, message, Table, Input, Modal, DatePicker, Upload, Select } from 'antd';
-import { beforeUpload, getBase64 } from '../../../tools';
-import moment from 'moment';
-import ajax from 'jquery/src/ajax/xhr.js';
-import $ from 'jquery/src/ajax';
-
-const Avatar = React.createClass({
-    getInitialState() {
-        return {
-            imageUrl: ''
-        }
-    },
-    handleChange(info) {
-        if (info.file.status === 'done') {
-            // Get this url from response in real world.
-            getBase64(info.file.originFileObj, imageUrl => this.setState({ imageUrl }));
-            this.props.urlData(info.file.response.data);
-        }
-    },
-    componentWillReceiveProps(nextProps) {
-        if (this.props.id != nextProps.id) {
-            this.state.imageUrl = null;
-        };
-    },
-    render() {
-        const imageUrl = this.state.imageUrl;
-        return (
-            <Upload
-                className="avatar-uploader"
-                name={this.props.name}
-                showUploadList={false}
-                action={globalConfig.context + "/api/admin/banners/upload"}
-                data={{ 'sign': this.props.sign }}
-                beforeUpload={beforeUpload}
-                onChange={this.handleChange} >
-                {
-                    (imageUrl || this.props.imageUrl) ?
-                        <img src={imageUrl || this.props.imageUrl} role="presentation" id={this.props.name} /> :
-                        <Icon type="plus" className="avatar-uploader-trigger" />
-                }
-            </Upload>
-        );
-    }
-});
-
-const Lecture = React.createClass({
-    loadData(pageNo) {
-        this.setState({
-            loading: true
-        });
-        $.ajax({
-            method: "get",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context + '/api/admin/banners/list',
-            data: {
-                pageNo: pageNo || 1,
-                pageSize: this.state.pagination.pageSize,
-                key: this.state.searchKey
-            },
-            success: function (data) {
-                let theArr = [];
-                if (!data.data) {
-                    if (data.error && data.error.length) {
-                        message.warning(data.error[0].message);
-                    };
-                } else {
-                    for (let i = 0; i < data.data.length; i++) {
-                        let thisdata = data.data[i];
-                        theArr.push({
-                            key: i,
-                            id: thisdata.id, //主键
-                            sign: thisdata.sign,  // 位置标示
-                            text: thisdata.text,  //广告图描述
-                            imgurl: thisdata.imgurl, //广告图url
-                            url: thisdata.url, //跳转链接
-                            width: thisdata.width, //宽度
-                            height: thisdata.height, //高度
-                            startDate: thisdata.startDate, //广告图开始时间
-                            endDate: thisdata.endDate //广告图结束时间
-                        });
-                    };
-                    this.state.pagination.current = data.data.pageNo;
-                    this.state.pagination.total = data.data.totalCount;
-                };
-                this.setState({
-                    tableData: theArr,
-                    pagination: this.state.pagination
-                });
-            }.bind(this),
-        }).always(function () {
-            this.setState({
-                loading: false
-            });
-        }.bind(this));
-    },
-    getInitialState() {
-        return {
-            loading: false,
-            visible: false,
-            selectedRowKeys: [],
-            selectedRows: [],
-            keysObj: {},
-            RowData: {},
-            pagination: {
-                defaultCurrent: 1,
-                defaultPageSize: 10,
-                showQuickJumper: true,
-                pageSize: 10,
-                onChange: function (page) {
-                    this.loadData(page);
-                }.bind(this),
-                showTotal: function (total) {
-                    return '共' + total + '条数据';
-                }
-            },
-            columns: [
-                {
-                    title: '位置',
-                    dataIndex: 'sign',
-                    key: 'sign',
-                    render: text => { return this.state.keysObj[text] }
-                }, {
-                    title: '广告图描述',
-                    dataIndex: 'text',
-                    key: 'text',
-                }, {
-                    title: '广告图url',
-                    dataIndex: 'imgurl',
-                    key: 'imgurl',
-                }, {
-                    title: '跳转链接',
-                    dataIndex: 'url',
-                    key: 'url',
-                }, {
-                    title: '宽度',
-                    dataIndex: 'width',
-                    key: 'width',
-                }, {
-                    title: '高度',
-                    dataIndex: 'height',
-                    key: 'height',
-                }, {
-                    title: '开始时间',
-                    dataIndex: 'startDate',
-                    key: 'startDate',
-                }, {
-                    title: '结束时间',
-                    dataIndex: 'endDate',
-                    key: 'endDate',
-                }
-            ],
-            tableData: []
-        };
-    },
-    tableRowClick(record, index) {
-        this.state.RowData = record;
-        this.setState({
-            visible: true
-        });
-    },
-    componentWillMount() {
-        this.loadData();
-    },
-    submit() {
-        if (!this.state.RowData.sign) {
-            message.warning('必须选择一个位置!');
-            return;
-        };
-        if (!this.state.RowData.imgurl) {
-            message.warning('必须上传一张广告图!');
-            return;
-        };
-        if (!this.state.RowData.url) {
-            message.warning('必须填写跳转链接!');
-            return;
-        };
-        this.setState({
-            loading: true
-        });
-        $.ajax({
-            method: "post",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context + '/api/admin/banners/save',
-            data: {
-                id: this.state.RowData.id || null, //主键,如果不填主键则为新增记录,填主键则为更新
-                sign: this.state.RowData.sign,  // 位置标示,必填
-                text: this.state.RowData.text,  //广告图描述,长度 255
-                imgurl: this.state.RowData.imgurl, //广告图url,必填,长度 255
-                url: this.state.RowData.url, //跳转链接,必填,长度255
-                width: this.state.RowData.width, //宽度,非必填,最大99999
-                height: this.state.RowData.height, //高度,非必填,最大99999
-                startDate: this.state.RowData.startDate, //广告图开始时间,非必填
-                endDate: this.state.RowData.endDate //广告图结束时间,非必填
-            },
-            success: function (data) {
-                if (data.error && data.error.length) {
-                    message.warning(data.error[0].message);
-                } else {
-                    message.success('保存成功!');
-                    this.setState({ visible: false });
-                    this.loadData();
-                };
-            }.bind(this),
-        }).always(function () {
-            this.setState({
-                loading: false
-            });
-        }.bind(this));
-    },
-    delectRow() {
-        if (this.state.selectedRows.length > 1) {
-            return;
-        };
-        this.setState({
-            selectedRowKeys: [],
-            loading: this.state.selectedRows.length > 0
-        });
-        $.ajax({
-            method: "POST",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context + "/api/admin/banners/delete",
-            data: {
-                id: this.state.selectedRows[0].id
-            }
-        }).done(function (data) {
-            if (data.error && data.error.length) {
-                message.warning(data.error[0].message);
-            } else {
-                message.success('删除成功!');
-            };
-            this.setState({
-                loading: false,
-            });
-            this.loadData();
-        }.bind(this));
-    },
-    reset() {
-        this.state.searchKey = undefined;
-        this.loadData();
-    },
-    render() {
-        const rowSelection = {
-            selectedRowKeys: this.state.selectedRowKeys,
-            onChange: (selectedRowKeys, selectedRows) => {
-                this.setState({
-                    selectedRows: selectedRows.slice(-1),
-                    selectedRowKeys: selectedRowKeys.slice(-1)
-                });
-            }
-        };
-        const hasSelected = this.state.selectedRowKeys.length > 0;
-        return (
-            <div></div>
-        )
-        // return (
-        //     <div className="admin-content" >
-        //         <div className="admin-content-title">广告图管理</div>
-        //         <div className="admin-content-warp">
-        //             <div className="admin-content-header">广告图列表</div>
-        //             <div className="admin-content-search">
-        //                 <Select placeholder="选择广告图位置"
-        //                     style={{ width: 200 }}
-        //                     value={this.state.searchKey}
-        //                     onChange={(e) => { this.setState({ searchKey: e }) }}>
-        //                     {this.state.keysOption}
-        //                 </Select>
-        //                 <Button type="primary" onClick={this.loadData}>搜索</Button>
-        //                 <Button type="ghost" onClick={this.clearCache}>清除缓存</Button>
-        //                 <Button onClick={this.reset}>重置</Button>
-        //                 <Button type='danger' disabled={!hasSelected} onClick={this.delectRow}>
-        //                     删除<Icon type="minus" />
-        //                 </Button>
-        //                 <Button type="primary" style={{ float: 'right' }}
-        //                     onClick={() => { this.setState({ RowData: {}, visible: true }) }}>
-        //                     添加<Icon type="plus" />
-        //                 </Button>
-        //             </div>
-        //             <Spin spinning={this.state.loading}>
-        //                 <Table className="no-all-select" columns={this.state.columns}
-        //                     dataSource={this.state.tableData}
-        //                     pagination={this.state.pagination}
-        //                     rowSelection={rowSelection}
-        //                     onRowClick={this.tableRowClick} />
-        //             </Spin>
-        //         </div>
-        //         <Modal title="广告图详情" width={1000}
-        //             visible={this.state.visible}
-        //             maskClosable={false}
-        //             footer={null}
-        //             afterClose={() => { this.state.RowData = {} }}
-        //             onCancel={() => { this.setState({ visible: false }) }} >
-        //             <Spin spinning={this.state.loading}>
-        //                 <div className="modal-box">
-        //                     <span className="modal-box-title">广告图位置</span>
-        //                     {this.state.RowData.id ? <div className="modal-box-detail">
-        //                         {this.state.keysObj[this.state.RowData.sign]}
-        //                     </div> : <div className="modal-box-detail">
-        //                             <Select placeholder="选择广告图位置"
-        //                                 style={{ width: 200 }}
-        //                                 value={this.state.RowData.sign}
-        //                                 onChange={(e) => {
-        //                                     this.state.RowData.sign = e;
-        //                                     this.setState({ RowData: this.state.RowData })
-        //                                 }}>
-        //                                 {this.state.keysOption}
-        //                             </Select>
-        //                         </div>}
-        //                 </div>
-        //                 <div className="modal-box">
-        //                     <span className="modal-box-title">广告图描述</span>
-        //                     <div className="modal-box-detail">
-        //                         <Input value={this.state.RowData.text}
-        //                             onChange={(e) => {
-        //                                 this.state.RowData.text = e.target.value;
-        //                                 this.setState({ RowData: this.state.RowData });
-        //                             }} />
-        //                     </div>
-        //                 </div>
-        //                 <div className="modal-box">
-        //                     <span className="modal-box-title">跳转链接</span>
-        //                     <div className="modal-box-detail">
-        //                         <Input value={this.state.RowData.url}
-        //                             onChange={(e) => {
-        //                                 this.state.RowData.url = e.target.value;
-        //                                 this.setState({ RowData: this.state.RowData });
-        //                             }} />
-        //                     </div>
-        //                 </div>
-        //                 <div className="modal-box">
-        //                     <span className="modal-box-title">图片宽度</span>
-        //                     <div className="modal-box-detail">
-        //                         <Input value={this.state.RowData.width}
-        //                             onChange={(e) => {
-        //                                 this.state.RowData.width = e.target.value;
-        //                                 this.setState({ RowData: this.state.RowData });
-        //                             }} />
-        //                     </div>
-        //                 </div>
-        //                 <div className="modal-box">
-        //                     <span className="modal-box-title">图片高度</span>
-        //                     <div className="modal-box-detail">
-        //                         <Input value={this.state.RowData.height}
-        //                             onChange={(e) => {
-        //                                 this.state.RowData.height = e.target.value;
-        //                                 this.setState({ RowData: this.state.RowData });
-        //                             }} />
-        //                     </div>
-        //                 </div>
-        //                 <div className="modal-box">
-        //                     <span className="modal-box-title">广告图播放时间</span>
-        //                     <div className="modal-box-detail">
-        //                         <DatePicker
-        //                             showTime
-        //                             format="YYYY-MM-DD HH:mm:ss"
-        //                             placeholder="选择开始时间"
-        //                             value={this.state.RowData.startDate ? moment(this.state.RowData.startDate, "YYYY-MM-DD HH:mm:ss") : undefined}
-        //                             onChange={(t, str) => {
-        //                                 this.state.RowData.startDate = str;
-        //                                 this.setState({ RowData: this.state.RowData });
-        //                             }} />
-        //                         <span>到</span>
-        //                         <DatePicker
-        //                             showTime
-        //                             format="YYYY-MM-DD HH:mm:ss"
-        //                             placeholder="选择结束时间"
-        //                             value={this.state.RowData.endDate ? moment(this.state.RowData.endDate, "YYYY-MM-DD HH:mm:ss") : undefined}
-        //                             onChange={(t, str) => {
-        //                                 this.state.RowData.endDate = str;
-        //                                 this.setState({ RowData: this.state.RowData });
-        //                             }} />
-        //                     </div>
-        //                 </div>
-        //                 <div className="modal-box">
-        //                     <span className="modal-box-title">上传图片</span>
-        //                     <div className="modal-box-detail clearfix">
-        //                         <Avatar sign={this.state.RowData.sign} id={this.state.RowData.id}
-        //                             imageUrl={this.state.RowData.imgurl ? (globalConfig.avatarHost + "/upload" + this.state.RowData.imgurl) : null}
-        //                             urlData={(url) => { this.state.RowData.imgurl = url }} />
-        //                     </div>
-        //                 </div>
-        //                 <div className="modal-box">
-        //                     <Button type="primary" onClick={this.submit}>提交</Button>
-        //                     <Button type="ghost" onClick={() => { this.setState({ visible: false }) }}>取消</Button>
-        //                 </div>
-        //             </Spin>
-        //         </Modal>
-        //     </div>
-        // );
-    }
-});
-
-export default Lecture;

+ 0 - 20
js/component/manageCenter/idea/news/localPolicy.jsx

@@ -1,20 +0,0 @@
-import React from 'react';
-import { Icon, Button, Spin, message, Table, Input, Modal, DatePicker, Upload, Select } from 'antd';
-import { beforeUpload, getBase64 } from '../../../tools';
-import moment from 'moment';
-import ajax from 'jquery/src/ajax/xhr.js';
-import $ from 'jquery/src/ajax';
-
-const LocalPolicy = React.createClass({
-    getInitialState() {
-        return {};
-    },
-    render() {
-        return (
-            <div className="admin-content" >
-            </div>
-        );
-    }
-});
-
-export default LocalPolicy;

+ 0 - 20
js/component/manageCenter/idea/news/nationalPolicy.jsx

@@ -1,20 +0,0 @@
-import React from 'react';
-import { Icon, Button, Spin, message, Table, Input, Modal, DatePicker, Upload, Select } from 'antd';
-import { beforeUpload, getBase64 } from '../../../tools';
-import moment from 'moment';
-import ajax from 'jquery/src/ajax/xhr.js';
-import $ from 'jquery/src/ajax';
-
-const LocalPolicy = React.createClass({
-    getInitialState() {
-        return {};
-    },
-    render() {
-        return (
-            <div className="admin-content" >
-            </div>
-        );
-    }
-});
-
-export default LocalPolicy;

+ 464 - 0
js/component/manageCenter/idea/news/news.jsx

@@ -0,0 +1,464 @@
+import React from 'react';
+import { Icon, Button, Spin, message, Table, Input, Modal, DatePicker, Upload, Select, Radio, Tabs } from 'antd';
+import { beforeUpload, getBase64 } from '../../../tools';
+//import Editors from './richTextEditors';
+import moment from 'moment';
+import ajax from 'jquery/src/ajax/xhr.js';
+import $ from 'jquery/src/ajax';
+
+const Avatar = React.createClass({
+    getInitialState() {
+        return {
+            imageUrl: ''
+        }
+    },
+    handleChange(info) {
+        if (info.file.status === 'done') {
+            // Get this url from response in real world.
+            getBase64(info.file.originFileObj, imageUrl => this.setState({ imageUrl }));
+            this.props.urlData(info.file.response.data);
+        }
+    },
+    componentWillReceiveProps(nextProps) {
+        if (this.props.id != nextProps.id) {
+            this.state.imageUrl = null;
+        };
+    },
+    render() {
+        const imageUrl = this.state.imageUrl;
+        return (
+            <Upload
+                className="avatar-uploader"
+                name={this.props.name}
+                showUploadList={false}
+                action={globalConfig.context + "/api/admin/banners/upload"}
+                data={{ 'sign': this.props.sign }}
+                beforeUpload={beforeUpload}
+                onChange={this.handleChange} >
+                {
+                    (imageUrl || this.props.imageUrl) ?
+                        <img src={imageUrl || this.props.imageUrl} role="presentation" id={this.props.name} /> :
+                        <Icon type="plus" className="avatar-uploader-trigger" />
+                }
+            </Upload>
+        );
+    }
+});
+
+const News = React.createClass({
+    loadData(pageNo) {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            method: "get",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + '/api/admin/news/list',
+            data: {
+                pageNo: pageNo || 1,
+                pageSize: this.state.pagination.pageSize,
+                type: this.props.newsType || 0, //新闻类型
+                title: this.state.searchTitle,
+                author: this.state.searchAuthor,
+                startCreateTime: this.state.startDate, //新闻开始时间 yyyy-MM-dd
+                endCreateTime: this.state.endDate, //新闻结束时间 yyyy-MM-dd
+                source: this.state.searchSource,
+                hot: this.state.searchHot, //是否放在首页
+            },
+            success: function (data) {
+                let theArr = [];
+                if (!data.data || !data.data.list) {
+                    if (data.error && data.error.length) {
+                        message.warning(data.error[0].message);
+                    };
+                } else {
+                    for (let i = 0; i < data.data.list.length; i++) {
+                        let thisdata = data.data.list[i];
+                        theArr.push({
+                            key: i,
+                            createTime: thisdata.createTime,
+                            editTime: thisdata.editTime,
+                            title: thisdata.title,
+                            titleImg: thisdata.titleImg,
+                            author: thisdata.author,
+                            type: thisdata.type,
+                            hot: thisdata.hot,
+                            source: thisdata.source,
+                            sourceUrl: thisdata.sourceUrl,
+                            summary: thisdata.summary,
+                            content: thisdata.content,
+                            createTimeFormattedDate: thisdata.createTimeFormattedDate,
+                        });
+                    };
+                    this.state.pagination.current = data.data.pageNo;
+                    this.state.pagination.total = data.data.totalCount;
+                };
+                this.setState({
+                    tableData: theArr,
+                    pagination: this.state.pagination
+                });
+            }.bind(this),
+        }).always(function () {
+            this.setState({
+                loading: false
+            });
+        }.bind(this));
+    },
+    loadDetailData() {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            method: "get",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + '/api/admin/news/detail',
+            data: {
+                id: this.state.RowData.id //新闻主键ID(数字类型,非字符串)
+            },
+            success: function (data) {
+                let theObj = {};
+                if (!data.data) {
+                    if (data.error && data.error.length) {
+                        message.warning(data.error[0].message);
+                    };
+                } else {
+                    theObj = data.data;
+                };
+                this.setState({
+                    RowData: theObj,
+                });
+            }.bind(this),
+        }).always(function () {
+            this.setState({
+                loading: false
+            });
+        }.bind(this));
+    },
+    getInitialState() {
+        return {
+            loading: false,
+            visible: false,
+            selectedRowKeys: [],
+            selectedRows: [],
+            keysObj: {},
+            RowData: {},
+            pagination: {
+                defaultCurrent: 1,
+                defaultPageSize: 10,
+                showQuickJumper: true,
+                pageSize: 10,
+                onChange: function (page) {
+                    this.loadData(page);
+                }.bind(this),
+                showTotal: function (total) {
+                    return '共' + total + '条数据';
+                }
+            },
+            columns: [
+                {
+                    title: '标题',
+                    dataIndex: 'title',
+                    key: 'title',
+                    width: '20%'
+                }, {
+                    title: '发布时间',
+                    dataIndex: 'editTime',
+                    key: 'editTime',
+                }, {
+                    title: '作者',
+                    dataIndex: 'author',
+                    key: 'author',
+                }, {
+                    title: '来源',
+                    dataIndex: 'source',
+                    key: 'source',
+                }, {
+                    title: '简介',
+                    dataIndex: 'summary',
+                    key: 'summary',
+                    width: '50%'
+                }
+            ],
+            tableData: []
+        };
+    },
+    tableRowClick(record, index) {
+        this.state.RowData = record;
+        this.loadDetailData();
+        this.setState({
+            visible: true
+        });
+    },
+    componentWillMount() {
+        this.loadData();
+    },
+    submit() {
+        if (!this.state.RowData.title) {
+            message.warning('必须填写一个标题!');
+            return;
+        };
+        if (!this.state.RowData.createTime) {
+            message.warning('必须选择一个发布时间!');
+            return;
+        };
+        if (!this.state.RowData.author) {
+            message.warning('必须填写一个作者!');
+            return;
+        };
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            method: "post",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + (this.state.RowData.id ? '/api/admin/news/update' : '/api/admin/news/add'),
+            data: {
+                id: this.state.RowData.id || null, //主键,如果不填主键则为新增记录,填主键则为更新
+                title: this.state.RowData.title,
+                titleImg: this.state.RowData.titleImg,
+                author: this.state.RowData.author,
+                type: this.props.newsType,
+                hot: this.state.RowData.hot,
+                source: this.state.RowData.source,
+                sourceUrl: this.state.RowData.sourceUrl,
+                summary: this.state.RowData.summary,
+                content: this.state.RowData.content,
+                createTimeFormattedDate: this.state.RowData.createTimeFormattedDate,
+            },
+            success: function (data) {
+                if (data.error && data.error.length) {
+                    message.warning(data.error[0].message);
+                } else {
+                    message.success('保存成功!');
+                    this.setState({ visible: false });
+                    this.loadData();
+                };
+            }.bind(this),
+        }).always(function () {
+            this.setState({
+                loading: false
+            });
+        }.bind(this));
+    },
+    delectRow() {
+        let deletedIds = [];
+        for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
+            let rowItem = this.state.selectedRows[idx];
+            if (rowItem.id) {
+                deletedIds.push(rowItem.id)
+            };
+        };
+        this.setState({
+            selectedRowKeys: [],
+            loading: deletedIds.length > 0
+        });
+        $.ajax({
+            method: "POST",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + "/api/admin/news/delete",
+            data: {
+                ids: deletedIds
+            }
+        }).done(function (data) {
+            if (data.error && data.error.length) {
+                message.warning(data.error[0].message);
+            } else {
+                message.success('删除成功!');
+            };
+            this.setState({
+                loading: false,
+            });
+            this.loadData();
+        }.bind(this));
+    },
+    reset() {
+        this.state.searchKey = undefined;
+        this.loadData();
+    },
+    render() {
+        const rowSelection = {
+            selectedRowKeys: this.state.selectedRowKeys,
+            onChange: (selectedRowKeys, selectedRows) => {
+                this.setState({
+                    selectedRows: selectedRows.slice(-1),
+                    selectedRowKeys: selectedRowKeys.slice(-1)
+                });
+            }
+        };
+        const hasSelected = this.state.selectedRowKeys.length > 0;
+        return (
+            <div className="admin-content" >
+                <div className="admin-content-title">科技快讯管理</div>
+                <div className="admin-content-warp">
+                    <div className="admin-content-header">科技快讯列表</div>
+                    <div className="admin-content-search">
+                        <Input placeholder="标题" style={{ width: 200 }}
+                            value={this.state.searchTitle}
+                            onChange={(e) => { this.setState({ searchTitle: e.target.value }); }} />
+                        <Input placeholder="作者" style={{ width: 100 }}
+                            value={this.state.searchAuthor}
+                            onChange={(e) => { this.setState({ searchAuthor: e.target.value }); }} />
+                        <Input placeholder="来源" style={{ width: 100 }}
+                            value={this.state.searchSource}
+                            onChange={(e) => { this.setState({ searchSource: e.target.value }); }} />
+                        <Select placeholder="显示在首页"
+                            style={{ width: 100 }}
+                            value={this.state.searchHot}
+                            onChange={(e) => { this.setState({ searchHot: e }) }}>
+                            <Select.Option value="0" >不显示</Select.Option>
+                            <Select.Option value="1" >显示</Select.Option>
+                        </Select>
+                        <span>发布时间</span>
+                        <DatePicker style={{ width: 110 }}
+                            format="YYYY-MM-DD"
+                            placeholder="选择开始时间"
+                            value={this.state.startDate ? moment(this.state.startDate, "YYYY-MM-DD") : undefined}
+                            onChange={(t, str) => {
+                                this.setState({ startDate: str });
+                            }} />
+                        <span>到</span>
+                        <DatePicker style={{ width: 110 }}
+                            format="YYYY-MM-DD"
+                            placeholder="选择结束时间"
+                            value={this.state.endDate ? moment(this.state.endDate, "YYYY-MM-DD") : undefined}
+                            onChange={(t, str) => {
+                                this.setState({ endDate: str });
+                            }} />
+                        <Button type="primary" onClick={() => { this.loadData() }}>搜索</Button>
+                        <Button onClick={this.reset}>重置</Button>
+                        <Button type='danger' disabled={!hasSelected} onClick={this.delectRow}>
+                            删除<Icon type="minus" />
+                        </Button>
+                        <Button type="primary" style={{ float: 'right' }}
+                            onClick={() => { this.setState({ RowData: {}, visible: true }) }}>
+                            添加<Icon type="plus" />
+                        </Button>
+                    </div>
+                    <Spin spinning={this.state.loading}>
+                        <Table className="no-all-select" columns={this.state.columns}
+                            dataSource={this.state.tableData}
+                            pagination={this.state.pagination}
+                            rowSelection={rowSelection}
+                            onRowClick={this.tableRowClick} />
+                    </Spin>
+                </div>
+                <Modal title="新闻详情" width={600}
+                    visible={this.state.visible}
+                    maskClosable={false}
+                    footer={null}
+                    afterClose={() => { this.state.RowData = {}; this.state.activeKey = '1'; }}
+                    onCancel={() => { this.setState({ visible: false }) }} >
+                    <Spin spinning={this.state.loading}>
+                        <Tabs defaultActiveKey="1"
+                            activeKey={this.state.activeKey || '1'}
+                            onChange={(e) => { this.setState({ activeKey: e }) }}>
+                            <Tabs.TabPane tab="基本内容" key="1">
+                                <div className="modal-box">
+                                    <span className="modal-box-title">新闻标题</span>
+                                    <div className="modal-box-detail">
+                                        <Input value={this.state.RowData.title}
+                                            onChange={(e) => {
+                                                this.state.RowData.title = e.target.value;
+                                                this.setState({ RowData: this.state.RowData });
+                                            }} />
+                                    </div>
+                                </div>
+                                <div className="modal-box">
+                                    <span className="modal-box-title">标题图片</span>
+                                    <div className="modal-box-detail clearfix">
+                                        <Avatar sign={this.state.RowData.sign} id={this.state.RowData.id}
+                                            imageUrl={this.state.RowData.titleImg ? (globalConfig.avatarHost + "/upload" + this.state.RowData.imgurl) : null}
+                                            urlData={(url) => { this.state.RowData.titleImg = url }} />
+                                    </div>
+                                </div>
+                                <div className="modal-box">
+                                    <span className="modal-box-title">作者</span>
+                                    <div className="modal-box-detail">
+                                        <Input value={this.state.RowData.author}
+                                            onChange={(e) => {
+                                                this.state.RowData.author = e.target.value;
+                                                this.setState({ RowData: this.state.RowData });
+                                            }} />
+                                    </div>
+                                </div>
+                                <div className="modal-box">
+                                    <span className="modal-box-title">来源</span>
+                                    <div className="modal-box-detail">
+                                        <Input value={this.state.RowData.source}
+                                            onChange={(e) => {
+                                                this.state.RowData.source = e.target.value;
+                                                this.setState({ RowData: this.state.RowData });
+                                            }} />
+                                    </div>
+                                </div>
+                                <div className="modal-box">
+                                    <span className="modal-box-title">来源链接</span>
+                                    <div className="modal-box-detail">
+                                        <Input value={this.state.RowData.sourceUrl}
+                                            onChange={(e) => {
+                                                this.state.RowData.sourceUrl = e.target.value;
+                                                this.setState({ RowData: this.state.RowData });
+                                            }} />
+                                    </div>
+                                </div>
+                                <div className="modal-box">
+                                    <span className="modal-box-title">发布时间</span>
+                                    <div className="modal-box-detail">
+                                        <DatePicker style={{ width: '120px' }}
+                                            format="YYYY-MM-DD"
+                                            placeholder="选择发布时间"
+                                            value={this.state.RowData.createTimeFormattedDate ? moment(this.state.RowData.createTimeFormattedDate, "YYYY-MM-DD") : undefined}
+                                            onChange={(t, str) => {
+                                                this.state.RowData.createTimeFormattedDate = str;
+                                                this.setState({ RowData: this.state.RowData });
+                                            }} />
+                                    </div>
+                                </div>
+                                <div className="modal-box">
+                                    <span className="modal-box-title">发布在首页</span>
+                                    <div className="modal-box-detail">
+                                        <Radio.Group value={this.state.RowData.hot} onChange={(e) => {
+                                            this.state.RowData.hot = e.target.value;
+                                            this.setState({ RowData: this.state.RowData });
+                                        }} >
+                                            <Radio value={0}>否</Radio>
+                                            <Radio value={1}>是</Radio>
+                                        </Radio.Group>
+                                    </div>
+                                </div>
+                                <div className="modal-box">
+                                    <span className="modal-box-title">简介</span>
+                                    <div className="modal-box-detail">
+                                        <Input value={this.state.RowData.summary}
+                                            onChange={(e) => {
+                                                this.state.RowData.summary = e.target.value;
+                                                this.setState({ RowData: this.state.RowData });
+                                            }} />
+                                    </div>
+                                </div>
+                            </Tabs.TabPane>
+                            <Tabs.TabPane tab="详情" key="2">
+                                <div className="modal-box">
+                                    <span className="modal-box-title">内容详情</span>
+                                    <div className="modal-box-detail">
+
+                                    </div>
+                                </div>
+                            </Tabs.TabPane>
+                        </Tabs>
+                        <div className="modal-box">
+                            <Button type="primary" onClick={this.submit}>提交</Button>
+                            <Button type="ghost" onClick={() => { this.setState({ visible: false }) }}>取消</Button>
+                        </div>
+                    </Spin>
+                </Modal>
+            </div >
+        );
+    }
+});
+
+export default News;

+ 68 - 0
js/component/manageCenter/idea/news/richTextEditors.jsx

@@ -0,0 +1,68 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import LzEditor from 'react-lz-editor'
+class Editors extends React.Component {
+    constructor(props) {
+        super(props);
+        this.state = {
+            content: `<h1>一级标题 Head level 1</h1>
+              <p style='text-align:center;'><span style="color:#ED5565">红色文字</span>,居中对齐,<strong>加粗</strong>,<em>斜体</em></p>
+              <blockquote style='text-align:left;'><span style="color:#ffce54">其</span><span style="color:#a0d468">他</span><span style="color:#38afda">颜</span><span style="color:#967adc">色</span> <span style="color:#a0d468">C</span><span style="color:#48cfad">OL</span><span style="color:#4a89dc">O</span><span style="color:#967adc">R</span><span style="color:#434a54">S</span></blockquote>
+              <p><br></p>
+              <ul>
+                <li><span style="color:#434a54">list 1</span></li>
+                <li><span style="color:#434a54">list 2</span></li>
+                <li><span style="color:#434a54">list 3</span></li>
+                <li><span style="color:#434a54">......</span></li>
+              </ul>
+              <pre><code>Block here.Block here.Block here.Block here.</code></pre>
+              <pre><code>Block here.Block here.Block here.Block here.Block here.</code></pre>
+              <pre><code>Block here.Block here.Block here.Block here.Block here.</code></pre>
+              <p><img src="https://image.qiluyidian.mobi/43053508139910678747.jpg"/></p>
+              <p><br></p>
+              <h2>正文示例:</h2>
+              <h3>乐视金融传将收购数码视讯子公司,拿下互联网、数字电视两张支付牌照</h3>
+              <p>用场景化的方式表达就是,用户可以在观看电视购物频道的时候,直接从电视上进行支付购买商品,不用再通过银行汇款或者货到付款;可以选择对电视上的点播内容进行付费,还可能在电视上对水电煤等公用事业费用进行缴费。</p>
+              <p>一度金融的消息称,乐视金融同数码视讯的接触尚处在高层范围内进行,因此对于收购价格,暂时还不能确定。</p>
+              <p>如果乐视金融拿下数码视讯的两张金融牌照,并且在到期后能够获得央行审核顺利延期,意味着乐视可以通过移动设备和电视两个终端来链接用户的银行卡。</p>
+              <p>乐视金融在去年11月份首度公开亮相的时候,缺少银行和支付两张关键牌照就一直是外界关注的问题。</p>`
+        }
+        this.receiveHtml = this.receiveHtml.bind(this);
+        this.onChange = this.onChange.bind(this);
+        this.beforeUpload = this.beforeUpload.bind(this);
+    }
+    receiveHtml(content) {
+        console.log("Recieved content", content);
+    }
+    onChange(info) {
+        console.log("onChange:", info);
+    }
+    beforeUpload(file) {
+        console.log("beforeUpload:", file);
+    }
+    render() {
+        //uploadProps 配置方法见 https://ant.design/components/upload-cn/
+        const uploadProps = {
+            action: "",
+            onChange: this.onChange,
+            listType: 'picture',
+            fileList: [""],
+            data: (file) => {//支持自定义保存文件名、扩展名支持
+                console.log("uploadProps data", file)
+            },
+            multiple: true,
+            beforeUpload: this.beforeUpload,
+            showUploadList: true
+        }
+        return <LzEditor
+            active={true}
+            importContent={this.state.content}
+            cbReceiver={this.receiveHtml}
+            uploadProps={uploadProps}
+            fullScreen={false}
+            convertFormat="html" />
+    }
+}
+
+
+export default Editors;

+ 2 - 1
package.json

@@ -53,6 +53,7 @@
     "jspdf": "^1.3.3",
     "prop-types": "^15.5.10",
     "react": "^15.4.1",
-    "react-dom": "^15.4.1"
+    "react-dom": "^15.4.1",
+    "react-lz-editor": "^0.10.18"
   }
 }

+ 6 - 2
webpack/module.config.js

@@ -16,8 +16,12 @@ module.exports = function (theme) {
             ]
           }
         }
-      },
-      {
+      }, {
+        test: /\.css$/,
+        use: [{
+          loader: 'css-loader'
+        }]
+      },{
         test: /\.less$/,
         use: ExtractTextPlugin.extract({
           fallback: 'style-loader',