|
@@ -1,82 +1,19 @@
|
|
|
import React from 'react';
|
|
|
import $ from 'jquery/src/ajax';
|
|
|
import {
|
|
|
- Icon,
|
|
|
- Modal,
|
|
|
message,
|
|
|
Spin,
|
|
|
- Upload,
|
|
|
Input,
|
|
|
Button,
|
|
|
Radio,
|
|
|
Form,
|
|
|
- Checkbox,
|
|
|
- Cascader,
|
|
|
- Row,
|
|
|
Select,
|
|
|
- Col
|
|
|
} from 'antd';
|
|
|
-import {specialType,productType} from '@/dataDic.js';
|
|
|
-import { splitUrl} from '@/tools.js';
|
|
|
-import {provinceSelect } from '@/NewDicProvinceList';
|
|
|
+import {productType} from '@/dataDic.js';
|
|
|
import Editors from '@/richTextEditors';
|
|
|
import Crop from '@/crop/cropBlock';
|
|
|
+import KeyWordTagGroup from '@/crop/keyword';
|
|
|
|
|
|
-
|
|
|
-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>
|
|
|
- );
|
|
|
- }
|
|
|
-});
|
|
|
-
|
|
|
const NewDetailForm = Form.create()(React.createClass({
|
|
|
getInitialState() {
|
|
|
return {
|
|
@@ -115,6 +52,7 @@ const NewDetailForm = Form.create()(React.createClass({
|
|
|
type:thisData.type,
|
|
|
id:thisData.id,
|
|
|
data: thisData,
|
|
|
+ tags:thisData.keywords||[],
|
|
|
auditStatus:thisData.auditStatus,
|
|
|
edit:thisData.content,
|
|
|
pictureUrl: thisData.coverUrl ? thisData.coverUrl.split(',') : []
|
|
@@ -148,7 +86,6 @@ const NewDetailForm = Form.create()(React.createClass({
|
|
|
url: this.props.data.id ? globalConfig.context + '/api/admin/news/updateNews' : globalConfig.context + '/api/admin/news/apply',
|
|
|
data: {
|
|
|
id: this.props.data.id,
|
|
|
- type:this.state.type,
|
|
|
title: values.title,
|
|
|
author: values.author,
|
|
|
titleImg: this.state.pictureUrl.join(','),
|
|
@@ -158,6 +95,8 @@ const NewDetailForm = Form.create()(React.createClass({
|
|
|
sourceUrl:values.sourceUrl,
|
|
|
keyword:values.keyword,
|
|
|
auditStatus:index,
|
|
|
+ keyword: this.state.tags ? this.state.tags.join(",") : '',
|
|
|
+ keywords: this.state.tags,
|
|
|
summary: values.summary,
|
|
|
}
|
|
|
}).done(function (data) {
|
|
@@ -187,7 +126,7 @@ const NewDetailForm = Form.create()(React.createClass({
|
|
|
} else {
|
|
|
this.state.visible=true;
|
|
|
this.state.data = {};
|
|
|
- this.state.type=undefined;
|
|
|
+ this.state.tags=[];
|
|
|
this.state.edit='<p><br></p>';
|
|
|
this.state.pictureUrl = [];
|
|
|
};
|
|
@@ -201,7 +140,7 @@ const NewDetailForm = Form.create()(React.createClass({
|
|
|
} else {
|
|
|
this.state.visible=true;
|
|
|
this.state.data = {};
|
|
|
- this.state.type=undefined;
|
|
|
+ this.state.tags=[];
|
|
|
this.state.edit='<p><br></p>';
|
|
|
this.state.pictureUrl = [];
|
|
|
this.state.theData={};
|
|
@@ -228,22 +167,7 @@ const NewDetailForm = Form.create()(React.createClass({
|
|
|
initialValue: theData.title
|
|
|
})(<Input placeholder="请输入您的专栏标题" />)}
|
|
|
</FormItem>
|
|
|
- <FormItem className="half-item" {...formItemLayout} label="专栏类型">
|
|
|
- {getFieldDecorator('type', {
|
|
|
- rules: [ { required: true, message: '此项为必填项!' } ],
|
|
|
- })(
|
|
|
- <Select placeholder="专栏类型" onChange={(e)=>{this.setState({type:e})}} value={this.state.type}>
|
|
|
- {
|
|
|
- specialType.map(item=>{
|
|
|
- return <Select.Option value={item.value}>{item.key}</Select.Option>
|
|
|
- })
|
|
|
- }
|
|
|
- </Select>
|
|
|
- )}
|
|
|
- </FormItem>
|
|
|
- </div>
|
|
|
- <div className="clearfix">
|
|
|
- {this.state.type=='1'?<FormItem className="half-item" {...formItemLayout} label="产品类型">
|
|
|
+ <FormItem className="half-item" {...formItemLayout} label="产品类型">
|
|
|
{getFieldDecorator('productType', {
|
|
|
rules: [ { required: true, message: '此项为必填项!' } ],
|
|
|
initialValue: theData.productType!=undefined?String(theData.type):theData.type
|
|
@@ -256,7 +180,7 @@ const NewDetailForm = Form.create()(React.createClass({
|
|
|
}
|
|
|
</Select>
|
|
|
)}
|
|
|
- </FormItem>:''}
|
|
|
+ </FormItem>
|
|
|
<FormItem className="half-item" {...formItemLayout} label="专栏来源">
|
|
|
{getFieldDecorator('source', {
|
|
|
rules: [ { required: true, message: '此项为必填项!' } ],
|
|
@@ -268,10 +192,15 @@ const NewDetailForm = Form.create()(React.createClass({
|
|
|
initialValue: theData.sourceUrl
|
|
|
})(<Input placeholder="请输入来源链接" />)}
|
|
|
</FormItem>
|
|
|
- <FormItem className="half-item" {...formItemLayout} label="关键字">
|
|
|
+ </div>
|
|
|
+ <div className="clearfix">
|
|
|
+ <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="关键字">
|
|
|
{getFieldDecorator('keyword', {
|
|
|
initialValue: theData.keyword
|
|
|
- })(<Input placeholder="请输入关键字" />)}
|
|
|
+ })(<KeyWordTagGroup
|
|
|
+ keyWordArr={this.state.tags}
|
|
|
+ tagsArr={(e)=>{this.setState({tags:e})}}
|
|
|
+ />)}
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
<div className="clearfix">
|
|
@@ -330,25 +259,6 @@ const NewDetailForm = Form.create()(React.createClass({
|
|
|
)}
|
|
|
</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" disabled>网站新闻首页</Checkbox></Col>
|
|
|
- <Col span={6}><Checkbox value="web_tech_service_index">网站申请首页</Checkbox></Col>
|
|
|
- <Col span={6}><Checkbox value="app_policy_index" disabled>app新闻首页</Checkbox></Col>
|
|
|
- <Col span={6}><Checkbox value="app_tech_service_index">APP科技服务首页</Checkbox></Col>
|
|
|
- </Row>
|
|
|
- </Checkbox.Group>
|
|
|
- )}
|
|
|
- </FormItem>
|
|
|
- </div> */}
|
|
|
<div className="clearfix">
|
|
|
<FormItem wrapperCol={{ span: 12, offset: 3 }}>
|
|
|
<Button className="set-submit" type="primary" htmlType="submit">
|