|
@@ -19,6 +19,80 @@ import {
|
|
|
import { citySelect } from '@/NewDicProvinceListAll';
|
|
|
import { splitUrl ,getReleaseStateList} from '@/tools.js';
|
|
|
|
|
|
+//tag组件
|
|
|
+
|
|
|
+const KeyWordTagGroup = React.createClass({
|
|
|
+ getInitialState() {
|
|
|
+ return {
|
|
|
+ tags: [],
|
|
|
+ inputVisible: false,
|
|
|
+ inputValue: ''
|
|
|
+ };
|
|
|
+ },
|
|
|
+ handleClose(removedTag) {
|
|
|
+ const tags = this.state.tags.filter(tag => tag !== removedTag);
|
|
|
+ this.props.tagsArr(tags);
|
|
|
+ this.setState({ tags });
|
|
|
+ },
|
|
|
+ showInput() {
|
|
|
+ this.setState({ inputVisible: true }, () => this.input.focus());
|
|
|
+ },
|
|
|
+ handleInputChange(e) {
|
|
|
+ this.setState({ inputValue: e.target.value });
|
|
|
+ },
|
|
|
+ handleInputConfirm() {
|
|
|
+ const state = this.state;
|
|
|
+ const inputValue = state.inputValue;
|
|
|
+ let tags = state.tags;
|
|
|
+ if (inputValue && tags.indexOf(inputValue) === -1 && inputValue.replace(/(^\s*)|(\s*$)/g, "").length != 0) {
|
|
|
+ tags = [...tags, inputValue.replace(/(^\s*)|(\s*$)/g, "")];
|
|
|
+ }
|
|
|
+ this.props.tagsArr(tags);
|
|
|
+ this.setState({
|
|
|
+ tags,
|
|
|
+ inputVisible: false,
|
|
|
+ inputValue: '',
|
|
|
+ });
|
|
|
+ },
|
|
|
+ componentWillMount() {
|
|
|
+ this.state.tags = this.props.keyWordArr;
|
|
|
+ },
|
|
|
+ componentWillReceiveProps(nextProps) {
|
|
|
+ if (this.props.keyWordArr != nextProps.keyWordArr) {
|
|
|
+ this.state.tags = nextProps.keyWordArr;
|
|
|
+ };
|
|
|
+ },
|
|
|
+ render() {
|
|
|
+ const { tags, inputVisible, inputValue } = this.state;
|
|
|
+ return (
|
|
|
+ <div className="keyWord-tips">
|
|
|
+ {tags.map((tag, index) => {
|
|
|
+ const isLongTag = tag.length > 10;
|
|
|
+ const tagElem = (
|
|
|
+ <Tag key={tag} closable={index !== -1} afterClose={() => this.handleClose(tag)}>
|
|
|
+ {isLongTag ? `${tag.slice(0, 10)}...` : tag}
|
|
|
+ </Tag>
|
|
|
+ );
|
|
|
+ return isLongTag ? <Tooltip title={tag}>{tagElem}</Tooltip> : tagElem;
|
|
|
+ })}
|
|
|
+ {inputVisible && (
|
|
|
+ <Input
|
|
|
+ ref={input => this.input = input}
|
|
|
+ type="text"
|
|
|
+ style={{ width: 78 }}
|
|
|
+ value={inputValue}
|
|
|
+ onChange={this.handleInputChange}
|
|
|
+ onBlur={this.handleInputConfirm}
|
|
|
+ onPressEnter={this.handleInputConfirm}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ {!inputVisible && <Button className="addtips" type="dashed" disabled={tags.length > 9 ? true : false} onClick={this.showInput}>+ 新标签</Button>}
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+
|
|
|
//图片组件
|
|
|
const PicturesWall = React.createClass({
|
|
|
getInitialState() {
|
|
@@ -88,59 +162,6 @@ const DemandDetailForm = Form.create()(
|
|
|
tags: []
|
|
|
};
|
|
|
},
|
|
|
- loadData(id) {
|
|
|
- this.setState({
|
|
|
- loading: true
|
|
|
- });
|
|
|
- $.ajax({
|
|
|
- method: 'get',
|
|
|
- dataType: 'json',
|
|
|
- crossDomain: false,
|
|
|
- url: globalConfig.context + '/api/user/jtBusiness/project/detail',
|
|
|
- data: {
|
|
|
- id: id
|
|
|
- },
|
|
|
- success: function(data) {
|
|
|
- if (!data.data) {
|
|
|
- if (data.error && data.error.length) {
|
|
|
- message.warning(data.error[0].message);
|
|
|
- }
|
|
|
- } else {
|
|
|
- let thisdata = data.data;
|
|
|
- let ProvinceCityArr = [];
|
|
|
- ProvinceCityArr.push(thisdata.province, thisdata.city);
|
|
|
- this.setState({
|
|
|
- id: thisdata.id, //业务名称
|
|
|
- name: thisdata.name, //业务名称
|
|
|
- categoryId: thisdata.categoryId, //业务品类
|
|
|
- number: thisdata.number,
|
|
|
- price: thisdata.price, //市场价
|
|
|
- activityPrice: thisdata.activityPrice ? thisdata.activityPrice : '', //最低折扣
|
|
|
- memberPrice: thisdata.memberPrice ? thisdata.memberPrice : '', //会员价
|
|
|
- offset: thisdata.offset ? thisdata.offset : '',
|
|
|
- activityFlag: thisdata.activityFlag ? thisdata.activityFlag.toString() : '', //活动生效标识
|
|
|
- ProvinceCity: ProvinceCityArr,
|
|
|
- introduce: thisdata.introduce,
|
|
|
- createTime: thisdata.createTime ? new Date(thisdata.createTime).toLocaleString() : '',
|
|
|
- value: thisdata.value,
|
|
|
- applyConditions: thisdata.applyConditions,
|
|
|
- orgCodeUrl: thisdata.minImgUrl
|
|
|
- ? splitUrl(thisdata.minImgUrl, ',', globalConfig.avatarHost + '/upload')
|
|
|
- : [],
|
|
|
- companyLogoUrl: thisdata.maxImgUrl
|
|
|
- ? splitUrl(thisdata.maxImgUrl, ',', globalConfig.avatarHost + '/upload')
|
|
|
- : []
|
|
|
- });
|
|
|
- }
|
|
|
- }.bind(this)
|
|
|
- }).always(
|
|
|
- function() {
|
|
|
- this.setState({
|
|
|
- loading: false
|
|
|
- });
|
|
|
- }.bind(this)
|
|
|
- );
|
|
|
- },
|
|
|
//左侧图片地址
|
|
|
getOrgCodeUrl(e) {
|
|
|
this.setState({ orgCodeUrl: e });
|
|
@@ -219,6 +240,7 @@ const DemandDetailForm = Form.create()(
|
|
|
city: this.state.ProvinceCity ? this.state.ProvinceCity[1] : '',
|
|
|
introduce: this.state.introduce,
|
|
|
value: this.state.value,
|
|
|
+ tag:this.state.tags?this.state.tags.join(','):'',
|
|
|
isHot: this.state.isHot,
|
|
|
minImgUrl: minPictureUrl.length ? minPictureUrl : '',
|
|
|
maxImgUrl: maxPictureUrl.length ? maxPictureUrl : '',
|
|
@@ -267,9 +289,11 @@ const DemandDetailForm = Form.create()(
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
this.setState({
|
|
|
id: thisdata.id, //业务名称
|
|
|
name: thisdata.name, //业务名称
|
|
|
+ tags:thisdata.tag?thisdata.tag.split(','):[],
|
|
|
categoryId: categoryIdArr, //业务品类
|
|
|
number: thisdata.number,
|
|
|
auditInfo:thisdata.auditInfo,
|
|
@@ -534,8 +558,20 @@ const DemandDetailForm = Form.create()(
|
|
|
>
|
|
|
<span style={{ width: '94%' }}>{this.state.createTime}</span>
|
|
|
</FormItem>
|
|
|
+ </div>
|
|
|
+ <div className="clearfix">
|
|
|
+ <FormItem
|
|
|
+ labelCol={{ span: 4 }}
|
|
|
+ wrapperCol={{ span: 18 }}
|
|
|
+ label={<span><span></span>标签</span>} >
|
|
|
+ <KeyWordTagGroup
|
|
|
+ keyWordArr={this.state.tags}
|
|
|
+ tagsArr={(e)=>{this.setState({tags:e})}}
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
<FormItem
|
|
|
- className="half-item"
|
|
|
labelCol={{ span: 4 }}
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
label="发布状态">
|
|
@@ -550,6 +586,7 @@ const DemandDetailForm = Form.create()(
|
|
|
<span>{this.state.auditInfo}</span>
|
|
|
</FormItem>:''}
|
|
|
</div>
|
|
|
+
|
|
|
<div className="clearfix">
|
|
|
<FormItem labelCol={{ span: 4 }} wrapperCol={{ span: 12 }} label="业务项目服务内容">
|
|
|
<Input
|