liting2017 6 years ago
parent
commit
9e8cc13c1e

+ 69 - 0
js/component/administration/messagePush/messageDesc.jsx

@@ -0,0 +1,69 @@
+import React from 'react';
+import { Modal } from 'antd';
+import NewForm from '@/administration/messagePush/messageForm';
+import NewDetaiel from '@/administration/messagePush/messageDetails';
+
+class DemandDesc extends React.Component {
+	constructor(props) {
+		super(props);
+		this.state = {
+			loading: false,
+			pictureUrl: [],
+			showState:false
+		};
+	}
+	handleCancel() {
+		this.setState({
+			visible: false,
+		});
+		this.props.closeDesc(false, false);
+	}
+	handOk() {
+		this.setState({
+			visible: false,
+		});
+		this.props.closeDesc(false, true);
+	}
+	componentWillReceiveProps(nextProps) {
+		this.state.visible = nextProps.showDesc;
+	}
+	render() {
+		let data = this.props.data || [];
+		return (
+			<div className="patent-desc">
+				<Modal
+					maskClosable={false}
+					visible={this.state.visible}
+					onOk={this.handOk.bind(this)}
+					onCancel={this.handleCancel.bind(this)}
+					width="600px"
+					title={!data.id ? '新建新闻' : '新闻详情'}
+					footer=""
+					className="admin-desc-content"
+				>
+					<div>
+						<div>
+								{data.auditStatus=='1'||data.auditStatus=='2'?
+									<NewDetaiel
+									closeDesc={this.handleCancel.bind(this)}
+									data={this.props.data}
+									visible={this.state.visible}
+									handOk={this.handOk.bind(this)}
+									/>
+									:
+									<NewForm 
+										closeDesc={this.handleCancel.bind(this)}
+										data={this.props.data}
+										visible={this.state.visible}
+										handOk={this.handOk.bind(this)}
+										/>
+								} 
+						</div>
+					</div>
+				</Modal>
+			</div>
+		);
+	}
+}
+
+export default DemandDesc;

+ 121 - 0
js/component/administration/messagePush/messageDetails.jsx

@@ -0,0 +1,121 @@
+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 {
+            visible: false,
+            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();
+    },
+   
+    componentWillMount() {
+        if (this.props.data.id) {
+            this.loadData(this.props.data.id);
+        } else {
+            this.state.data = {};
+        };
+    },
+    componentWillReceiveProps(nextProps) {
+        if (!this.props.visible && nextProps.visible) {
+            this.state.textFileList = [];
+            this.state.videoFileList = [];
+            if (nextProps.data.id) {
+                this.loadData(nextProps.data.id);
+            } else {
+				this.state.data = {};
+            };
+            this.props.form.resetFields();
+        };
+    },
+    render() {
+        const theData = this.state.data || {};
+        const FormItem = Form.Item
+        const formItemLayout = {
+            labelCol: { span: 6 },
+            wrapperCol: { span: 12 },
+        };
+        return (
+			<div className='login'>
+			<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>
+                        </FormItem>	
+                    </div>
+                    <div>
+						<FormItem className="half-item" {...formItemLayout} label="标题">
+							<span>{theData.name}</span>
+						</FormItem>
+					</div>
+					<div className="clearfix">
+						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="消息内容">
+							<span>{thisData.dads}</span>
+						</FormItem>
+					</div>
+                    <div className="clearfix">
+                        <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="推送时间">
+                            <span>{theData.releaseStatus?'已推送':'未推送'}</span>
+                        </FormItem>
+                    </div>
+				</Spin>
+			</Form>    
+		</div>
+        )
+    }
+}));
+export default NewDetail;
+
+
+
+

+ 212 - 0
js/component/administration/messagePush/messageForm.jsx

@@ -0,0 +1,212 @@
+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() {
+        return {
+            visible: false,
+            loading: false,
+            auditStatus: 0,
+            textFileList: [],
+            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
+                });
+                $.ajax({
+                    method: "post",
+					dataType: "json",
+					async:true,
+                    url: this.props.data.id ? globalConfig.context + '/api/admin/news/updateNews' : globalConfig.context + '/api/admin/news/apply',
+                    data: {
+						id: this.props.data.id,
+						type:values.type,
+						title: values.title,
+                        author: values.author,
+                        titleImg: thePictureUrl,
+						content:this.state.edit,
+						hot:values.hot,
+                    }
+                }).done(function (data) {
+                    this.setState({
+                        loading: false
+					});
+                    if (!data.error.length) {
+                        message.success('操作成功!');
+                        this.setState({
+                            visible: false
+                        });
+                        this.props.handOk();
+                    } else {
+                        message.warning(data.error[0].message);
+                    }
+                }.bind(this));
+            }
+        });
+	},
+	cancelFun(){
+		this.props.closeDesc();
+	},
+    componentWillMount() {
+        if (this.props.data.id) {
+            this.loadData(this.props.data.id);
+        } else {
+			this.state.visible=true;
+			this.state.pictureUrl = [];
+        };
+    },
+    componentWillReceiveProps(nextProps) {
+        if (!this.props.visible && nextProps.visible) {
+            this.state.textFileList = [];
+            this.state.videoFileList = [];
+            if (nextProps.data.id) {
+                this.loadData(nextProps.data.id);
+            } else {
+				this.state.visible=true;
+				this.state.data = {};
+            };
+			this.props.form.resetFields();
+        };
+    },
+    render() {
+        const theData = this.state.data || {};
+        const { getFieldDecorator } = this.props.form;
+        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">
+				<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>
+						<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', {
+								rules: [ { required: true, message: '此项为必填项!' } ],
+								initialValue: theData.summary
+							})(<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>
+							</FormItem>
+						</div>
+					</div>:''}
+					<div className="clearfix">
+						<FormItem wrapperCol={{ span: 12, offset: 3 }}>
+						    <Button className="set-submit" type="primary" htmlType="submit">
+								保存
+							</Button>
+							<Button
+								className="set-submit"
+								type="ghost"
+								onClick={(e) => {
+										this.handleSubmit(e,2)
+								}}
+							>
+								推送
+							</Button>
+							<Button className="set-submit" type="ghost" onClick={this.cancelFun}>
+								取消
+							</Button>
+						</FormItem>
+					</div>
+				</Spin>
+			</Form>    
+		</div>
+        )
+    }
+}));
+export default NewDetailForm;
+
+
+
+

File diff suppressed because it is too large
+ 156 - 1672
js/component/administration/messagePush/systemMessage.jsx