liting2017 6 years ago
parent
commit
36850ad001

+ 2 - 2
js/component/administration/messagePush/messageDesc.jsx

@@ -37,13 +37,13 @@ class DemandDesc extends React.Component {
 					onOk={this.handOk.bind(this)}
 					onCancel={this.handleCancel.bind(this)}
 					width="600px"
-					title={!data.id ? '新建新闻' : '新闻详情'}
+					title={!data.id ? '新建消息' : '消息详情'}
 					footer=""
 					className="admin-desc-content"
 				>
 					<div>
 						<div>
-								{data.auditStatus=='1'||data.auditStatus=='2'?
+								{data.isSend?
 									<NewDetaiel
 									closeDesc={this.handleCancel.bind(this)}
 									data={this.props.data}

+ 9 - 51
js/component/administration/messagePush/messageDetails.jsx

@@ -1,16 +1,10 @@
 import React from 'react';
-import $ from 'jquery/src/ajax';
 import {
-	Modal,
-	message,
 	Spin,
-	Upload,
-	Button,
 	Form,
 } from 'antd';
-import {getProvince} from '@/NewDicProvinceList';
 import '../policy/policy.less';
-import {getReleaseStateList,getNewPosition,splitUrl,getNewType} from '@/tools';
+
 const NewDetail = Form.create()(React.createClass({
     getInitialState() {
         return {
@@ -18,46 +12,13 @@ const NewDetail = Form.create()(React.createClass({
             loading: false,
         };
     },
-    loadData(id) {
-        this.setState({
-            loading: true
-        });
-        $.ajax({
-            method: "get",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context +  '/api/admin/news/detail' ,
-            data: {
-                id: id
-            },
-            success: function (data) {
-                let thisData = data.data;
-                if (!thisData) {
-                    if (data.error && data.error.length) {
-                        message.warning(data.error[0].message);
-                    };
-                    thisData = {};
-                };
-               
-                this.setState({
-                    id:thisData.id,
-                    data: thisData,
-                });
-            }.bind(this),
-        }).always(function () {
-            this.setState({
-                loading: false
-            });
-        }.bind(this));
-    },
-   
 	cancelFun(){
-		this.props.closeDesc();
+		this.props.closeDesc(false,false);
     },
    
     componentWillMount() {
         if (this.props.data.id) {
-            this.loadData(this.props.data.id);
+           
         } else {
             this.state.data = {};
         };
@@ -67,7 +28,7 @@ const NewDetail = Form.create()(React.createClass({
             this.state.textFileList = [];
             this.state.videoFileList = [];
             if (nextProps.data.id) {
-                this.loadData(nextProps.data.id);
+               
             } else {
 				this.state.data = {};
             };
@@ -75,7 +36,7 @@ const NewDetail = Form.create()(React.createClass({
         };
     },
     render() {
-        const theData = this.state.data || {};
+        const theData = this.props.data || {};
         const FormItem = Form.Item
         const formItemLayout = {
             labelCol: { span: 6 },
@@ -86,26 +47,23 @@ const NewDetail = Form.create()(React.createClass({
 			<Form layout="horizontal" id="demand-form">
 				<Spin spinning={this.state.loading}>
                     <div className="clearfix">
-                        <FormItem className="half-item" {...formItemLayout} label="编号">
-                            <span>{theData.biahao}</span>
-                        </FormItem>	
                         <FormItem className="half-item" {...formItemLayout} label="创建人">
-                            <span>{theData.biahao}</span>
+                            <span>{theData.admin?theData.admin:'管理员'}</span>
                         </FormItem>	
                     </div>
                     <div>
 						<FormItem className="half-item" {...formItemLayout} label="标题">
-							<span>{theData.name}</span>
+							<span>{theData.title}</span>
 						</FormItem>
 					</div>
 					<div className="clearfix">
 						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="消息内容">
-							<span>{thisData.dads}</span>
+							<span>{theData.body}</span>
 						</FormItem>
 					</div>
                     <div className="clearfix">
                         <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="推送时间">
-                            <span>{theData.releaseStatus?'已推送':'未推送'}</span>
+                            <span>{theData.releaseDate}</span>
                         </FormItem>
                     </div>
 				</Spin>

+ 37 - 82
js/component/administration/messagePush/messageForm.jsx

@@ -1,24 +1,12 @@
 import React from 'react';
 import $ from 'jquery/src/ajax';
 import {
-	Icon,
-	Modal,
 	message,
 	Spin,
-	Upload,
 	Input,
 	Button,
-	Radio,
 	Form,
-	Checkbox,
-	Cascader,
-	Row,
-	Select,
-    Col
 } from 'antd';
-import {  splitUrl} from '@/tools.js';
-import {provinceSelect } from '@/NewDicProvinceList';
-import Editors from '@/richTextEditors';
  
 const NewDetailForm = Form.create()(React.createClass({
     getInitialState() {
@@ -30,76 +18,45 @@ const NewDetailForm = Form.create()(React.createClass({
             videoFileList: [],
         };
     },
-    loadData(id) {
-        this.setState({
-            loading: true
-        });
-        $.ajax({
-            method: "get",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context +  '/api/admin/news/detail' ,
-            data: {
-                id: id
-            },
-            success: function (data) {
-                let thisData = data.data,provice=[];
-                if (!thisData) {
-                    if (data.error && data.error.length) {
-                        message.warning(data.error[0].message);
-                    };
-                    thisData = {};
-				};
-                this.setState({
-					id:thisData.id,
-					data: thisData,
-					Province:provice,
-					auditStatus:thisData.auditStatus,
-				
-                });
-            }.bind(this),
-        }).always(function () {
-            this.setState({
-                loading: false
-            });
-        }.bind(this));
-    },
     getPictureUrl(e) {
         this.setState({ pictureUrl: e });
     },
     handleSubmit(e,index) {
 		e.preventDefault();
         this.props.form.validateFields((err, values) => {
-			if((this.state.edit)==undefined||!this.state.edit||(this.state.edit)=='<p><br></p>'){
-				message.warning('请填写政策正文');
-				return false;
-			}
-           
             if (!err) {
-				
                 this.setState({
                     loading: true
-                });
+				});
+				let hours =new Date(),
+					year = hours.getFullYear(),
+					month = (hours.getMonth()+1)<10?'0'+(hours.getMonth()+1):(hours.getMonth()+1),
+					day = hours.getDate()<10?'0'+hours.getDate():hours.getDate(),
+					hour=hours.getHours()<10?'0'+hours.getHours():hours.getHours(),
+					mins = hours.getMinutes()<10?'0'+hours.getMinutes():hours.getMinutes(),
+					sec = hours.getSeconds()<10?'0'+hours.getSeconds():hours.getSeconds();
+				let times = year+'-'+month+'-'+day+' '+hour+':'+mins+':'+sec;
                 $.ajax({
                     method: "post",
 					dataType: "json",
 					async:true,
-                    url: this.props.data.id ? globalConfig.context + '/api/admin/news/updateNews' : globalConfig.context + '/api/admin/news/apply',
+                    url: this.props.data.id?globalConfig.context +"/api/admin/message/updMessageById":globalConfig.context +"/api/admin/message/createMyMessage",
                     data: {
 						id: this.props.data.id,
-						type:values.type,
 						title: values.title,
-                        author: values.author,
-                        titleImg: thePictureUrl,
-						content:this.state.edit,
-						hot:values.hot,
+						subject:0,					//消息类别 0-系统消息
+						isDraft:index=='1'?1:0, 	//是否草稿 0-否 1-是
+						deleteSign:0,	  			//删除标识 0-否 ,1-是
+						isSend:index=='2'?1:0,  	//是否发送0-否 1-是
+						body:values.body,
+						messageCreateTime:!(this.props.data.id)?times:'null'
                     }
                 }).done(function (data) {
                     this.setState({
                         loading: false
 					});
                     if (!data.error.length) {
-                        message.success('操作成功!');
+                        message.success('保存成功!');
                         this.setState({
                             visible: false
                         });
@@ -112,14 +69,14 @@ const NewDetailForm = Form.create()(React.createClass({
         });
 	},
 	cancelFun(){
-		this.props.closeDesc();
+		this.props.closeDesc(false,false);
 	},
     componentWillMount() {
         if (this.props.data.id) {
-            this.loadData(this.props.data.id);
+           
         } else {
 			this.state.visible=true;
-			this.state.pictureUrl = [];
+			this.state.data = {};
         };
     },
     componentWillReceiveProps(nextProps) {
@@ -127,7 +84,7 @@ const NewDetailForm = Form.create()(React.createClass({
             this.state.textFileList = [];
             this.state.videoFileList = [];
             if (nextProps.data.id) {
-                this.loadData(nextProps.data.id);
+               
             } else {
 				this.state.visible=true;
 				this.state.data = {};
@@ -136,47 +93,44 @@ const NewDetailForm = Form.create()(React.createClass({
         };
     },
     render() {
-        const theData = this.state.data || {};
+        const theData = this.props.data || {};
         const { getFieldDecorator } = this.props.form;
-        const FormItem = Form.Item
+        const FormItem = Form.Item;
         const formItemLayout = {
             labelCol: { span: 6 },
             wrapperCol: { span: 12 },
 		};
         return (
 			<div className='login'>
-			<Form layout="horizontal" onSubmit={(e)=>{this.handleSubmit(e,0)}} id="demand-form">
+			<Form layout="horizontal" onSubmit={(e)=>{this.handleSubmit(e,1)}} id="demand-form">
 				<Spin spinning={this.state.loading}>
 					<div className="clearfix">
-						<div>{this.props.data&&this.props.data.id?<div>
-								<FormItem className="half-item" {...formItemLayout} label="编号">
-									<span>{theData.biahao}</span>
-								</FormItem>	
-								<FormItem className="half-item" {...formItemLayout} label="创建人">
-									<span>{theData.biahao}</span>
-								</FormItem>	
-								</div>:''}	
-						</div>
+						{this.props.data&&this.props.data.id?<div>
+							<FormItem className="half-item" {...formItemLayout} label="创建人">
+								<span>{theData.admin?theData.admin:'管理员'}</span>
+							</FormItem>	
+							</div>:''}	
+					</div>
+					<div className="clearfix">
 						<FormItem className="half-item" {...formItemLayout} label="标题">
 							{getFieldDecorator('title', {
 								rules: [ { required: true, message: '此项为必填项!' } ],
 								initialValue: theData.title
 							})(<Input placeholder="请输入消息标题" />)}
 						</FormItem>
-
 					</div>
 					<div className="clearfix">
 						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="消息内容">
-							{getFieldDecorator('summary', {
+							{getFieldDecorator('body', {
 								rules: [ { required: true, message: '此项为必填项!' } ],
-								initialValue: theData.summary
+								initialValue: theData.body
 							})(<Input type="textarea" rows={4} placeholder="输入内容" />)}
 						</FormItem>
 					</div>
 					{this.props.data&&this.props.data.id?<div>
 						<div className="clearfix">
 							<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="创建时间">
-								<span>{theData.releaseStatus?'已推送':'未推送'}</span>
+								<span>{theData.createTime}</span>
 							</FormItem>
 						</div>
 					</div>:''}
@@ -185,15 +139,16 @@ const NewDetailForm = Form.create()(React.createClass({
 						    <Button className="set-submit" type="primary" htmlType="submit">
 								保存
 							</Button>
-							<Button
+							{this.props.data&&this.props.data.id?<Button
 								className="set-submit"
+								style={{background: 'rgb(63, 207, 158)',border:'none',color:'#FFF'}}
 								type="ghost"
 								onClick={(e) => {
 										this.handleSubmit(e,2)
 								}}
 							>
 								推送
-							</Button>
+							</Button>:''}
 							<Button className="set-submit" type="ghost" onClick={this.cancelFun}>
 								取消
 							</Button>

+ 37 - 39
js/component/administration/messagePush/systemMessage.jsx

@@ -1,12 +1,10 @@
 import React from 'react';
-import { Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker } from 'antd';
+import { Icon, Button, Input, Select, Spin, Table, message, DatePicker } from 'antd';
 import $ from 'jquery/src/ajax';
 import moment from 'moment';
 import NewDesc from '@/administration/messagePush/messageDesc';
 import '@/account/demand/techDemand.less';
 import '@/administration/news/news.less';
-import {  } from '@/dataDic.js';
-import {getReleaseStateList, } from '@/tools.js';
 
 const DemandList = React.createClass({
     loadData(pageNo) {
@@ -20,12 +18,14 @@ const DemandList = React.createClass({
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/api/admin/news/list",
+            url: globalConfig.context + "/api/admin/message/getMessageList",
             data: {
                 pageNo: pageNo || 1,
                 pageSize: this.state.pagination.pageSize,
                 title: this.state.nameSearch, //需求名称
-               
+                isSend:this.state.auditStatusSearch,
+                sendStartTime: this.state.releaseDate[0],
+                sendEndTime: this.state.releaseDate[1],
             },
             success: function (data) {
                 let theArr = [];
@@ -36,22 +36,24 @@ const DemandList = React.createClass({
                 } else {
                     for (let i = 0; i < data.data.list.length; i++) {
                         let thisdata = data.data.list[i];
+                        
                         theArr.push({
                             key: i,
                             id: thisdata.id,
                             title: thisdata.title,
-                            author:thisdata.author,
-                            source: thisdata.source,
-                            auditStatus: thisdata.auditStatus, //审核状态
-                            releaseDate:thisdata.releaseDate?(new Date(thisdata.releaseDate)).toLocaleString():''
+                            isSend:thisdata.isSend,
+                            admin:thisdata.admin?thisdata.admin:'管理员',
+                            body: thisdata.body, 
+                            createTime:thisdata.createTime?(new Date(thisdata.createTime)).toLocaleString():'',
+                            releaseDate:thisdata.sendTime?(new Date(thisdata.sendTime)).toLocaleString():''
                         });
                     };
                 };
                 this.state.pagination.current = data.data.pageNo;
                 this.state.pagination.total = data.data.totalCount;
                 if(data.data&&data.data.list&&!data.data.list.length){
-					this.state.pagination.current=0
-					this.state.pagination.total=0
+					this.state.pagination.current=0;
+					this.state.pagination.total=0;
 				};
                 this.setState({
                     dataSource: theArr,
@@ -85,21 +87,16 @@ const DemandList = React.createClass({
                 }
             },
             columns: [
-                {
-                    title: '消息编号',
+                 {
+                    title: '消息标题',
                     dataIndex: 'title',
                     key: 'title',
-                },  {
-                    title: '消息标题',
-                    dataIndex: 'author',
-                    key: 'author',
-                    render:text=>{return <span>管理员</span>}
                 },
                 {
                     title: '消息内容',
-                    dataIndex: 'auditStatus',
-                    key: 'auditStatus',
-                    render: text => { text&&text.length>16?text.toString(16)+'...':text}
+                    dataIndex: 'body',
+                    key: 'body',
+                    render: text => { return text&&text.length>16?text.substr(0,16)+'...':text}
                 },
                 {
                     title: '创建人',
@@ -108,13 +105,13 @@ const DemandList = React.createClass({
                 },
                 {
                     title: '创建时间',
-                    dataIndex: 'releaseDate',
-                    key: 'releaseDate'
+                    dataIndex: 'createTime',
+                    key: 'createTime'
                 },
                 {
                     title: '推送时间',
-                    dataIndex: 'releaseDate1',
-                    key: 'releaseDate1'
+                    dataIndex: 'releaseDate',
+                    key: 'releaseDate'
                 },
                 {
                     title: '操作',
@@ -122,8 +119,8 @@ const DemandList = React.createClass({
                     key: 'caozuo',
                     render:(text,recard) => {
                         return  <div className="btnRight">
-                                   {recard.auditStatus?<Button type="primary" style={{ background: "#3fcf9e", border: "none", color: "#fff" }} onClick={(e)=>{e.stopPropagation(),this.submission(recard)}}>推送</Button>:''}
-                                   {recard.auditStatus?<Button type="danger" style={{ margin:10 }} onClick={(e)=>{e.stopPropagation(),this.del(recard)}}>删除</Button>:''}
+                                   {!recard.isSend?<Button type="primary" style={{ background: "#3fcf9e", border: "none", color: "#fff" }} onClick={(e)=>{e.stopPropagation();this.submission(recard)}}>推送</Button>:''}
+                                   {!recard.isSend?<Button type="danger" style={{ margin:10 }} onClick={(e)=>{e.stopPropagation(),this.del(recard)}}>删除</Button>:''}
                                 </div>
                     }
                 }
@@ -135,21 +132,19 @@ const DemandList = React.createClass({
     //发布
     submission(record){
         this.setState({
-            showDesc:false,
             loading:true
         });
         $.ajax({
-            method: "POST",
+            method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/api/admin/news/updateStatus",
+            url: globalConfig.context + "/api/admin/message/sendMessage",
             data: {
-                id:record.id,
-                auditStatus:2
+                messageId:record.id,
             }
         }).done(function (data) {
             if (!data.error.length) {
-                message.success('发布成功.');
+                message.success('推送成功.');
                 this.setState({
                     loading: false,
                 });
@@ -176,9 +171,15 @@ const DemandList = React.createClass({
             method: "POST",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/api/admin/news/deleteById",
+            url: globalConfig.context + "/api/admin/message/updMessageById",
             data: {
-                id: recard.id
+                id: recard.id,
+                title: recard.title,
+                subject:0,					//消息类别 0-系统消息
+                isDraft:1, 	//是否草稿 0-否 1-是
+                deleteSign:1,	  			//删除标识 0-否 ,1-是
+                isSend:0,  	        //是否发送0-否 1-是
+                body:recard.body
             }
         }).done(function (data) {
             if (!data.error.length) {
@@ -213,9 +214,7 @@ const DemandList = React.createClass({
     },
     reset() {
         this.state.nameSearch = '';
-        this.state.typeSearch=undefined;
         this.state.releaseDate = [];
-        this.state.dataCategorySearch = undefined;
         this.state.auditStatusSearch = undefined;
         this.loadData();
     },
@@ -252,7 +251,7 @@ const DemandList = React.createClass({
                         value={this.state.auditStatusSearch}
                         onChange={(e) => { this.setState({ auditStatusSearch: e }) }}>
                         <Select.Option value="0" >草稿</Select.Option>
-                        <Select.Option value="2" >已发布</Select.Option>
+                        <Select.Option value="1" >已推送</Select.Option>
                     </Select>
                     <span>推送时间 : </span>
                     <RangePicker
@@ -262,7 +261,6 @@ const DemandList = React.createClass({
                         onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
                     <Button type="primary" onClick={this.search}>搜索</Button>
                     <Button onClick={this.reset}>重置</Button>
-                    <Button type="danger" disabled={!hasSelect}  onClick={(e)=>{this.delectRow()}}>删除</Button>
                 </div>
                 <div className="patent-table">
                     <Spin spinning={this.state.loading}>

+ 1 - 1
webpack-dll.config.js

@@ -10,7 +10,7 @@ let theme = {
   '@link-color': '#58a3ff'
 };
 module.exports = (function () {
-	let staticHost = 'http://192.168.1.188:8088';    
+	let staticHost = 'http://192.168.0.188:8088';    
     switch (argv.env.deploy) {
         case 'test':
             staticHost = 'http://statics.jishutao.com';

+ 3 - 3
webpack.config.js

@@ -115,7 +115,7 @@ module.exports = (function () {
         }));
     }
 
-    let staticHost = 'http://192.168.1.188:8088';    
+    let staticHost = 'http://192.168.0.188:8088';    
     switch (argv.env.deploy) {
         case 'test':
             staticHost = 'http://statics.jishutao.com';
@@ -150,9 +150,9 @@ module.exports = (function () {
         plugins: plugins,
         devServer: {
             disableHostCheck: true,
-            host: '192.168.1.188',
+            host: '192.168.0.188',
             port: 8088,
-            allowedHosts: ['127.0.0.1','192.168.1.165'],
+            allowedHosts: ['127.0.0.1','192.168.0.20'],
             headers: {
                 "Access-Control-Allow-Origin": "*"
             }

+ 6 - 6
webpack/entry.config.js

@@ -10,28 +10,28 @@ module.exports = {
     'admin/index': './js/admin/index.js',
   },
   watch: {
-    'user/index': ['webpack-dev-server/client?http://192.168.1.188:8088', // WebpackDevServer host and port
+    'user/index': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/index.js'
     ],
-    'user/login': ['webpack-dev-server/client?http://192.168.1.188:8088', // WebpackDevServer host and port
+    'user/login': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/login.js'
     ],
-    'user/signIn': ['webpack-dev-server/client?http://192.168.1.188:8088', // WebpackDevServer host and port
+    'user/signIn': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/signIn.js'
     ],
-    'user/account/index': ['webpack-dev-server/client?http://192.168.1.188:8088', // WebpackDevServer host and port
+    'user/account/index': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/account/index.js'
     ],
     //admin
-    'admin/login': ['webpack-dev-server/client?http://192.168.1.188:8088', // WebpackDevServer host and port
+    'admin/login': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
     'webpack/hot/only-dev-server',
     './js/user/adminLogin.js'
     ],
-    'admin/index': ['webpack-dev-server/client?http://192.168.1.188:8088', // WebpackDevServer host and port
+    'admin/index': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/admin/index.js'
     ]