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 { getAchievementCategory, getMaturity, getInnovation } from '../../tools.js'; const AchievementDetail = React.createClass({ getInitialState() { return { visible: false, loading: false, tags: [], technicalPictureUrl: [], maturityPictureUrl: [], }; }, 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/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 = {}; }; this.setState({ data: thisData, tags: thisData.keyword ? thisData.keyword.split(",") : [], technicalPictureUrl: thisData.technicalPictureUrl ? splitUrl(thisData.technicalPictureUrl, ',', globalConfig.avatarHost + '/upload') : [], maturityPictureUrl: thisData.maturityPictureUrl ? splitUrl(thisData.maturityPictureUrl, ',', 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/achievementInterest', 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/achievementCancelInterest', data: { id: this.state.data.achievementInterestId }, 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.maturityPictureUrl = []; this.state.technicalPictureUrl = []; }; }; }, render() { const theData = this.state.data || {}; if (this.props.data) { return ( 编号 {theData.serialNumber} 名称 {theData.name} 数据类别 {(() => { switch (theData.dataCategory) { case "0": return 成果; case "1": return 技术; case "2": return 项目; } })()} 类型 {getAchievementCategory(theData.category)} 应用领域 {getIndustryCategory(theData.fieldA, theData.fieldB)} 发布时间 {theData.releaseDateFormattedDate} 关键词 {this.state.tags.map((tag) => { return {tag} ; })} 摘要 {theData.summary} 成果简介 {theData.introduction} 技术图片
{ this.setState({ previewImage: file.url || file.thumbUrl, previewVisible: true, }); }} > { this.setState({ previewVisible: false }) }}>
成熟度 {getMaturity(theData.maturity)} 创新度 {getInnovation(theData.innovation)} 成熟度证明材料(图片) { this.setState({ previewImage: file.url || file.thumbUrl, previewVisible: true, }); }} > 成熟度证明材料(文本) {theData.maturityTextFileUrl ? { window.open(globalConfig.context + '/api/user/achievement/download?id=' + this.props.data.id + '&sign=achievement_maturity_text_file') }}>成熟度证明材料(文本文件) : 未上传!} 成熟度证明材料(视频地址) {theData.maturityVideoUrl} 成果所有人名称 {theData.username || theData.unitName} 合作方式 {(() => { switch (theData.cooperationMode) { case "0": return 技术转让; case "1": return 授权生产; } })()} 转让方式 {(() => { switch (theData.transferMode) { case "0": return 完全转让; case "1": return 许可转让; case "2": return 技术入股; } })()} 转让价格 {(() => { switch (theData.bargainingMode) { case "0": return 面议; case "1": return {theData.transferPrice} 万元; } })()} 技术场景 {theData.technicalScene} 技术突破 {theData.breakthrough} 专利情况 {theData.patentCase} 获奖情况 {theData.awards} 技术团队情况 {theData.teamDes} 技术参数 {theData.parameter} 技术方案 {theData.techPlanUrl ? { window.open(globalConfig.context + '/api/user/achievement/download?id=' + this.props.data.id + '&sign=achievement_tech_plan') }}>技术方案 : 未上传!} 商业计划书 {theData.businessPlanUrl ? { window.open(globalConfig.context + '/api/user/achievement/download?id=' + this.props.data.id + '&sign=achievement_business_plan') }}>商业计划书 : 未上传!}
{theData.achievementInterestId ? 不感兴趣 : 感兴趣}
); } else { return
} }, }); export default AchievementDetail;