liting2017 6 anni fa
parent
commit
542e4f0ed3

+ 2 - 2
js/component/administration/index/index.jsx

@@ -172,8 +172,8 @@ const MessageModal = React.createClass({
         }.bind(this));
     },
     componentWillMount() {
-        this.loadReaded();
-        this.loadUnread();
+        // this.loadReaded();
+        // this.loadUnread();
     },
     render() {
         return (

+ 35 - 19
js/component/administration/news/newDetails.jsx

@@ -9,7 +9,7 @@ import {
 	Form,
 } from 'antd';
 import {getProvince} from '@/NewDicProvinceList';
-import {getReleaseStateList,getNewPosition} from '@/tools';
+import {getReleaseStateList,getNewPosition,splitUrl} from '@/tools';
 const NewDetail = Form.create()(React.createClass({
     getInitialState() {
         return {
@@ -29,7 +29,7 @@ const NewDetail = Form.create()(React.createClass({
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context +  '/api/user/achievement/achievementDetail' ,
+            url: globalConfig.context +  '/api/admin/news/detail' ,
             data: {
                 id: id
             },
@@ -41,21 +41,33 @@ const NewDetail = Form.create()(React.createClass({
                     };
                     thisData = {};
                 };
+                document.querySelector('.txt').innerHTML='';
                 let publishPagesArr = [];
-                    thisData.publishPages.map(item=>{
+                let pageList =  thisData.publishPages?(thisData.publishPages).split(','):[];
+                pageList.map(item=>{
 					publishPagesArr.push(item.publishPage)
                 });
-                let ProvinceS = thisData.locationProvince, //getprovince
-				    citys = thisData.locationCity,
-				    Areas = thisData.locationArea,
-				    ProvinceCity = getProvince(ProvinceS, citys, Areas);
+                let ProvinceS = thisData.provinceId,page=[], //getprovince
+                    ProvinceCity = getProvince(ProvinceS);
+                    let pages =thisData.newsPublishs ||[];
+                    pages.map(item=>{
+                        page.push(item.publishPage)
+                    })
+                    console.log(page)
+                    let eleDiv = document.createElement('div');
+                    eleDiv.innerHTML=thisData.content;
+                    console.log(eleDiv);
+                    document.querySelector('.txt').append(eleDiv);
                 this.setState({
                     id:thisData.id,
                     publishPagesArr:publishPagesArr,
                     data: thisData,
+                    page:page,
+                    eleDiv:eleDiv,
                     ProvinceCity:ProvinceCity,
+                    edit:{content:thisData.content},
                     auditStatus:thisData.auditStatus,
-                    pictureUrl: thisData.technicalPictureUrl ? splitUrl(thisData.technicalPictureUrl, ',', globalConfig.avatarHost + '/upload') : []
+                    pictureUrl: thisData.titleImg ? splitUrl(thisData.titleImg, ',', globalConfig.avatarHost + '/upload') : []
                 });
             }.bind(this),
         }).always(function () {
@@ -77,10 +89,11 @@ const NewDetail = Form.create()(React.createClass({
             method: "POST",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context +'/api/user/achievement/refreshPublish',
+            url: globalConfig.context +'/api/admin/news/updateStatus',
             data: {
                 id: this.state.id,
-                auditStatus:this.state.auditStatus
+                auditStatus:this.state.auditStatus,
+                refresh:1
             }
         }).done(function (data) {
             if (!data.error.length) {
@@ -92,6 +105,7 @@ const NewDetail = Form.create()(React.createClass({
                 message.warning(data.error[0].message);
             };
             this.props.handOk();
+           
         }.bind(this));
     },
     //撤销发布
@@ -103,9 +117,10 @@ const NewDetail = Form.create()(React.createClass({
             method: "POST",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context +  '/api/user/achievement/offShelf',
+            url: globalConfig.context +  '/api/admin/news/updateStatus',
             data: {
                 id: this.state.id,
+                auditStatus:4,
             }
         }).done(function (data) {
             if (!data.error.length) {
@@ -122,6 +137,7 @@ const NewDetail = Form.create()(React.createClass({
     componentWillMount() {
         if (this.props.data.id) {
             this.loadData(this.props.data.id);
+           
         } else {
             this.state.data = {};
         };
@@ -152,16 +168,16 @@ const NewDetail = Form.create()(React.createClass({
 				<Spin spinning={this.state.loading}>
 					<div className="clearfix">
                         <FormItem className="half-item" {...formItemLayout} label="新闻标题">
-							<span>{theData.name}</span>
+							<span>{theData.title}</span>
 						</FormItem>
 						<FormItem className="half-item" {...formItemLayout} label="热门">
-							<span>{theData.isHot=='0'&&'否'}{theData.isHot=='1'&&'是'}</span>
+							<span>{theData.hot=='0'&&'否'}{theData.hot=='1'&&'是'}</span>
 						</FormItem>
 						<FormItem className="half-item" {...formItemLayout} label="新闻来源">
-							<span>{theData.patentCase}</span>
+							<span>{theData.source}</span>
 						</FormItem>
 						<FormItem className="half-item" {...formItemLayout} label="来源链接">
-							<span>{theData.parameter}</span>
+							<span>{theData.sourceUrl}</span>
 						</FormItem>
                         <FormItem className="half-item" {...formItemLayout} label="省市区">
 							<span>{this.state.ProvinceCity}</span>
@@ -192,20 +208,20 @@ const NewDetail = Form.create()(React.createClass({
 						</FormItem>
                        
                         <FormItem className="half-item" {...formItemLayout} label="发布时间">
-                            <span>{theData.createTime}</span>
+                            <span>{theData.releaseDate?(new Date(theData.releaseDate)).toLocaleString():''}</span>
                         </FormItem>
 					</div>
                     <div className="clearfix">
                         <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="发布位置">
-                                <span>{getNewPosition(theData.publishPages)}</span>
+                                <span>{getNewPosition(this.state.page)}</span>
 						</FormItem>
                     </div>
                     <div className="clearfix">
 						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="新闻简介">
-							<span>{theData.introduce}</span>
+							<span>{theData.summary}</span>
 						</FormItem>
                         <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="新闻正文">
-							<span>{theData.edit}</span>
+							<span className="txt"></span>
 						</FormItem>
 					</div>
 					<div className="clearfix">

+ 58 - 77
js/component/administration/news/newForm.jsx

@@ -16,7 +16,7 @@ import {
     Col
 } from 'antd';
 import {  splitUrl} from '@/tools.js';
-import {areaSelect } from '@/NewDicProvinceList';
+import {provinceSelect } from '@/NewDicProvinceList';
 import Editors from '@/richTextEditors';
 
 const PicturesWall = React.createClass({
@@ -82,7 +82,8 @@ const NewDetailForm = Form.create()(React.createClass({
             textFileList: [],
             videoFileList: [],
 			pictureUrl: [],
-			tags:[]
+			tags:[],
+			edit:{}
         };
     },
     loadData(id) {
@@ -93,24 +94,32 @@ const NewDetailForm = Form.create()(React.createClass({
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context +  '/api/user/achievement/achievementDetail' ,
+            url: globalConfig.context +  '/api/admin/news/detail' ,
             data: {
                 id: id
             },
             success: function (data) {
-                let thisData = data.data;
+                let thisData = data.data,provice=[];
                 if (!thisData) {
                     if (data.error && data.error.length) {
                         message.warning(data.error[0].message);
                     };
                     thisData = {};
 				};
+				let publishPagesArr = [];
+                let pageList =  thisData.newsPublishs
+                pageList.map(item=>{
+					publishPagesArr.push(item.publishPage)
+                });
+				provice.push(thisData.provinceId);
                 this.setState({
 					id:thisData.id,
 					data: thisData,
-					publishPages:thisData.publishPages.length?thisData.publishPages:['app_achievement_list','web_achievement_list'],
+					Province:provice,
+					publishPages:publishPagesArr,
 					auditStatus:thisData.auditStatus,
-                    pictureUrl: thisData.technicalPictureUrl ? splitUrl(thisData.technicalPictureUrl, ',', globalConfig.avatarHost + '/upload') : []
+					edit:{content:thisData.content},
+                    pictureUrl: thisData.titleImg ? splitUrl(thisData.titleImg, ',', globalConfig.avatarHost + '/upload') : []
                 });
             }.bind(this),
         }).always(function () {
@@ -124,6 +133,10 @@ const NewDetailForm = Form.create()(React.createClass({
     },
     handleSubmit(e,index) {
 		e.preventDefault();
+		if((this.state.edit).content==undefined){
+			message.warning('请填写新闻正文');
+			return false;
+		}
         this.props.form.validateFields((err, values) => {
             //url转化
             let thePictureUrl = [];
@@ -137,6 +150,7 @@ const NewDetailForm = Form.create()(React.createClass({
                 thePictureUrl = picArr.join(",");
 			};
             if (!err) {
+				let publishPages =(values.publishPages).join(',')
                 this.setState({
                     loading: true
                 });
@@ -144,26 +158,21 @@ const NewDetailForm = Form.create()(React.createClass({
                     method: "post",
 					dataType: "json",
 					async:true,
-                    url: this.props.data.id ? globalConfig.context + '/api/user/achievement/update' : globalConfig.context + '/api/user/achievement/apply',
+                    url: this.props.data.id ? globalConfig.context + '/api/admin/news/updateNews' : globalConfig.context + '/api/admin/news/apply',
                     data: {
-                        id: this.props.data.id,
-						name: values.name,
-                        fieldA: values.industryCategory ? values.industryCategory[0] : undefined,
-                        fieldB: values.industryCategory ? values.industryCategory[1] : undefined,
-                        dataCategory: values.dataCategory,
-                        category: values.category,
-                        technicalPictureUrl: thePictureUrl,
-						introduction:values.introduction,
-						maturity:values.maturity,
-						innovation:values.innovation,
-						transferMode:values.transferMode,
+						id: this.props.data.id,
+						type:0,
+						title: values.title,
+                        author: values.author,
+                        titleImg: thePictureUrl,
+						content:this.state.edit.content,
+						hot:values.hot,
+						source:values.source,
+						sourceUrl:values.sourceUrl,
 						auditStatus:index,
-                        patentCase: values.patentCase,
-						teamDes: values.teamDes,
-						parameter: values.parameter,
-						boutique: values.boutique,
-						isHot:values.isHot,
-						publishPages:values.publishPages,
+                        summary: values.summary,
+						provinceId: (values.ProvinceCity)[0],
+						publishPages:publishPages
                     }
                 }).done(function (data) {
                     this.setState({
@@ -183,27 +192,6 @@ const NewDetailForm = Form.create()(React.createClass({
             }
         });
 	},
-	submission(e,index){
-		this.handleSubmit(e,index);
-		$.ajax({
-            method: "POST",
-            dataType: "json",
-			crossDomain: false,
-			async:true,
-            url: globalConfig.context + "/api/user/achievement/commit",
-            data: {
-				id: this.state.id,
-            }
-        }).done(function (data) {
-            if (!data.error.length) {
-                this.setState({
-                    loading: false,
-                });
-            } else {
-                message.warning(data.error[0].message);
-            };
-        }.bind(this));
-    },
 	cancelFun(){
 		this.props.closeDesc();
 	},
@@ -212,9 +200,10 @@ const NewDetailForm = Form.create()(React.createClass({
             this.loadData(this.props.data.id);
         } else {
 			this.state.data = {};
-			this.state.tags = [];
+			this.state.edit={};
+			this.state.pictureUrl = [];
 			this.setState({
-				publishPages:['app_achievement_list','web_achievement_list']
+				publishPages:['web_index','app_policy_index']
 			})
         };
     },
@@ -226,10 +215,11 @@ const NewDetailForm = Form.create()(React.createClass({
                 this.loadData(nextProps.data.id);
             } else {
 				this.state.data = {};
+				this.state.edit={};
 				this.state.pictureUrl = [];
 				this.state.theData={};
 				this.setState({
-					publishPages:['app_achievement_list','web_achievement_list']
+					publishPages:['web_index','app_policy_index']
 				})
             };
 			this.props.form.resetFields();
@@ -243,16 +233,16 @@ const NewDetailForm = Form.create()(React.createClass({
             labelCol: { span: 6 },
             wrapperCol: { span: 12 },
 		};
-		this.state.edit ={};
+		
         return (
 			<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('name', {
+							{getFieldDecorator('title', {
 								rules: [ { required: true, message: '此项为必填项!' } ],
-								initialValue: theData.name
+								initialValue: theData.title
 							})(<Input placeholder="请输入您的新闻标题" />)}
 						</FormItem>
 					</div>
@@ -269,14 +259,14 @@ const NewDetailForm = Form.create()(React.createClass({
 							)}
 						</FormItem>
 						<FormItem className="half-item" {...formItemLayout} label="新闻来源">
-							{getFieldDecorator('name', {
+							{getFieldDecorator('source', {
 								rules: [ { required: true, message: '此项为必填项!' } ],
-								initialValue: theData.name
+								initialValue: theData.source
 							})(<Input placeholder="请输入新闻来源" />)}
 						</FormItem>
 						<FormItem className="half-item" {...formItemLayout} label="来源链接">
-							{getFieldDecorator('url', {
-								initialValue: theData.url
+							{getFieldDecorator('sourceUrl', {
+								initialValue: theData.sourceUrl
 							})(<Input placeholder="请输入新闻来源链接" />)}
 						</FormItem>
 						<FormItem className="half-item" 
@@ -285,9 +275,9 @@ const NewDetailForm = Form.create()(React.createClass({
 							> 
 							{getFieldDecorator('ProvinceCity', {
 								rules: [ { required: true, message: '此项为必填项!' } ],
-								initialValue: theData.ProvinceCity
+								initialValue: this.state.Province
 							})(
-							 <Cascader options={areaSelect()}   placeholder="选择城市" />
+							 <Cascader options={provinceSelect()}   placeholder="选择城市" />
 							 )}
 						</FormItem>
 					</div>
@@ -302,30 +292,25 @@ const NewDetailForm = Form.create()(React.createClass({
 					</div>
 					<div className="clearfix">
 						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="新闻简介">
-							{getFieldDecorator('introduction', {
+							{getFieldDecorator('summary', {
 								rules: [ { required: true, message: '此项为必填项!' } ],
-								initialValue: theData.introduction
+								initialValue: theData.summary
 							})(<Input type="textarea" rows={4} placeholder="输入新闻简介" />)}
 						</FormItem>
 					</div>
 					<div className="clearfix">
 						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label={<span><i style={{color:"red",fontSize:14}}> * </i>新闻正文</span>}>
 							<Editors textContent={this.state.edit.content}
-								uploadUrl={'/api/admin/news/upload'}
-								uploadSign={'news_content_picture'}
+								uploadUrl={'/api/user/demand/uploadPicture'}
+								uploadSign={'demand_picture'}
 								handleRichText={(value) => { this.state.edit.content = value; }}
 								visible={this.state.visible} />
 						</FormItem>
 					</div>
 					
-					{theData.auditInfo&&<div className="clearfix">
-						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="审核信息">
-							<span>{theData.auditInfo}</span>
-						</FormItem>
-					</div>}
 					{theData.createTime&&<div className="clearfix">
-						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="发布时间">
-							<span>{theData.createTime}</span>
+						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="是否发布">
+							<span>{theData.releaseStatus?'已发布':'未发布'}</span>
 						</FormItem>
 					</div>}
 					<div className="clearfix">
@@ -338,10 +323,10 @@ const NewDetailForm = Form.create()(React.createClass({
 							})(
 								<Checkbox.Group>
 									<Row>
-										<Col span={6}><Checkbox value="web_index">网站新闻首页</Checkbox></Col>
-										<Col span={6}><Checkbox value="web_achievement_main">网站科技服务主页</Checkbox></Col>
-										<Col span={6}><Checkbox value="web_achievement_list" disabled>app政策主页</Checkbox></Col>
-										<Col span={6}><Checkbox value="app_index">APP科技服务首页</Checkbox></Col>
+										<Col span={6}><Checkbox value="web_index" disabled>网站新闻首页</Checkbox></Col>
+										<Col span={6}><Checkbox value="web_tech_service_index">网站科技服务首页</Checkbox></Col>
+										<Col span={6}><Checkbox value="app_policy_index" disabled>app政策首页</Checkbox></Col>
+										<Col span={6}><Checkbox value="app_tech_service_index">APP科技服务首页</Checkbox></Col>
 									</Row>
 								</Checkbox.Group>
 							)}
@@ -356,11 +341,7 @@ const NewDetailForm = Form.create()(React.createClass({
 								className="set-submit"
 								type="ghost"
 								onClick={(e) => {
-									if(this.props.data.id){
-										this.submission(e,1)
-									}else{
-										this.handleSubmit(e,1)
-									}
+										this.handleSubmit(e,2)
 								}}
 							>
 								发布新闻

+ 25 - 27
js/component/administration/news/newsList.jsx

@@ -19,14 +19,13 @@ const DemandList = React.createClass({
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/api/user/achievement/list",
+            url: globalConfig.context + "/api/admin/news/list",
             data: {
                 pageNo: pageNo || 1,
                 pageSize: this.state.pagination.pageSize,
-                name: this.state.nameSearch, //需求名称
-                startDate: this.state.releaseDate[0],
-                endDate: this.state.releaseDate[1],
-                dataCategory:this.state.dataCategorySearch,
+                title: this.state.nameSearch, //需求名称
+                startCreateTime: this.state.releaseDate[0],
+                endCreateTime: this.state.releaseDate[1],
                 auditStatus:this.state.auditStatusSearch,
             },
             success: function (data) {
@@ -41,9 +40,9 @@ const DemandList = React.createClass({
                         theArr.push({
                             key: i,
                             id: thisdata.id,
-                            serialNumber: thisdata.serialNumber, //编号
-                            name: thisdata.name,
-                            dataCategory: thisdata.dataCategory,
+                            title: thisdata.title,
+                            author:thisdata.author,
+                            source: thisdata.source,
                             auditStatus: thisdata.auditStatus, //审核状态
                             releaseDate:thisdata.releaseDate?(new Date(thisdata.releaseDate)).toLocaleString():''
                         });
@@ -88,17 +87,14 @@ const DemandList = React.createClass({
             },
             columns: [
                 {
-                    title: '编号',
-                    dataIndex: 'serialNumber',
-                    key: 'serialNumber',
-                }, {
                     title: '新闻名称',
-                    dataIndex: 'name',
-                    key: 'name',
+                    dataIndex: 'title',
+                    key: 'title',
                 },  {
                     title: '创建人',
-                    dataIndex: 'admin',
-                    key: 'admin'
+                    dataIndex: 'author',
+                    key: 'author',
+                    render:text=>{return <span>管理员</span>}
                 },
                 {
                     title: '发布状态',
@@ -108,8 +104,8 @@ const DemandList = React.createClass({
                 },
                 {
                     title: '来源',
-                    dataIndex: 'admins',
-                    key: 'admins'
+                    dataIndex: 'source',
+                    key: 'source'
                 },
                 {
                     title: '发布时间',
@@ -123,7 +119,7 @@ const DemandList = React.createClass({
                     render:(text,recard) => {
                         return  <div className="btnRight">
                                    {recard.auditStatus!='1'&&recard.auditStatus!='2'&&<Button type="primary" style={{ background: "#3fcf9e", border: "none", color: "#fff" }} onClick={(e)=>{e.stopPropagation(),this.submission(recard)}}>发布</Button>}
-                                   {/* {recard.auditStatus!='1'&&recard.auditStatus!='2'&&<Button type="danger"  onClick={(e)=>{e.stopPropagation;this.delectRow(recard)}}>删除</Button>} */}
+                                   <Button type="danger"  onClick={(e)=>{e.stopPropagation();this.delectRow(recard)}}>删除</Button>
                                    {recard.auditStatus!='1'&&recard.auditStatus=='2'&&<Button type="success" onClick={(e)=>{ e.stopPropagation(),this.updateFun(recard)}}>刷新发布</Button>}
                                    {recard.auditStatus!='1'&&recard.auditStatus=='2'&&<Button type="danger" onClick={(e)=>{e.stopPropagation(),this.revokeFun(recard)}}>撤销发布</Button>}
                                 </div>
@@ -144,9 +140,10 @@ const DemandList = React.createClass({
             method: "POST",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/api/user/achievement/commit",
+            url: globalConfig.context + "/api/admin/news/updateStatus",
             data: {
-				id:record.id
+                id:record.id,
+                auditStatus:2
             }
         }).done(function (data) {
             if (!data.error.length) {
@@ -169,10 +166,11 @@ const DemandList = React.createClass({
             method: "POST",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context +'/api/user/achievement/refreshPublish',
+            url: globalConfig.context +'/api/admin/news/updateStatus',
             data: {
                 id: recard.id,
-                auditStatus:recard.auditStatus
+                auditStatus:recard.auditStatus,
+                refresh:1
             }
         }).done(function (data) {
             if (!data.error.length) {
@@ -195,9 +193,10 @@ const DemandList = React.createClass({
             method: "POST",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context +  '/api/user/achievement/offShelf',
+            url: globalConfig.context +  '/api/admin/news/updateStatus',
             data: {
                 id: recard.id,
+                auditStatus:4,
             }
         }).done(function (data) {
             if (!data.error.length) {
@@ -228,9 +227,9 @@ const DemandList = React.createClass({
             method: "POST",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/api/user/demand/delete",
+            url: globalConfig.context + "/api/admin/news/deleteById",
             data: {
-                ids: recard.id
+                id: recard.id
             }
         }).done(function (data) {
             if (!data.error.length) {
@@ -282,7 +281,6 @@ const DemandList = React.createClass({
             }
         };
         const { RangePicker } = DatePicker;
-        this.state.dataSource = [{key:1,id:1,auditStatus:0},{key:2,id:1,auditStatus:1},{key:3,id:1,auditStatus:2},{key:4,id:1,auditStatus:3}]
         return (
             <div className="user-content" >
                 <div className="content-title">

+ 5 - 5
js/component/dataDic.js

@@ -2231,13 +2231,13 @@ module.exports = {
 	        value: "web_index",
 	        key: "网站新闻首页"
 	    },{
-	        value: "web_achievement_main",
-	        key: "网站科技服务页"
+	        value: "web_tech_service_index",
+	        key: "网站科技服务页"
 	    }, {
-	        value: "web_achievement_list",
-	        key: "app政策页"
+	        value: "app_policy_index",
+	        key: "app政策页"
 	    },{
-	        value: "app_index",
+	        value: "app_tech_service_index",
 	        key: "APP科技服务首页"
 	    }
     ],