liting2017 преди 6 години
родител
ревизия
9d8c5c23b2

+ 1 - 0
js/component/administration/policy/policyForm.jsx

@@ -338,6 +338,7 @@ const NewDetailForm = Form.create()(React.createClass({
 										<Col span={6}><Checkbox value="web_policy_main" disabled>网站政策列表首页</Checkbox></Col>
 										<Col span={6}><Checkbox value="web_tech_service_index">网站交易首页</Checkbox></Col>
 										<Col span={6}><Checkbox value="app_index">APP首页</Checkbox></Col>
+										<Col span={6}><Checkbox value="web_community">社区</Checkbox></Col>
 										<Col span={6}><Checkbox value="app_policy_main" disabled>app政策首页</Checkbox></Col>
 									</Row>
 								</Checkbox.Group>

+ 1 - 1
js/component/administration/product/proDesc.jsx

@@ -43,7 +43,7 @@ class DemandDesc extends React.Component {
 				>
 					<div>
 						<div>
-								{data.auditStatus=='1'||data.auditStatus=='2'?
+								{data.status=='1'?
 									<NewDetaiel
 									closeDesc={this.handleCancel.bind(this)}
 									data={this.props.data}

+ 19 - 19
js/component/administration/product/proDetails.jsx

@@ -9,7 +9,7 @@ import {
 	Form,
 } from 'antd';
 import '../policy/policy.less';
-import {getReleaseStateList,splitUrl,getProductType,getSpecialType} from '@/tools';
+import {getProStatus,splitUrl,getProductType,getSpecialType} 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/admin/news/detail' ,
+            url: globalConfig.context +  '/api/admin/community/getCommunintyById' ,
             data: {
                 id: id
             },
@@ -51,7 +51,7 @@ const NewDetail = Form.create()(React.createClass({
                     eleDiv:eleDiv,
                     edit:{content:thisData.content},
                     auditStatus:thisData.auditStatus,
-                    pictureUrl: thisData.titleImg ? splitUrl(thisData.titleImg, ',', globalConfig.avatarHost + '/upload') : []
+                    pictureUrl: thisData.picUrl ? splitUrl(thisData.picUrl, ',', globalConfig.avatarHost + '/upload') : []
                 });
             }.bind(this),
         }).always(function () {
@@ -101,10 +101,10 @@ const NewDetail = Form.create()(React.createClass({
             method: "POST",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context +  '/api/admin/news/updateStatus',
+            url: globalConfig.context +  '/api/admin/community/updateCommunity',
             data: {
                 id: this.state.id,
-                auditStatus:4,
+                status:3,
             }
         }).done(function (data) {
             if (!data.error.length) {
@@ -159,15 +159,10 @@ const NewDetail = Form.create()(React.createClass({
 							<span>{theData.source}</span>
 						</FormItem>
                         <FormItem className="half-item" {...formItemLayout} label="产品类型">
-							<span>{getProductType(theData.type)}</span>
+							<span>{getProductType(theData.category)}</span>
 						</FormItem>
 					</div>
                     <div>
-                    	<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="来源链接">
-							<span>{theData.sourceUrl}</span>
-						</FormItem>
-                    </div> 
-                    <div>
                     	<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="关键字">
 							<span>{theData.keyword}</span>
 						</FormItem>
@@ -193,17 +188,25 @@ const NewDetail = Form.create()(React.createClass({
 					</FormItem>
                     <div className="clearfix">
 						<FormItem className="half-item" {...formItemLayout} label="发布状态">
-							<span>{getReleaseStateList(theData.auditStatus)}</span>
+							<span>{getProStatus(theData.status)}</span>
 						</FormItem>
-                       
                         <FormItem className="half-item" {...formItemLayout} label="发布时间">
-                            <span>{theData.releaseDate?(new Date(theData.releaseDate)).toLocaleString():''}</span>
+                            <span>{theData.releaseTime?(new Date(theData.releaseTime)).toLocaleString():''}</span>
                         </FormItem>
                         <FormItem className="half-item" {...formItemLayout} label="是否置顶">
 							<span>{theData.top=='1'?'是':'否'}</span>
 						</FormItem>
                         <FormItem className="half-item" {...formItemLayout} label="是否推荐">
-                            <span>{theData.top=='1'?'是':'否'}</span>
+                            <span>{theData.recommend=='1'?'是':'否'}</span>
+                        </FormItem>
+                        <FormItem className="half-item" {...formItemLayout} label="阅读量">
+							<span>{theData.readNumber||0}</span>
+						</FormItem>
+                        <FormItem className="half-item" {...formItemLayout} label="评论量">
+                            <span>{theData.commentNumber||0}</span>
+                        </FormItem>
+                        <FormItem className="half-item" {...formItemLayout} label="点赞量">
+                            <span>{theData.starNumber||0}</span>
                         </FormItem>
 					</div>
                     <div className="clearfix breakWord">
@@ -215,10 +218,7 @@ const NewDetail = Form.create()(React.createClass({
 						</FormItem>
 					</div>
 					<div className="clearfix">
-						{this.props.data.auditStatus=='2'&&<FormItem wrapperCol={{ span: 12, offset: 3 }}>
-							<Button className="set-submit" type="primary"  onClick={(e)=>{this.updateFun()}} >
-								刷新发布
-							</Button>
+						{this.props.data.status=='1'&&<FormItem wrapperCol={{ span: 12, offset: 3 }}>
 							<Button type="danger" style={{marginRight:20}} onClick={(e)=>{this.revokeFun()}}>
 								撤销发布
 							</Button>

+ 33 - 26
js/component/administration/product/proForm.jsx

@@ -10,6 +10,7 @@ import {
 	Select,
 } from 'antd';
 import {productType} from '@/dataDic.js';
+import {getProStatus} from '@/tools.js'
 import Editors from '@/richTextEditors';
 import Crop from '@/crop/cropBlock';
 import KeyWordTagGroup from '@/crop/keyword';
@@ -36,7 +37,7 @@ const NewDetailForm = Form.create()(React.createClass({
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context +  '/api/admin/news/detail' ,
+            url: globalConfig.context +  '/api/admin/community/getCommunintyById' ,
             data: {
                 id: id
             },
@@ -49,13 +50,12 @@ const NewDetailForm = Form.create()(React.createClass({
                     thisData = {};
 				};
                 this.setState({
-					type:thisData.type,
 					id:thisData.id,
 					data: thisData,
-					tags:thisData.keywords||[],
-					auditStatus:thisData.auditStatus,
+					tags:(thisData.keyword).split(',')||[],
+					status:thisData.status,
 					edit:thisData.content,
-                    pictureUrl: thisData.coverUrl ? thisData.coverUrl.split(',') : []
+                    pictureUrl: thisData.picUrl ? thisData.picUrl.split(',') : []
                 });
             }.bind(this),
         }).always(function () {
@@ -83,20 +83,18 @@ const NewDetailForm = Form.create()(React.createClass({
                     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/community/updateCommunity' : globalConfig.context + '/api/admin/community/insertCommunity',
                     data: {
 						id: this.props.data.id,
 						title: values.title,
-                        author: values.author,
-                        titleImg: this.state.pictureUrl.join(','),
+                        picUrl: this.state.pictureUrl.join(','),
 						content:this.state.edit,
-						hot:values.hot,
+						category:values.category,
+						recommend:values.recommend,
+						top:values.top,
 						source:values.source,
-						sourceUrl:values.sourceUrl,
-						keyword:values.keyword,
-						auditStatus:index,
+						status:index,
 						keyword: this.state.tags ? this.state.tags.join(",") : '',
-						keywords: this.state.tags,
                         summary: values.summary,
                     }
                 }).done(function (data) {
@@ -168,9 +166,9 @@ const NewDetailForm = Form.create()(React.createClass({
 							})(<Input placeholder="请输入您的专栏标题" />)}
 						</FormItem>
 						<FormItem className="half-item" {...formItemLayout} label="产品类型">
-							{getFieldDecorator('productType', {
+							{getFieldDecorator('category', {
 								rules: [ { required: true, message: '此项为必填项!' } ],
-								initialValue: theData.productType!=undefined?String(theData.type):theData.type
+								initialValue: theData.category!=undefined?String(theData.category):theData.category
 							})(
 								<Select placeholder="产品类型">
 								{
@@ -187,11 +185,11 @@ const NewDetailForm = Form.create()(React.createClass({
 								initialValue: theData.source
 							})(<Input placeholder="请输入来源" />)}
 						</FormItem>
-						<FormItem className="half-item" {...formItemLayout} label="来源链接">
+						{/* <FormItem className="half-item" {...formItemLayout} label="来源链接">
 							{getFieldDecorator('sourceUrl', {
 								initialValue: theData.sourceUrl
 							})(<Input placeholder="请输入来源链接" />)}
-						</FormItem>
+						</FormItem> */}
 					</div>
 					<div className="clearfix">
 						<FormItem  labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="关键字">
@@ -209,8 +207,8 @@ const NewDetailForm = Form.create()(React.createClass({
 								getAllImg={(e)=>{this.setState({pictureUrl:e})}}
 								number = {1} 
 								aspectRatio = {2/1}
-								url ={globalConfig.context + '/api/admin/video/upload'}
-								uploadData = {{sign:'video_cover'}} 
+								url ={globalConfig.context + '/api/admin/community/upload'}
+								uploadData = {{sign:'knowledge_base'}} 
 								urlArr = {this.state.pictureUrl} 
 							/>
 						</FormItem>
@@ -233,14 +231,14 @@ const NewDetailForm = Form.create()(React.createClass({
 						</FormItem>
 					</div>
 					<div className="clearfix">
-						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="是否发布">
-							<span>{theData.releaseStatus?'已发布':'未发布'}</span>
+						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="发布状态">
+							<span>{getProStatus(theData.status)}</span>
 						</FormItem>
 					</div>
 					<div  className="clearfix">
 						<FormItem className="half-item" {...formItemLayout} label="置顶">
-							{getFieldDecorator('hot', {
-								initialValue: theData.hot
+							{getFieldDecorator('top', {
+								initialValue: theData.top
 							})(
 								<Radio.Group>
 									<Radio value={0}>否</Radio>
@@ -249,8 +247,8 @@ const NewDetailForm = Form.create()(React.createClass({
 							)}
 						</FormItem>
 						<FormItem className="half-item" {...formItemLayout} label="推荐">
-							{getFieldDecorator('hot1', {
-								initialValue: theData.hot1
+							{getFieldDecorator('recommend', {
+								initialValue: theData.recommend
 							})(
 								<Radio.Group>
 									<Radio value={0}>否</Radio>
@@ -258,6 +256,15 @@ const NewDetailForm = Form.create()(React.createClass({
 								</Radio.Group>
 							)}
 						</FormItem>
+						<FormItem className="half-item" {...formItemLayout} label="阅读量">
+							<span>{theData.readNumber||0}</span>
+						</FormItem>
+                        <FormItem className="half-item" {...formItemLayout} label="评论量">
+                            <span>{theData.commentNumber||0}</span>
+                        </FormItem>
+                        <FormItem className="half-item" {...formItemLayout} label="点赞量">
+                            <span>{theData.starNumber||0}</span>
+                        </FormItem>
 					</div>
 					<div className="clearfix">
 						<FormItem wrapperCol={{ span: 12, offset: 3 }}>
@@ -268,7 +275,7 @@ const NewDetailForm = Form.create()(React.createClass({
 								className="set-submit"
 								type="ghost"
 								onClick={(e) => {
-										this.handleSubmit(e,2)
+										this.handleSubmit(e,1)
 								}}
 							>
 								发布新闻

+ 28 - 81
js/component/administration/product/proList.jsx

@@ -5,8 +5,8 @@ import moment from 'moment';
 import '@/account/demand/techDemand.less';
 import NewDesc from '@/administration/product/proDesc';
 import '@/administration/news/news.less';
-import {releaseStateList,productType } from '@/dataDic.js';
-import {getReleaseStateList,getProductType } from '@/tools.js';
+import {proStatus,productType } from '@/dataDic.js';
+import {getProStatus,getProductType } from '@/tools.js';
 
 const DemandList = React.createClass({
     loadData(pageNo) {
@@ -20,15 +20,15 @@ const DemandList = React.createClass({
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/api/admin/news/list",
+            url: globalConfig.context + "/api/admin/community/list",
             data: {
                 pageNo: pageNo || 1,
                 pageSize: this.state.pagination.pageSize,
                 title: this.state.nameSearch, //需求名称
-                startCreateTime: this.state.releaseDate[0],
-                endCreateTime: this.state.releaseDate[1],
-                auditStatus:this.state.auditStatusSearch,
-                type:this.state.typeSearch
+                startTime: this.state.releaseDate[0],
+                endTime: this.state.releaseDate[1],
+                status:this.state.auditStatusSearch,
+                category:this.state.typeSearch
             },
             success: function (data) {
                 let theArr = [];
@@ -43,10 +43,10 @@ const DemandList = React.createClass({
                             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():''
+                            category:thisdata.category,
+                            status: thisdata.status,
+                            source:thisdata.source,
+                            releaseTime:thisdata.releaseTime?(new Date(thisdata.releaseTime)).toLocaleString():''
                         });
                     };
                 };
@@ -95,15 +95,15 @@ const DemandList = React.createClass({
                 }, 
                 {
                     title: '产品类型',
-                    dataIndex: 'author1',
-                    key: 'author1',
+                    dataIndex: 'category',
+                    key: 'category',
                     render:text=>{return getProductType(text)}
                 },
                 {
                     title: '发布状态',
-                    dataIndex: 'auditStatus',
-                    key: 'auditStatus',
-                    render: text => { return getReleaseStateList(text) }
+                    dataIndex: 'status',
+                    key: 'status',
+                    render: text => { return getProStatus(text) }
                 },
                 {
                     title: '来源',
@@ -112,8 +112,8 @@ const DemandList = React.createClass({
                 },
                 {
                     title: '发布时间',
-                    dataIndex: 'releaseDate',
-                    key: 'releaseDate'
+                    dataIndex: 'releaseTime',
+                    key: 'releaseTime'
                 },
                 {
                     title: '操作',
@@ -121,9 +121,8 @@ const DemandList = React.createClass({
                     key: 'caozuo',
                     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="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>}
+                                   {recard.status!='1'&&<Button type="primary" style={{ background: "#3fcf9e", border: "none", color: "#fff" }} onClick={(e)=>{e.stopPropagation(),this.submission(recard,1)}}>发布</Button>}
+                                   {recard.status=='1'&&<Button type="danger" onClick={(e)=>{e.stopPropagation(),this.submission(recard,3)}}>撤销发布</Button>}
                                 </div>
                     }
                 }
@@ -133,7 +132,7 @@ const DemandList = React.createClass({
         };
     },
     //发布
-    submission(record){
+    submission(record,status){
         this.setState({
             showDesc:false,
             loading:true
@@ -142,14 +141,14 @@ const DemandList = React.createClass({
             method: "POST",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/api/admin/news/updateStatus",
+            url: globalConfig.context + "/api/admin/community/updateCommunity",
             data: {
                 id:record.id,
-                auditStatus:2
+                status:status
             }
         }).done(function (data) {
             if (!data.error.length) {
-                message.success('发布成功.');
+                message.success('操作成功.');
                 this.setState({
                     loading: false,
                 });
@@ -159,59 +158,6 @@ const DemandList = React.createClass({
             };
         }.bind(this));
     },
-    //刷新发布
-    updateFun(recard){
-        this.setState({
-            loading:true
-        })
-        $.ajax({
-            method: "POST",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context +'/api/admin/news/updateStatus',
-            data: {
-                id: recard.id,
-                auditStatus:recard.auditStatus,
-                refresh:1
-            }
-        }).done(function (data) {
-            if (!data.error.length) {
-                message.success('刷新成功!');
-                this.setState({
-                    loading: false,
-                });
-            } else {
-                message.warning(data.error[0].message);
-            };
-            this.loadData(this.state.page);
-        }.bind(this));
-    },
-    //撤销发布
-    revokeFun(recard){
-        this.setState({
-            loading:true
-        })
-        $.ajax({
-            method: "POST",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context +  '/api/admin/news/updateStatus',
-            data: {
-                id: recard.id,
-                auditStatus:4,
-            }
-        }).done(function (data) {
-            if (!data.error.length) {
-                message.success('撤销成功!');
-                this.setState({
-                    loading: false,
-                });
-                this.loadData(this.state.page);
-            } else {
-                message.warning(data.error[0].message);
-            };
-        }.bind(this));
-    },
     componentWillMount() {
         this.loadData();
     },
@@ -235,9 +181,10 @@ const DemandList = React.createClass({
             method: "POST",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/api/admin/news/deleteById",
+            url: globalConfig.context + "/api/admin/community/updateCommunity",
             data: {
-                id: deletedIds[0]
+                id: deletedIds[0],
+                status:2
             }
         }).done(function (data) {
             if (!data.error.length) {
@@ -307,7 +254,7 @@ const DemandList = React.createClass({
                         value={this.state.auditStatusSearch}
                         onChange={(e) => { this.setState({ auditStatusSearch: e }) }}>
                         {
-                            releaseStateList.map(item=>{
+                            proStatus.map(item=>{
                                 return <Select.Option value={item.value}  >{item.key}</Select.Option>
                             })
                         }

+ 29 - 9
js/component/dataDic.js

@@ -2254,9 +2254,13 @@ module.exports = {
 	        value: "web_tech_service_index",
 	        key: "网站交易首页"
 	    },{
+	        value: "web_community",
+	        key: "网站社区"
+        },{
 	        value: "app_index",
 	        key: "app首页"
-	    },{
+	    }
+        ,{
 	        value: "app_policy_main",
 	        key: "app政策首页"
 	    }
@@ -2540,6 +2544,10 @@ module.exports = {
 	    },{
 	        value: "1",
 	        key: "首页"
+        },
+        {
+	        value: "2",
+	        key: "社区"
 	    }
     ],
      //专栏类型
@@ -2555,20 +2563,32 @@ module.exports = {
     //产品类型
     productType:[
         {
-	        value: "0",
+	        value: "2",
 	        key: "高新"
 	    },{
-	        value: "1",
+	        value: "3",
 	        key: "军工"
 	    },{
-	        value: "2",
+	        value: "1",
 	        key: "知识产权"
 	    },{
-	        value: "3",
+	        value: "5",
 	        key: "科技项目"
-	    },{
-	        value: "4",
-	        key: "其他"
-	    }
+	    } 
     ],
+    //产品发布状态
+    proStatus:[
+        {
+            value: "0",
+	        key: "草稿" 
+        },
+        {
+            value: "1",
+	        key: "已发布" 
+        },
+        {
+            value: "3",
+	        key: "已撤销发布" 
+        }
+    ]
 };

+ 14 - 1
js/component/tools.js

@@ -94,7 +94,8 @@ import {
     videoStatus,
     videoPosition,
     specialType,
-    productType
+    productType,
+    proStatus
 } from './dataDic.js';
 
 import { provinceList} from './NewDicProvinceList.js';
@@ -1699,4 +1700,16 @@ module.exports = {
             return theType;
         }
     },
+    //产品发布状态
+    getProStatus: function (e) {
+        if (e||e=='0') {
+            let theType = '';
+            proStatus.map(function (item) {
+                if (item.value == e) {
+                    theType = item.key;
+                };
+            });
+            return theType;
+        }
+    },
 }

+ 1 - 1
webpack.config.js

@@ -158,7 +158,7 @@ module.exports = (function () {
             disableHostCheck: true,
             host: '192.168.0.188',
             port: 8088,
-            allowedHosts: ['127.0.0.1','192.168.0.20','192.168.0.99'],
+            allowedHosts: ['127.0.0.1','192.168.0.20','192.168.0.99','192.168.0.17'],
             headers: {
                 "Access-Control-Allow-Origin": "*"
             }