import React from 'react'; import $ from 'jquery/src/ajax'; import { Modal, message, Spin, Upload, Button, Form, } from 'antd'; import { getIndustryCategory } from '@/industryList.js'; import { splitUrl ,getMaturity,getAchievementType,getTransaction,getAchievementPosition,getAchievementCategory,getReleaseStateList,getInnovation} from '@/tools.js'; const DemandDetail = Form.create()(React.createClass({ getInitialState() { return { visible: false, loading: false, auditStatus: 0, textFileList: [], pictureUrlMin:[], videoFileList: [], pictureUrl: [], }; }, loadData(id) { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/user/achievement/achievementDetail' , 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 = {}; }; let publishPagesArr = []; thisData.publishPages.map(item=>{ publishPagesArr.push(item.publishPage) }) this.setState({ id:thisData.id, publishPagesArr:publishPagesArr, data: thisData, auditStatus:thisData.auditStatus, pictureUrl: thisData.technicalPictureUrl ? splitUrl(thisData.technicalPictureUrl, ',', globalConfig.avatarHost + '/upload') : [], pictureUrlMin: thisData.pictureUrlMin ? splitUrl(thisData.pictureUrlMin, ',', globalConfig.avatarHost + '/upload') : [] }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, getTagsArr(e) { this.setState({ tags: e }); }, getPictureUrl(e) { this.setState({ pictureUrl: e }); }, cancelFun(){ this.props.closeDesc(); }, //刷新发布 updateFun(inex){ this.setState({ loading:true }) $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context +'/api/user/achievement/refreshPublish', data: { id: this.state.id, auditStatus:this.state.auditStatus } }).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(){ this.setState({ loading:true }) $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/user/achievement/offShelf', data: { id: this.state.id, } }).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.state.pictureUrlMin = []; }; 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 }, }; return (
{theData.name}
{theData.introduction} {theData.patentCase} {theData.parameter} {theData.teamDes}
{theData.keywords&&theData.keywords.length?(theData.keywords).join(','):''}
{getIndustryCategory(theData.fieldA,theData.fieldB)}
{getAchievementType(theData.dataCategory)} {getAchievementCategory(theData.category)} {getInnovation(theData.innovation)} {getMaturity(theData.maturity)} {getTransaction(theData.transferMode)}
{ this.setState({ previewImage: file.url || file.thumbUrl, previewVisible: true, }); }} > { this.setState({ previewVisible: false }) }}>
{ this.setState({ previewImage: file.url || file.thumbUrl, previewVisible: true, }); }} > { this.setState({ previewVisible: false }) }}>
{theData.boutique?'精品':'非精品'} {theData.isHot?'热点':'非热点'}
{getReleaseStateList(theData.auditStatus)}
{getAchievementPosition(theData.publishPages)}
{theData.auditInfo}
{this.props.data.auditStatus=='2'&& }
) } })); export default DemandDetail;