liting2017 6 years ago
parent
commit
8ce4fecf48

+ 5 - 0
js/component/account/business/businessDetails.jsx

@@ -248,6 +248,11 @@ const DemandDetail = Form.create()(
 								</FormItem>
 							</div>
 							<div className="clearfix">
+								<FormItem labelCol={{ span: 4 }} wrapperCol={{ span: 12 }} label="标签">
+									<span>{theData.tag}</span>
+								</FormItem>
+							</div>
+							<div className="clearfix">
 								<FormItem labelCol={{ span: 4 }} wrapperCol={{ span: 12 }} label="项目营销说明">
 									<span>{theData.advertisement}</span>
 								</FormItem>

+ 91 - 54
js/component/account/business/businessForm.jsx

@@ -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

+ 10 - 4
js/component/account/business/businessProject.jsx

@@ -110,10 +110,16 @@ const BusinessProject = Form.create()(
 								citys = thisdata.city,
 								Areas = thisdata.area;
 							ProvinceCityArr.push(ProvinceS, citys, Areas);
-							this.state.categoryList.map((item) => {
-								if (thisdata.categoryId == item.id) {
-									cname = item.name;
-									superName = item.superName;
+							(this.state.categoryList).map((item,index) => {
+								if((item.children).length){
+									(item.children).map((atem,indexT)=>{
+										if (thisdata.categoryId == atem.value) {
+											console.log()
+											cname = item.label;
+											superName = atem.label;
+											return;
+										}
+									})
 								}
 							});
 							theArr.push({

+ 0 - 1
js/component/account/index/collection.jsx

@@ -124,7 +124,6 @@ class Collection extends Component {
                     let thisdata = theData.list[i],
                         create = parseInt(thisdata.releaseDate / (1000 * 60 * 60 * 24));
                     let newState = (days-create)<7?true:false;
-                    console.log(thisdata.firstPic)
                     theArr.push({
                         key: i,
                         id: thisdata.id,

+ 0 - 1
js/component/account/index/follow.jsx

@@ -79,7 +79,6 @@ class Collection extends Component {
     }
 	render() {
         const dataList =this.state.dataList || [];
-        console.log(dataList)
 		return <div className="user-content">
             <div className="title" >
                 我的关注

+ 0 - 1
js/component/administration/order/order.jsx

@@ -214,7 +214,6 @@ const Order = Form.create()(
 			};
 			const { RangePicker } = DatePicker;
 			const theData = this.state.RowData || {};
-			console.log(theData)
 			return (
 				<div className="user-content">
 					<div className="content-title">