Bläddra i källkod

修改政策、新闻详情页新增发布时间

anderx 2 år sedan
förälder
incheckning
a6ef295608

+ 18 - 7
js/component/administration/news/newForm.jsx

@@ -14,11 +14,12 @@ import {
 	Cascader,
 	Row,
 	Select,
-    Col
+	Col, DatePicker
 } from 'antd';
 import {  splitUrl} from '@/tools.js';
 import {provinceSelect } from '@/NewDicProvinceList';
 import Editors from '@/richTextEditors';
+import moment from "moment";
 
 const PicturesWall = React.createClass({
 	getInitialState() {
@@ -73,7 +74,7 @@ const PicturesWall = React.createClass({
 		);
 	}
 });
- 
+
 const NewDetailForm = Form.create()(React.createClass({
     getInitialState() {
         return {
@@ -176,6 +177,7 @@ const NewDetailForm = Form.create()(React.createClass({
 						auditStatus:index,
                         summary: values.summary,
 						provinceId: (values.ProvinceCity)[0],
+						releaseDateStr:moment(values.releaseDateStr).format('YYYY-MM-DD HH:mm:ss'),
 						// publishPages:publishPages
                     }
                 }).done(function (data) {
@@ -249,7 +251,7 @@ const NewDetailForm = Form.create()(React.createClass({
 			<div className='login'>
 			<Form layout="horizontal" onSubmit={(e)=>{this.handleSubmit(e,0)}} id="demand-form">
 				<Spin spinning={this.state.loading}>
-					
+
 					<div className="clearfix">
 						<FormItem className="half-item" {...formItemLayout} label="标题">
 							{getFieldDecorator('title', {
@@ -293,10 +295,10 @@ const NewDetailForm = Form.create()(React.createClass({
 								initialValue: theData.sourceUrl
 							})(<Input placeholder="请输入新闻来源链接" />)}
 						</FormItem>
-						<FormItem className="half-item" 
+						<FormItem className="half-item"
 							{...formItemLayout}
 							label="省-市-区"
-							> 
+							>
 							{getFieldDecorator('ProvinceCity', {
 								rules: [ { required: true, message: '此项为必填项!' } ],
 								initialValue: this.state.Province
@@ -342,9 +344,18 @@ const NewDetailForm = Form.create()(React.createClass({
 						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="是否发布">
 							<span>{theData.releaseStatus?'已发布':'未发布'}</span>
 						</FormItem>
+						<FormItem className="half-item"  {...formItemLayout} label="发布日期">
+							{getFieldDecorator('releaseDateStr',{
+								rules:[{required:true,message:"发布时间不能为空"}],
+								initialValue: moment()
+							})(<DatePicker showTime
+										   format="YYYY-MM-DD HH:mm:ss" />)}
+
+						</FormItem>
 					</div>
+
 					{/* <div className="clearfix">
-						<FormItem className="full-item" 
+						<FormItem className="full-item"
 							labelCol={{ span: 3 }}
 							wrapperCol={{ span: 18 }} label="发布位置">
 							{getFieldDecorator('publishPages', {
@@ -382,7 +393,7 @@ const NewDetailForm = Form.create()(React.createClass({
 						</FormItem>
 					</div>
 				</Spin>
-			</Form>    
+			</Form>
 		</div>
         )
     }

+ 5 - 8
js/component/administration/policy/policyForm.jsx

@@ -135,8 +135,6 @@ const NewDetailForm = Form.create()(React.createClass({
 		e.preventDefault();
         this.props.form.validateFields((err, values) => {
 			//url转化
-			console.log(values)
-			console.log(moment(values.releaseData).format('YYYY-MM-DD'))
 			if((this.state.edit).content==undefined||!(this.state.edit).content||(this.state.edit).content=='<p><br></p>'){
 				message.warning('请填写政策正文');
 				return false;
@@ -176,7 +174,7 @@ const NewDetailForm = Form.create()(React.createClass({
                         summary: values.summary,
 						province: (values.ProvinceCity)[0],
 						publishPages:publishPages,
-						releaseData:moment(values.releaseData).format('YYYY-MM-DD'),
+						releaseDateStr:moment(values.releaseDateStr).format('YYYY-MM-DD HH:mm:ss'),
                     }
                 }).done(function (data) {
                     this.setState({
@@ -256,12 +254,11 @@ const NewDetailForm = Form.create()(React.createClass({
 							})(<Input placeholder="请输入您的政策政策标题" maxLength={40}/>)}
 						</FormItem>
 						<FormItem className="half-item"  {...formItemLayout} label="发布日期">
-							{getFieldDecorator('releaseData',{
+							{getFieldDecorator('releaseDateStr',{
 								rules:[{required:true,message:"发布时间不能为空"}],
-								initialValue: theData.releaseData
-							})(<DatePicker defaultValue={moment()}
-								showTime
-										   format="YYYY-MM-DD" />)}
+								initialValue: moment()
+							})(<DatePicker showTime
+										   format="YYYY-MM-DD HH:mm:ss" />)}
 
 						</FormItem>