import React from 'react'; import { Icon, Modal, message, Spin, Button, Row, Col, Upload, Tooltip, Tag } from 'antd'; import '../portal.less'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import { getIndustryCategory } from '../../DicIndustryList.js'; import { getDemandType } from '../../tools.js'; const DemandDetail = React.createClass({ getInitialState() { return { visible: false, loading: false, tags: [], pictureUrl: [], }; }, handleCancel(e) { this.props.closeDesc(false); }, loadData(id) { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/user/portal/demandDetail', 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 = {}; }; this.setState({ data: thisData, tags: thisData.keyword ? thisData.keyword.split(",") : [], pictureUrl: thisData.pictureUrl ? splitUrl(thisData.pictureUrl, ',', globalConfig.avatarHost + '/upload') : [] }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, interestClick() { this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/user/portal/demandInterest', data: { id: this.props.data.id }, success: function (data) { if (data.error && data.error.length) { message.warning(data.error[0].message); } else { this.loadData(this.props.data.id); }; }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this));; }, cancelInterestClick() { this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/user/portal/demandCancelInterest', data: { id: this.state.data.demandInterestId }, success: function (data) { if (data.error && data.error.length) { message.warning(data.error[0].message); } else { this.loadData(this.props.data.id); }; }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this));; }, componentWillReceiveProps(nextProps) { if (!this.props.showDesc && nextProps.showDesc) { if (nextProps.data.id) { this.loadData(nextProps.data.id); } else { this.state.data = {}; this.state.tags = []; this.state.pictureUrl = []; }; }; }, render() { const theData = this.state.data || {}; if (this.props.data) { return ( 编号 {theData.serialNumber} 名称 {theData.name} 数据类别 {(() => { switch (theData.dataCategory) { case "0": return 个人需求; case "1": return 单位需求; } })()} 需求类型 {getDemandType(theData.demandType)} 应用领域 {getIndustryCategory(theData.industryCategoryA, theData.industryCategoryB)} 有效期限 {theData.releaseDateFormattedDate} 关键词 {this.state.tags.map((tag) => { return {tag} ; })} 问题说明 {theData.problemDes} 技术指标要求 {theData.technicalRequirements} 需求相关文件(图片)
{ this.setState({ previewImage: file.url || file.thumbUrl, previewVisible: true, }); }} > { this.setState({ previewVisible: false }) }}>
需求相关文件(文本) {theData.textFileUrl ? { window.open(globalConfig.context + '/api/user/demand/download?id=' + this.props.data.id + '&sign=demand_maturity_text_file') }}>需求文件(文本文件) : 未上传!} 需求文件(视频地址) {theData.videoUrl} 雇佣方名称 {theData.username || theData.unitName} 固定周期 {theData.fixedCycle} 固定人数 {theData.peopleNumber} 预算价格 {theData.budgetCost} 固定方案 {theData.fixedScheme}
{theData.demandInterestId ? 不感兴趣 : 感兴趣}
); } else { return
} }, }); export default DemandDetail;