dev01 2 years ago
parent
commit
5de55b492f

+ 5 - 0
.idea/.gitignore

@@ -0,0 +1,5 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/

+ 12 - 0
.idea/jitao-client.iml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$">
+      <excludeFolder url="file://$MODULE_DIR$/.tmp" />
+      <excludeFolder url="file://$MODULE_DIR$/temp" />
+      <excludeFolder url="file://$MODULE_DIR$/tmp" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 6 - 0
.idea/misc.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="JavaScriptSettings">
+    <option name="languageLevel" value="JSX" />
+  </component>
+</project>

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/jitao-client.iml" filepath="$PROJECT_DIR$/.idea/jitao-client.iml" />
+    </modules>
+  </component>
+</project>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>

BIN
image/logo.png


BIN
image/logo2.png


+ 235 - 232
js/component/administration/policy/policyDetails.jsx

@@ -1,247 +1,250 @@
 import React from 'react';
 import $ from 'jquery/src/ajax';
 import {
-	Modal,
-	message,
-	Spin,
-	Upload,
-	Button,
-	Form,
+  Modal,
+  message,
+  Spin,
+  Upload,
+  Button,
+  Form,
 } from 'antd';
-import {getProvince} from '@/NewDicProvinceList';
+import { getProvince } from '@/NewDicProvinceList';
 import 'react-quill/dist/quill.bubble.css';
 import './policy.less'
-import {getReleaseStateList,getPolicyPosition,splitUrl} from '@/tools';
+import { getReleaseStateList, getPolicyPosition, splitUrl } from '@/tools';
 const NewDetail = Form.create()(React.createClass({
-    getInitialState() {
-        return {
-            visible: false,
-            loading: false,
-            auditStatus: 0,
-            textFileList: [],
-            videoFileList: [],
-            pictureUrl: [],
+  getInitialState() {
+    return {
+      visible: false,
+      loading: false,
+      auditStatus: 0,
+      textFileList: [],
+      videoFileList: [],
+      pictureUrl: [],
+    };
+  },
+  loadData(id) {
+    this.setState({
+      loading: true
+    });
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + '/api/admin/policy/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 = {};
         };
-    },
-    loadData(id) {
+        document.querySelector('.txt').innerHTML = '';
+        let ProvinceS = thisData.province,
+          ProvinceCity = getProvince(ProvinceS);
+        let eleDiv = document.createElement('div');
+        eleDiv.innerHTML = thisData.content;
+        document.querySelector('.txt').append(eleDiv);
         this.setState({
-            loading: true
+          id: thisData.id,
+          page: thisData.publishPages,
+          data: thisData,
+          eleDiv: eleDiv,
+          ProvinceCity: ProvinceCity,
+          edit: { content: thisData.content },
+          auditStatus: thisData.auditStatus,
+          pictureUrl: thisData.titleImg ? splitUrl(thisData.titleImg, ',', globalConfig.avatarHost + '/upload') : []
         });
-        $.ajax({
-            method: "get",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context +  '/api/admin/policy/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 = {};
-                };
-                document.querySelector('.txt').innerHTML='';
-                let ProvinceS = thisData.province, 
-                    ProvinceCity = getProvince(ProvinceS);
-                    let eleDiv = document.createElement('div');
-                    eleDiv.innerHTML=thisData.content;
-                    document.querySelector('.txt').append(eleDiv);
-                this.setState({
-                    id:thisData.id,
-                    page:thisData.publishPages,
-                    data: thisData,
-                    eleDiv:eleDiv,
-                    ProvinceCity:ProvinceCity,
-                    edit:{content:thisData.content},
-                    auditStatus:thisData.auditStatus,
-                    pictureUrl: thisData.titleImg ? splitUrl(thisData.titleImg, ',', globalConfig.avatarHost + '/upload') : []
-                });
-            }.bind(this),
-        }).always(function () {
-            this.setState({
-                loading: false
-            });
-        }.bind(this));
-    },
-   
-	cancelFun(){
-		this.props.closeDesc();
-    },
-    //刷新发布
-    updateFun(inex){
+      }.bind(this),
+    }).always(function () {
+      this.setState({
+        loading: false
+      });
+    }.bind(this));
+  },
+
+  cancelFun() {
+    this.props.closeDesc();
+  },
+  //刷新发布
+  updateFun(inex) {
+    this.setState({
+      loading: true
+    })
+    $.ajax({
+      method: "POST",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + '/api/admin/policy/updateStatus',
+      data: {
+        id: this.state.id,
+        auditStatus: this.state.auditStatus,
+        refresh: 1
+      }
+    }).done(function (data) {
+      if (!data.error.length) {
+        message.success('刷新成功!');
         this.setState({
-            loading:true
-        })
-        $.ajax({
-            method: "POST",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context +'/api/admin/policy/updateStatus',
-            data: {
-                id: this.state.id,
-                auditStatus:this.state.auditStatus,
-                refresh:1
-            }
-        }).done(function (data) {
-            if (!data.error.length) {
-                message.success('刷新成功!');
-                this.setState({
-                    loading: false,
-                });
-            } else {
-                message.warning(data.error[0].message);
-            };
-            this.props.handOk();
-           
-        }.bind(this));
-    },
-    //撤销发布
-    revokeFun(){
+          loading: false,
+        });
+      } else {
+        message.warning(data.error[0].message);
+      };
+      this.props.handOk();
+
+    }.bind(this));
+  },
+  //撤销发布
+  revokeFun() {
+    this.setState({
+      loading: true
+    })
+    $.ajax({
+      method: "POST",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + '/api/admin/policy/updateStatus',
+      data: {
+        id: this.state.id,
+        auditStatus: 4,
+      }
+    }).done(function (data) {
+      if (!data.error.length) {
+        message.success('撤销成功!');
         this.setState({
-            loading:true
-        })
-        $.ajax({
-            method: "POST",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context +  '/api/admin/policy/updateStatus',
-            data: {
-                id: this.state.id,
-                auditStatus:4,
-            }
-        }).done(function (data) {
-            if (!data.error.length) {
-                message.success('撤销成功!');
-                this.setState({
-                    loading: false,
-                });
-            } else {
-                message.warning(data.error[0].message);
-            };
-            this.props.handOk();
-        }.bind(this));
-    },
-    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.state.pictureUrl = [];
-            };
-            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.title}</span>
-						</FormItem>
-						<FormItem className="half-item" {...formItemLayout} label="热门">
-							<span>{theData.hot=='0'&&'否'}{theData.hot=='1'&&'是'}</span>
-						</FormItem>
-						<FormItem className="half-item" {...formItemLayout} label="政策来源">
-							<span>{theData.source}</span>
-						</FormItem>
-						
-                        <FormItem className="half-item" {...formItemLayout} label="省市区">
-							<span>{this.state.ProvinceCity}</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>
-                    </div>
-                    <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="政策图片">
-                        <div className="clearfix">
-                                <Upload className="demandDetailShow-upload"
-                                    listType="picture-card"
-                                    fileList={this.state.pictureUrl}                               
-                                    onPreview={(file) => {
-                                        this.setState({
-                                            previewImage: file.url || file.thumbUrl,
-                                            previewVisible: true,
-                                        });
-                                    }} >
-                                </Upload>
-                                <Modal maskClosable={false} footer={null}
-                                    visible={this.state.previewVisible}
-                                    onCancel={() => { this.setState({ previewVisible: false }) }}>
-                                    <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
-                                </Modal>
-                            </div> 
-					</FormItem>
-                    <div className="clearfix">
-						<FormItem className="half-item" {...formItemLayout} label="发布状态">
-							<span>{getReleaseStateList(theData.auditStatus)}</span>
-						</FormItem>
-                       
-                        <FormItem className="half-item" {...formItemLayout} label="发布时间">
-                            <span>{theData.releaseDate?(new Date(theData.releaseDate)).toLocaleString():''}</span>
-                        </FormItem>
-					</div>
-                    <div className="clearfix">
-                        <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="发布位置">
-                                <span>{getPolicyPosition(this.state.page)}</span>
-						</FormItem>
-                    </div>
-                    <div className="clearfix breakWord">
-						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="政策简介">
-							<span>{theData.summary}</span>
-						</FormItem>
-                        <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="政策正文">
-                        <div className="ql-editor">
-                            <div className="txt"></div>
-                        </div>
-						</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>
-							<Button type="danger" style={{marginRight:20}} onClick={(e)=>{this.revokeFun()}}>
-								撤销发布
-							</Button>
-							<Button className="set-submit" type="ghost" onClick={this.cancelFun}>
-								取消
-							</Button>
-						</FormItem>}
-					</div>
-				</Spin>
-			</Form>    
-		</div>
-        )
-    }
+          loading: false,
+        });
+      } else {
+        message.warning(data.error[0].message);
+      };
+      this.props.handOk();
+    }.bind(this));
+  },
+  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.state.pictureUrl = [];
+      };
+      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.title}</span>
+              </FormItem>
+              <FormItem className="half-item" {...formItemLayout} label="政策类型">
+                <span>{["政策","咨询","观点","百科"][theData.type]}</span>
+              </FormItem>
+              <FormItem className="half-item" {...formItemLayout} label="热门">
+                <span>{theData.hot == '0' && '否'}{theData.hot == '1' && '是'}</span>
+              </FormItem>
+              <FormItem className="half-item" {...formItemLayout} label="政策来源">
+                <span>{theData.source}</span>
+              </FormItem>
+
+              <FormItem className="half-item" {...formItemLayout} label="省市区">
+                <span>{this.state.ProvinceCity}</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>
+            </div>
+            <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="政策图片">
+              <div className="clearfix">
+                <Upload className="demandDetailShow-upload"
+                  listType="picture-card"
+                  fileList={this.state.pictureUrl}
+                  onPreview={(file) => {
+                    this.setState({
+                      previewImage: file.url || file.thumbUrl,
+                      previewVisible: true,
+                    });
+                  }} >
+                </Upload>
+                <Modal maskClosable={false} footer={null}
+                  visible={this.state.previewVisible}
+                  onCancel={() => { this.setState({ previewVisible: false }) }}>
+                  <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
+                </Modal>
+              </div>
+            </FormItem>
+            <div className="clearfix">
+              <FormItem className="half-item" {...formItemLayout} label="发布状态">
+                <span>{getReleaseStateList(theData.auditStatus)}</span>
+              </FormItem>
+
+              <FormItem className="half-item" {...formItemLayout} label="发布时间">
+                <span>{theData.releaseDate ? (new Date(theData.releaseDate)).toLocaleString() : ''}</span>
+              </FormItem>
+            </div>
+            <div className="clearfix">
+              <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="发布位置">
+                <span>{getPolicyPosition(this.state.page)}</span>
+              </FormItem>
+            </div>
+            <div className="clearfix breakWord">
+              <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="政策简介">
+                <span>{theData.summary}</span>
+              </FormItem>
+              <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="政策正文">
+                <div className="ql-editor">
+                  <div className="txt"></div>
+                </div>
+              </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>
+                <Button type="danger" style={{ marginRight: 20 }} onClick={(e) => { this.revokeFun() }}>
+                  撤销发布
+                </Button>
+                <Button className="set-submit" type="ghost" onClick={this.cancelFun}>
+                  取消
+                </Button>
+              </FormItem>}
+            </div>
+          </Spin>
+        </Form>
+      </div>
+    )
+  }
 }));
 export default NewDetail;
 

+ 368 - 353
js/component/administration/policy/policyForm.jsx

@@ -1,373 +1,388 @@
 import React from 'react';
 import $ from 'jquery/src/ajax';
 import {
-	Icon,
-	Modal,
-	message,
-	Spin,
-	Upload,
-	Input,
-	Button,
-	Radio,
-	Form,
-	Checkbox,
-	Cascader,
-    Row,
-    Col
+  Icon,
+  Modal,
+  message,
+  Spin,
+  Upload,
+  Input,
+  Button,
+  Radio,
+  Form,
+  Checkbox,
+  Cascader,
+  Row,
+  Col,
+  Select,
 } from 'antd';
-import {  splitUrl} from '@/tools.js';
-import {provinceSelect } from '@/NewDicProvinceList';
+import { splitUrl } from '@/tools.js';
+import { provinceSelect } from '@/NewDicProvinceList';
 import Editors from '@/richTextEditors';
 
 const PicturesWall = React.createClass({
-	getInitialState() {
-		return {
-			previewVisible: false,
-			previewImage: '',
-			fileList: [],
-			tags: []
-		};
-	},
-	handleCancel() {
-		this.setState({ previewVisible: false });
-	},
-	handlePreview(file) {
-		this.setState({
-			previewImage: file.url || file.thumbUrl,
-			previewVisible: true
-		});
-	},
-	handleChange(info) {
-		let fileList = info.fileList;
-		this.setState({ fileList });
-		this.props.fileList(fileList);
-	},
-	componentWillReceiveProps(nextProps) {
-		this.state.fileList = nextProps.pictureUrl;
-	},
-	render() {
-		const { previewVisible, previewImage, fileList } = this.state;
-		const uploadButton = (
-			<div>
-				<Icon type="plus" />
-				<div className="ant-upload-text">点击上传</div>
-			</div>
-		);
-		return (
-			<div className="clearfix">
-				<Upload
-					action={globalConfig.context + '/api/user/demand/uploadPicture'}
-					data={{ sign: 'demand_picture'}}
-					listType="picture-card"
-					fileList={fileList}
-					onPreview={this.handlePreview}
-					onChange={this.handleChange}
-				>
-					{fileList.length >= 2 ? null : uploadButton}
-				</Upload>
-				<Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
-					<img alt="example" style={{ width: '100%' }} src={previewImage} />
-				</Modal>
-			</div>
-		);
-	}
+  getInitialState() {
+    return {
+      previewVisible: false,
+      previewImage: '',
+      fileList: [],
+      tags: []
+    };
+  },
+  handleCancel() {
+    this.setState({ previewVisible: false });
+  },
+  handlePreview(file) {
+    this.setState({
+      previewImage: file.url || file.thumbUrl,
+      previewVisible: true
+    });
+  },
+  handleChange(info) {
+    let fileList = info.fileList;
+    this.setState({ fileList });
+    this.props.fileList(fileList);
+  },
+  componentWillReceiveProps(nextProps) {
+    this.state.fileList = nextProps.pictureUrl;
+  },
+  render() {
+    const { previewVisible, previewImage, fileList } = this.state;
+    const uploadButton = (
+      <div>
+        <Icon type="plus" />
+        <div className="ant-upload-text">点击上传</div>
+      </div>
+    );
+    return (
+      <div className="clearfix">
+        <Upload
+          action={globalConfig.context + '/api/user/demand/uploadPicture'}
+          data={{ sign: 'demand_picture' }}
+          listType="picture-card"
+          fileList={fileList}
+          onPreview={this.handlePreview}
+          onChange={this.handleChange}
+        >
+          {fileList.length >= 2 ? null : uploadButton}
+        </Upload>
+        <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
+          <img alt="example" style={{ width: '100%' }} src={previewImage} />
+        </Modal>
+      </div>
+    );
+  }
 });
- 
+
 const NewDetailForm = Form.create()(React.createClass({
-    getInitialState() {
-        return {
-            visible: false,
-            loading: false,
-            auditStatus: 0,
-            textFileList: [],
-            videoFileList: [],
-			pictureUrl: [],
-			tags:[],
-			edit:{}
+  getInitialState() {
+    return {
+      visible: false,
+      loading: false,
+      auditStatus: 0,
+      textFileList: [],
+      videoFileList: [],
+      pictureUrl: [],
+      tags: [],
+      edit: {}
+    };
+  },
+  loadData(id) {
+    this.setState({
+      loading: true
+    });
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + '/api/admin/policy/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 = {};
         };
-    },
-    loadData(id) {
+        let proArr = [];
+        proArr.push(thisData.province);
+        this.setState({
+          id: thisData.id,
+          data: thisData,
+          Province: proArr,
+          publishPages: thisData.publishPages ? thisData.publishPages : ['web_policy_main', 'app_policy_main'],
+          auditStatus: thisData.auditStatus,
+          edit: { content: thisData.content },
+          pictureUrl: thisData.titleImg ? splitUrl(thisData.titleImg, ',', globalConfig.avatarHost + '/upload') : []
+        });
+      }.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) => {
+      //url转化
+      if ((this.state.edit).content == undefined || !(this.state.edit).content || (this.state.edit).content == '<p><br></p>') {
+        message.warning('请填写政策正文');
+        return false;
+      }
+      let thePictureUrl = [];
+      if (this.state.pictureUrl.length) {
+        let picArr = [];
+        this.state.pictureUrl.map(function (item) {
+          if (item.response && item.response.data && item.response.data.length) {
+            picArr.push(item.response.data);
+          }
+        });
+        thePictureUrl = picArr.join(",");
+      };
+      if (!err) {
+        let publishPages = (values.publishPages).join(',')
         this.setState({
-            loading: true
+          loading: true
         });
         $.ajax({
-            method: "get",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context +  '/api/admin/policy/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 = {};
-				};
-				let proArr=[];
-				proArr.push(thisData.province);
-                this.setState({
-					id:thisData.id,
-					data: thisData,
-					Province:proArr,
-					publishPages:thisData.publishPages?thisData.publishPages:['web_policy_main','app_policy_main'],
-					auditStatus:thisData.auditStatus,
-					edit:{content:thisData.content},
-                    pictureUrl: thisData.titleImg ? splitUrl(thisData.titleImg, ',', globalConfig.avatarHost + '/upload') : []
-                });
-            }.bind(this),
-        }).always(function () {
+          method: "post",
+          dataType: "json",
+          async: true,
+          url: this.props.data.id ? globalConfig.context + '/api/admin/policy/update' : globalConfig.context + '/api/admin/policy/apply',
+          data: {
+            id: this.props.data.id,
+            type: values.type,
+            title: values.title,
+            author: values.author,
+            titleImg: thePictureUrl.length ? thePictureUrl : '',
+            content: this.state.edit.content,
+            hot: values.hot,
+            source: values.source,
+            sourceUrl: values.sourceUrl,
+            keyword: values.keyword,
+            auditStatus: index,
+            summary: values.summary,
+            province: (values.ProvinceCity)[0],
+            publishPages: publishPages
+          }
+        }).done(function (data) {
+          this.setState({
+            loading: false
+          });
+
+          if (!data.error.length) {
+            message.success('操作成功!');
             this.setState({
-                loading: false
+              visible: false
             });
+            this.props.handOk();
+          } else {
+            message.warning(data.error[0].message);
+          }
         }.bind(this));
-    },
-    getPictureUrl(e) {
-        this.setState({ pictureUrl: e });
-    },
-    handleSubmit(e,index) {
-		e.preventDefault();
-        this.props.form.validateFields((err, values) => {
-			//url转化
-			if((this.state.edit).content==undefined||!(this.state.edit).content||(this.state.edit).content=='<p><br></p>'){
-				message.warning('请填写政策正文');
-				return false;
-			}
-            let thePictureUrl = [];
-            if (this.state.pictureUrl.length) {
-                let picArr = [];
-                this.state.pictureUrl.map(function (item) {
-                    if ( item.response && item.response.data && item.response.data.length ){
-                        picArr.push(item.response.data);
-                    }
-                });
-                thePictureUrl = picArr.join(",");
-			};
-            if (!err) {
-				let publishPages =(values.publishPages).join(',')
-                this.setState({
-                    loading: true
-                });
-                $.ajax({
-                    method: "post",
-					dataType: "json",
-					async:true,
-                    url: this.props.data.id ? globalConfig.context + '/api/admin/policy/update' : globalConfig.context + '/api/admin/policy/apply',
-                    data: {
-						id: this.props.data.id,
-						type:0,
-						title: values.title,
-                        author: values.author,
-                        titleImg: thePictureUrl.length?thePictureUrl:'',
-						content:this.state.edit.content,
-						hot:values.hot,
-						source:values.source,
-						sourceUrl:values.sourceUrl,
-						keyword:values.keyword,
-						auditStatus:index,
-                        summary: values.summary,
-						province: (values.ProvinceCity)[0],
-						publishPages:publishPages
-                    }
-                }).done(function (data) {
-                    this.setState({
-                        loading: false
-					});
+      }
+    });
+  },
+  cancelFun() {
+    this.state.edit = {};
+    this.props.closeDesc();
+  },
+  componentWillMount() {
+    if (this.props.data.id) {
+      this.loadData(this.props.data.id);
+    } else {
+      this.state.data = {};
+      this.state.pictureUrl = [];
+      this.state.Province = undefined;
+      this.setState({
+        edit: { content: '<p><br></p>' },
+        publishPages: ['web_policy_main', 'app_policy_main']
+      })
+    };
+  },
+  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.state.pictureUrl = [];
+        this.state.theData = {};
+        this.state.Province = undefined;
+        this.setState({
+          edit: { content: '<p><br></p>' },
+          publishPages: ['web_policy_main', 'app_policy_main']
+        })
+      };
+      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 },
+    };
+    const formItemLayouts = {
+      labelCol: { span: 3 },
+      wrapperCol: { span: 18 },
+    };
+    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('title', {
+                  rules: [{ required: true, message: '此项为必填项!' }],
+                  initialValue: theData.title
+                })(<Input placeholder="请输入您的政策政策标题" />)}
+              </FormItem>
 
-                    if (!data.error.length) {
-                        message.success('操作成功!');
-                        this.setState({
-                            visible: false
-                        });
-                        this.props.handOk();
-                    } else {
-                        message.warning(data.error[0].message);
-                    }
-                }.bind(this));
-            }
-        });
-	},
-	cancelFun(){
-		this.state.edit={};
-		this.props.closeDesc();
-	},
-    componentWillMount() {
-        if (this.props.data.id) {
-            this.loadData(this.props.data.id);
-        } else {
-			this.state.data = {};
-			this.state.pictureUrl = [];
-			this.state.Province=undefined;
-			this.setState({
-				edit:{content:'<p><br></p>'},
-				publishPages:['web_policy_main','app_policy_main']
-			})
-        };
-    },
-    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.state.pictureUrl = [];
-				this.state.theData={};
-				this.state.Province=undefined;
-				this.setState({
-					edit:{content:'<p><br></p>'},
-					publishPages:['web_policy_main','app_policy_main']
-				})
-            };
-			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 },
-		};
-		const formItemLayouts = {
-            labelCol: { span: 3 },
-            wrapperCol: { span: 18 },
-		};
-        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('title', {
-								rules: [ { required: true, message: '此项为必填项!' } ],
-								initialValue: theData.title
-							})(<Input placeholder="请输入您的政策政策标题" />)}
-						</FormItem>
-					</div>
-					<div className="clearfix">
-					    <FormItem className="half-item" {...formItemLayout} label="热门">
-							{getFieldDecorator('hot', {
-								rules: [ { required: true, message: '此项为必填项!' } ],
-								initialValue: theData.hot
-							})(
-								<Radio.Group>
-									<Radio value={0}>否</Radio>
-									<Radio value={1}>是</Radio>
-								</Radio.Group>
-							)}
-						</FormItem>
-						<FormItem className="half-item" {...formItemLayout} label="政策来源">
-							{getFieldDecorator('source', {
-								rules: [ { required: true, message: '此项为必填项!' } ],
-								initialValue: theData.source
-							})(<Input placeholder="请输政策来源" />)}
-						</FormItem>
-						<FormItem className="half-item" {...formItemLayout} label="来源链接">
-							{getFieldDecorator('sourceUrl', {
-								initialValue: theData.sourceUrl
-							})(<Input placeholder="请输入政策来源链接" />)}
-						</FormItem>
-						<FormItem className="half-item" 
-							{...formItemLayout}
-							label="省-市-区"
-							> 
-							{getFieldDecorator('ProvinceCity', {
-								rules: [ { required: true, message: '此项为必填项!' } ],
-								initialValue: this.state.Province
-							})(
-							 <Cascader options={provinceSelect()}   placeholder="选择城市" />
-							 )}
-						</FormItem>
-						
-					</div>
-					<div className="clearfix">
-						<FormItem  {...formItemLayouts} label="关键字">
-							{getFieldDecorator('keyword', {
-								initialValue: theData.keyword
-							})(<Input placeholder="请输入关键字" />)}
-						</FormItem>
-					</div>
-					<div className="clearfix">
-						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="政策图片">
-							<PicturesWall
-								fileList={this.getPictureUrl}
-								pictureUrl={this.state.pictureUrl}
-								visible={this.props.visible}
-							/>
-						</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>
-					<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/user/demand/uploadPicture'}
-								uploadSign={'demand_picture'}
-								handleRichText={(value) => { this.state.edit.content = value; }}
-								visible={this.state.visible} />
-						</FormItem>
-					</div>
-					
-					{theData.createTime&&<div className="clearfix">
-						<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="是否发布">
-							<span>{theData.releaseStatus?'已发布':'未发布'}</span>
-						</FormItem>
-					</div>}
-					<div className="clearfix">
-						<FormItem className="full-item" 
-							labelCol={{ span: 3 }}
-							wrapperCol={{ span: 18 }} label="发布位置">
-							{getFieldDecorator('publishPages', {
-								rules: [ { required: false } ],
-								initialValue: this.state.publishPages
-							})(
-								<Checkbox.Group>
-									<Row>
-										<Col span={6}><Checkbox value="web_index" >网站首页</Checkbox></Col>
-										<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="app_policy_main" disabled>app政策首页</Checkbox></Col>
-									</Row>
-								</Checkbox.Group>
-							)}
-						</FormItem>
-					</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>
-        )
-    }
+              <FormItem className="half-item" {...formItemLayout} label="政策类型">
+                {getFieldDecorator('type', {
+                  rules: [{ required: true, message: '此项为必填项!' }],
+                  initialValue: theData.type
+                })(
+                  <Select placeholder="请选择政策类型">
+                    <Select.Option value={0} >政策</Select.Option>
+                    <Select.Option value={1} >咨询</Select.Option>
+                    <Select.Option value={2} >观点</Select.Option>
+                    <Select.Option value={3} >百科</Select.Option>
+                  </Select>
+                )}
+              </FormItem>
+            </div>
+            <div className="clearfix">
+              <FormItem className="half-item" {...formItemLayout} label="热门">
+                {getFieldDecorator('hot', {
+                  rules: [{ required: true, message: '此项为必填项!' }],
+                  initialValue: theData.hot
+                })(
+                  <Radio.Group>
+                    <Radio value={0}>否</Radio>
+                    <Radio value={1}>是</Radio>
+                  </Radio.Group>
+                )}
+              </FormItem>
+              <FormItem className="half-item" {...formItemLayout} label="政策来源">
+                {getFieldDecorator('source', {
+                  rules: [{ required: true, message: '此项为必填项!' }],
+                  initialValue: theData.source
+                })(<Input placeholder="请输政策来源" />)}
+              </FormItem>
+              <FormItem className="half-item" {...formItemLayout} label="来源链接">
+                {getFieldDecorator('sourceUrl', {
+                  initialValue: theData.sourceUrl
+                })(<Input placeholder="请输入政策来源链接" />)}
+              </FormItem>
+              <FormItem className="half-item"
+                {...formItemLayout}
+                label="省-市-区"
+              >
+                {getFieldDecorator('ProvinceCity', {
+                  rules: [{ required: true, message: '此项为必填项!' }],
+                  initialValue: this.state.Province
+                })(
+                  <Cascader options={provinceSelect()} placeholder="选择城市" />
+                )}
+              </FormItem>
+
+            </div>
+            <div className="clearfix">
+              <FormItem  {...formItemLayouts} label="关键字">
+                {getFieldDecorator('keyword', {
+                  initialValue: theData.keyword
+                })(<Input placeholder="请输入关键字" />)}
+              </FormItem>
+            </div>
+            <div className="clearfix">
+              <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="政策图片">
+                <PicturesWall
+                  fileList={this.getPictureUrl}
+                  pictureUrl={this.state.pictureUrl}
+                  visible={this.props.visible}
+                />
+              </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>
+            <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/user/demand/uploadPicture'}
+                  uploadSign={'demand_picture'}
+                  handleRichText={(value) => { this.state.edit.content = value; }}
+                  visible={this.state.visible} />
+              </FormItem>
+            </div>
+
+            {theData.createTime && <div className="clearfix">
+              <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="是否发布">
+                <span>{theData.releaseStatus ? '已发布' : '未发布'}</span>
+              </FormItem>
+            </div>}
+            <div className="clearfix">
+              <FormItem className="full-item"
+                labelCol={{ span: 3 }}
+                wrapperCol={{ span: 18 }} label="发布位置">
+                {getFieldDecorator('publishPages', {
+                  rules: [{ required: false }],
+                  initialValue: this.state.publishPages
+                })(
+                  <Checkbox.Group>
+                    <Row>
+                      <Col span={6}><Checkbox value="web_index" >网站首页</Checkbox></Col>
+                      <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="app_policy_main" disabled>app政策首页</Checkbox></Col>
+                    </Row>
+                  </Checkbox.Group>
+                )}
+              </FormItem>
+            </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;
 

+ 332 - 316
js/component/administration/policy/policyList.jsx

@@ -5,337 +5,353 @@ import moment from 'moment';
 import '@/account/demand/techDemand.less';
 import NewDesc from '@/administration/policy/policyDesc';
 import '@/administration/news/news.less';
-import {  } from '@/dataDic.js';
-import {getReleaseStateList, } from '@/tools.js';
+import { } from '@/dataDic.js';
+import { getReleaseStateList, } from '@/tools.js';
 
 const PolicyList = React.createClass({
-    loadData(pageNo) {
-        this.state.data = [];
-        this.setState({
-            page:pageNo,
-            loading: true
-        });
-        $.ajax({
-            method: "get",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context + "/api/admin/policy/list",
-            data: {
-                pageNo: pageNo || 1,
-                pageSize: this.state.pagination.pageSize,
-                title: this.state.nameSearch, //政策标题
-                startReleaseDate: this.state.releaseDate[0],
-                endReleaseDate: this.state.releaseDate[1],
-                auditStatus:this.state.auditStatusSearch,
-            },
-            success: function (data) {
-                let theArr = [];
-                if (!data.data || !data.data.list) {
-                    if (data.error && data.error.length) {
-                        message.warning(data.error[0].message);
-                    };
-                } 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():''
-                        });
-                    };
-                };
-                this.state.selectedRowKeys=[];
-                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.setState({
-                    dataSource: theArr,
-                    pagination: this.state.pagination
-                });
-            }.bind(this),
-        }).always(function () {
-            this.setState({
-                loading: false
+  loadData(pageNo) {
+    this.state.data = [];
+    this.setState({
+      page: pageNo,
+      loading: true
+    });
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/policy/list",
+      data: {
+        pageNo: pageNo || 1,
+        pageSize: this.state.pagination.pageSize,
+        title: this.state.nameSearch, //政策标题
+        type: this.state.type,
+        startReleaseDate: this.state.releaseDate[0],
+        endReleaseDate: this.state.releaseDate[1],
+        auditStatus: this.state.auditStatusSearch,
+      },
+      success: function (data) {
+        let theArr = [];
+        if (!data.data || !data.data.list) {
+          if (data.error && data.error.length) {
+            message.warning(data.error[0].message);
+          };
+        } 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,
+              type: thisdata.type,
+              author: thisdata.author,
+              source: thisdata.source,
+              auditStatus: thisdata.auditStatus, //审核状态
+              releaseDate: thisdata.releaseDate ? (new Date(thisdata.releaseDate)).toLocaleString() : ''
             });
-        }.bind(this));
-    },
-    getInitialState() {
-        return {
-            searchMore: true,
-            validityPeriodDate: [],
-            releaseDate: [],
-            selectedRowKeys: [],
-            selectedRows: [],
-            loading: false,
-            pagination: {
-                defaultCurrent: 1,
-                defaultPageSize: 10,
-                showQuickJumper: true,
-                pageSize: 10,
-                onChange: function (page) {
-                    this.loadData(page);
-                }.bind(this),
-                showTotal: function (total) {
-                    return '共' + total + '条数据';
-                }
-            },
-            columns: [
-                {
-                    title: '政策名称',
-                    dataIndex: 'title',
-                    key: 'title',
-                },  {
-                    title: '创建人',
-                    dataIndex: 'author',
-                    key: 'author',
-                    render:text=>{return <span>管理员</span>}
-                },
-                {
-                    title: '发布状态',
-                    dataIndex: 'auditStatus',
-                    key: 'auditStatus',
-                    render: text => { return getReleaseStateList(text) }
-                },
-                {
-                    title: '来源',
-                    dataIndex: 'source',
-                    key: 'source'
-                },
-                {
-                    title: '发布时间',
-                    dataIndex: 'releaseDate',
-                    key: 'releaseDate'
-                },
-                {
-                    title: '操作',
-                    dataIndex: 'caozuo',
-                    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>}
-                                </div>
-                    }
-                }
-            ],
-            dataSource: [],
-            searchTime: [,]
+          };
+        };
+        this.state.selectedRowKeys = [];
+        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
         };
-    },
-    //发布
-    submission(record){
         this.setState({
-            showDesc:false,
-            loading:true
+          dataSource: theArr,
+          pagination: this.state.pagination
         });
-        $.ajax({
-            method: "POST",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context + "/api/admin/policy/updateStatus",
-            data: {
-                id:record.id,
-                auditStatus:2
-            }
-        }).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));
-    },
-    //刷新发布
-    updateFun(recard){
-        this.setState({
-            loading:true
-        })
-        $.ajax({
-            method: "POST",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context +'/api/admin/policy/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){
+      }.bind(this),
+    }).always(function () {
+      this.setState({
+        loading: false
+      });
+    }.bind(this));
+  },
+  getInitialState() {
+    return {
+      searchMore: true,
+      validityPeriodDate: [],
+      releaseDate: [],
+      selectedRowKeys: [],
+      selectedRows: [],
+      loading: false,
+      pagination: {
+        defaultCurrent: 1,
+        defaultPageSize: 10,
+        showQuickJumper: true,
+        pageSize: 10,
+        onChange: function (page) {
+          this.loadData(page);
+        }.bind(this),
+        showTotal: function (total) {
+          return '共' + total + '条数据';
+        }
+      },
+      columns: [
+        {
+          title: '政策名称',
+          dataIndex: 'title',
+          key: 'title',
+        }, {
+          title: '政策类型',
+          dataIndex: 'type',
+          key: 'type',
+          render: text => { return <span>{["政策", "咨询", "观点", "百科"][text]}</span> }
+        }, {
+          title: '创建人',
+          dataIndex: 'author',
+          key: 'author',
+          render: text => { return <span>管理员</span> }
+        },
+        {
+          title: '发布状态',
+          dataIndex: 'auditStatus',
+          key: 'auditStatus',
+          render: text => { return getReleaseStateList(text) }
+        },
+        {
+          title: '来源',
+          dataIndex: 'source',
+          key: 'source'
+        },
+        {
+          title: '发布时间',
+          dataIndex: 'releaseDate',
+          key: 'releaseDate'
+        },
+        {
+          title: '操作',
+          dataIndex: 'caozuo',
+          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>}
+            </div>
+          }
+        }
+      ],
+      dataSource: [],
+      searchTime: [,]
+    };
+  },
+  //发布
+  submission(record) {
+    this.setState({
+      showDesc: false,
+      loading: true
+    });
+    $.ajax({
+      method: "POST",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/policy/updateStatus",
+      data: {
+        id: record.id,
+        auditStatus: 2
+      }
+    }).done(function (data) {
+      if (!data.error.length) {
+        message.success('发布成功.');
         this.setState({
-            loading:true
-        })
-        $.ajax({
-            method: "POST",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context +  '/api/admin/policy/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();
-    },
-    tableRowClick(record, index) {
-        this.state.RowData = record;
+          loading: false,
+        });
+        this.loadData(this.state.page)
+      } else {
+        message.warning(data.error[0].message);
+      };
+    }.bind(this));
+  },
+  //刷新发布
+  updateFun(recard) {
+    this.setState({
+      loading: true
+    })
+    $.ajax({
+      method: "POST",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + '/api/admin/policy/updateStatus',
+      data: {
+        id: recard.id,
+        auditStatus: recard.auditStatus,
+        refresh: 1
+      }
+    }).done(function (data) {
+      if (!data.error.length) {
+        message.success('刷新成功!');
         this.setState({
-            showDesc: true
+          loading: false,
         });
-    },
-    delectRow() {
+      } 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/policy/updateStatus',
+      data: {
+        id: recard.id,
+        auditStatus: 4,
+      }
+    }).done(function (data) {
+      if (!data.error.length) {
+        message.success('撤销成功!');
         this.setState({
-            loading:true
-        })
-        let deletedIds =[];
-        let rowItem = this.state.selectedRowKeys[0];
-        let data = this.state.dataSource ||[];
-        if (data.length) {
-            deletedIds.push(data[rowItem].id);
-        }
-        $.ajax({
-            method: "POST",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context + "/api/admin/policy/delete",
-            data: {
-                id: deletedIds[0]
-            }
-        }).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));
-    },
-    addClick() {
-        this.state.RowData = {};
+          loading: false,
+        });
+        this.loadData(this.state.page);
+      } else {
+        message.warning(data.error[0].message);
+      };
+    }.bind(this));
+  },
+  componentWillMount() {
+    this.loadData();
+  },
+  tableRowClick(record, index) {
+    this.state.RowData = record;
+    this.setState({
+      showDesc: true
+    });
+  },
+  delectRow() {
+    this.setState({
+      loading: true
+    })
+    let deletedIds = [];
+    let rowItem = this.state.selectedRowKeys[0];
+    let data = this.state.dataSource || [];
+    if (data.length) {
+      deletedIds.push(data[rowItem].id);
+    }
+    $.ajax({
+      method: "POST",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/policy/delete",
+      data: {
+        id: deletedIds[0]
+      }
+    }).done(function (data) {
+      if (!data.error.length) {
+        message.success('删除成功!');
         this.setState({
-            showDesc: true
+          loading: false
         });
-    },
-    closeDesc(e, s) {
-        this.state.showDesc = e;
-        if (s) {
-            this.loadData(this.state.page);
-        };
-    },
-    search() {
-        this.loadData();
-    },
-    reset() {
-        this.state.nameSearch = '';
-        this.state.releaseDate = [];
-        this.state.dataCategorySearch = undefined;
-        this.state.auditStatusSearch = undefined;
-        this.loadData();
-        
-    },
-    searchSwitch() {
+        this.loadData(this.state.page);
+      } else {
+        message.warning(data.error[0].message);
+      };
+    }.bind(this));
+  },
+  addClick() {
+    this.state.RowData = {};
+    this.setState({
+      showDesc: true
+    });
+  },
+  closeDesc(e, s) {
+    this.state.showDesc = e;
+    if (s) {
+      this.loadData(this.state.page);
+    };
+  },
+  search() {
+    this.loadData();
+  },
+  reset() {
+    this.state.type = undefined;
+    this.state.nameSearch = undefined;
+    this.state.releaseDate = [];
+    this.state.dataCategorySearch = undefined;
+    this.state.auditStatusSearch = undefined;
+    this.loadData();
+
+  },
+  searchSwitch() {
+    this.setState({
+      searchMore: !this.state.searchMore
+    });
+  },
+  render() {
+    const rowSelection = {
+      selectedRowKeys: this.state.selectedRowKeys,
+      onChange: (selectedRowKeys, selectedRows) => {
         this.setState({
-            searchMore: !this.state.searchMore
+          selectedRows: selectedRows.slice(-1),
+          selectedRowKeys: selectedRowKeys.slice(-1)
         });
-    },
-    render() {
-        const rowSelection = {
-            selectedRowKeys: this.state.selectedRowKeys,
-            onChange: (selectedRowKeys, selectedRows) => {
-                this.setState({
-                    selectedRows: selectedRows.slice(-1),
-                    selectedRowKeys: selectedRowKeys.slice(-1)
-                });
-            }
+      }
 
-        };
-        const { RangePicker } = DatePicker;
-        const hasSelect = this.state.selectedRowKeys.length;
-        return (
-            <div className="user-content" >
-                <div className="content-title">
-                    <span>政策管理</span>
-                    <div className="patent-addNew">
-                        <Button type="primary" onClick={this.addClick}>发布政策<Icon type="plus" /></Button>
-                    </div>
-                </div>
-                <div className="user-search">
-                    <Input placeholder="政策名称"
-                        value={this.state.nameSearch}
-                        onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
-                    <Select placeholder="发布状态" style={{ width: 120 }}
-                        value={this.state.auditStatusSearch}
-                        onChange={(e) => { this.setState({ auditStatusSearch: e }) }}>
-                        <Select.Option value="0" >草稿</Select.Option>
-                        <Select.Option value="2" >已发布</Select.Option>
-                    </Select>
-                    <Button type="primary" onClick={this.search}>搜索</Button>
-                    <Button onClick={this.reset}>重置</Button>
-                    <Button type="danger" disabled={!hasSelect}  onClick={(e)=>{this.delectRow()}}>删除</Button>
-                    <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
-                    <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
-                        <span>发布时间 :</span>
-                        <RangePicker
-                            value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
-                            this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
-                            onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
-                    </div>
-                </div>
-                <div className="patent-table">
-                    <Spin spinning={this.state.loading}>
-                        <Table columns={this.state.columns}
-                            dataSource={this.state.dataSource}
-                            rowSelection={rowSelection}
-                            pagination={this.state.pagination}
-                            onRowClick={this.tableRowClick} />
-                    </Spin>
-                </div>
-                <NewDesc
-                    data={this.state.RowData}
-                    showDesc={this.state.showDesc}
-                    closeDesc={this.closeDesc} />
-            </div >
-        );
-    }
+    };
+    const { RangePicker } = DatePicker;
+    const hasSelect = this.state.selectedRowKeys.length;
+    return (
+      <div className="user-content" >
+        <div className="content-title">
+          <span>政策管理</span>
+          <div className="patent-addNew">
+            <Button type="primary" onClick={this.addClick}>发布政策<Icon type="plus" /></Button>
+          </div>
+        </div>
+        <div className="user-search">
+          <Input placeholder="政策名称"
+            value={this.state.nameSearch}
+            onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
+          <Select placeholder="政策类型" style={{ width: 120 }}
+            value={this.state.type}
+            onChange={(e) => { this.setState({ type: e }) }}>
+            <Select.Option value={0} >政策</Select.Option>
+            <Select.Option value={1} >咨询</Select.Option>
+            <Select.Option value={2} >观点</Select.Option>
+            <Select.Option value={3} >百科</Select.Option>
+          </Select>
+          <Select placeholder="发布状态" style={{ width: 120 }}
+            value={this.state.auditStatusSearch}
+            onChange={(e) => { this.setState({ auditStatusSearch: e }) }}>
+            <Select.Option value="0" >草稿</Select.Option>
+            <Select.Option value="2" >已发布</Select.Option>
+          </Select>
+          <Button type="primary" onClick={this.search}>搜索</Button>
+          <Button onClick={this.reset}>重置</Button>
+          <Button type="danger" disabled={!hasSelect} onClick={(e) => { this.delectRow() }}>删除</Button>
+          <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
+          <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
+            <span>发布时间 :</span>
+            <RangePicker
+              value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
+              this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
+              onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
+          </div>
+        </div>
+        <div className="patent-table">
+          <Spin spinning={this.state.loading}>
+            <Table columns={this.state.columns}
+              dataSource={this.state.dataSource}
+              rowSelection={rowSelection}
+              pagination={this.state.pagination}
+              onRowClick={this.tableRowClick} />
+          </Spin>
+        </div>
+        <NewDesc
+          data={this.state.RowData}
+          showDesc={this.state.showDesc}
+          closeDesc={this.closeDesc} />
+      </div >
+    );
+  }
 });
 
 export default PolicyList;

+ 2 - 1
js/component/login/loginTop.jsx

@@ -1,6 +1,7 @@
 import React from 'react';
 import './login.less';
 import logo from '../../../image/logo.png';
+import logo2 from '../../../image/logo2.png';
 
 const LoginTop = React.createClass({
     render() {
@@ -8,7 +9,7 @@ const LoginTop = React.createClass({
             <div className="login-header">
                 <div className="login-logo">
                     <div className="logo">
-                        <img src={logo} alt="" />
+                        <img src={logo2} alt="" />
                     </div>
                     <div className="logo-text">
                         <span>科技交易认知计算平台</span>

+ 2 - 2
package.json

@@ -1,13 +1,13 @@
 {
   "name": "afanti",
-  "version": "1.0.0",
+  "version": "1.0.5",
   "description": "",
   "main": "index.js",
   "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1",
     "dlldev": "webpack --progress --colors --config ./webpack-dll.config.js --env.deploy dev --env.host 'http://127.0.0.1'",
     "dlltest": "webpack --progress --colors --config ./webpack-dll.config.js --env.deploy test --env.host 'http://statics.jishutao.com'",
-    "dllpro": "webpack --progress --colors --config ./webpack-dll.config.js --env.deploy prod --env.host 'http://ss.jishutao.com'",
+    "dllpro": "webpack --progress --colors --config ./webpack-dll.config.js --env.deploy prod --env.host 'http://js.junbangjishu.com'",
     "build": "node bin/clean.js && webpack --progress --colors --env.deploy dev",
     "buildtest": "node bin/clean.js && webpack --progress --colors --env.deploy test",
     "buildstage": "node bin/clean.js && webpack --progress --colors --env.deploy stage",

+ 2 - 2
webpack-dll.config.js

@@ -10,13 +10,13 @@ let theme = {
   '@link-color': '#58a3ff'
 };
 module.exports = (function () {
-	let staticHost = 'http://192.168.0.188:80';   
+	let staticHost = 'http://172.16.1.187';   
     switch (argv.env.deploy) {
         case 'test':
             staticHost = 'http://statics.jishutao.com';
             break;
         case 'prod':
-            staticHost = 'http://ss.jishutao.com';
+            staticHost = 'http://js.junbangjishu.com';
             break;
         default:
             break;

+ 5 - 5
webpack.config.js

@@ -1,4 +1,4 @@
-const webpack = require('webpack');
+const webpack = require('webpack');
 const path = require('path');
 const ExtractTextPlugin = require("extract-text-webpack-plugin");
 const HtmlWebpackPlugin = require('html-webpack-plugin');
@@ -121,13 +121,13 @@ module.exports = (function () {
         }));
     }
 
-    let staticHost = 'http://192.168.0.190:80';    
+    let staticHost = 'http://172.16.1.187';    
     switch (argv.env.deploy) {
         case 'test':
             staticHost = 'http://statics.jishutao.com';
             break;
         case 'prod':
-            staticHost = 'http://ss.jishutao.com';
+            staticHost = 'http://js.junbangjishu.com';
             break;
         default:
             break;
@@ -156,9 +156,9 @@ module.exports = (function () {
         plugins: plugins,
         devServer: {
             disableHostCheck: true,
-            host: '192.168.0.190',
+            host: '172.16.1.187',
             port: 80,
-            allowedHosts: ['127.0.0.1','192.168.0.20','192.168.0.99'],
+            allowedHosts: ['127.0.0.1','192.168.0.20','192.168.1.188'],
             headers: {
                 "Access-Control-Allow-Origin": "*"
             }

+ 7 - 7
webpack/entry.config.js

@@ -11,32 +11,32 @@ module.exports = {
     'admin/index': './js/admin/index.js',
   },
   watch: {
-    'user/index': ['webpack-dev-server/client?http://192.168.0.190:80', // WebpackDevServer host and port
+    'user/index': ['webpack-dev-server/client?http://172.16.1.187:80', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/index.js'
     ],
-    'user/login': ['webpack-dev-server/client?http://192.168.0.190:80', // WebpackDevServer host and port
+    'user/login': ['webpack-dev-server/client?http://172.16.1.187:80', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/login.js'
     ],
-    'user/signIn': ['webpack-dev-server/client?http://192.168.0.190:80', // WebpackDevServer host and port
+    'user/signIn': ['webpack-dev-server/client?http://172.16.1.187:80', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/signIn.js'
     ],
-    'user/account/index': ['webpack-dev-server/client?http://192.168.0.190:80', // WebpackDevServer host and port
+    'user/account/index': ['webpack-dev-server/client?http://172.16.1.187:80', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/account/index.js'
     ],
-    'user/account/evaluateInfo': ['webpack-dev-server/client?http://192.168.0.190:80', // WebpackDevServer host and port
+    'user/account/evaluateInfo': ['webpack-dev-server/client?http://172.16.1.187:80', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/account/assessment.js'
     ],
     //admin
-    'admin/login': ['webpack-dev-server/client?http://192.168.0.190:80', // WebpackDevServer host and port
+    'admin/login': ['webpack-dev-server/client?http://172.16.1.187:80', // WebpackDevServer host and port
     'webpack/hot/only-dev-server',
     './js/user/adminLogin.js'
     ],
-    'admin/index': ['webpack-dev-server/client?http://192.168.0.190:80', // WebpackDevServer host and port
+    'admin/index': ['webpack-dev-server/client?http://172.16.1.187:80', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/admin/index.js'
     ]