import React from 'react'; import { Icon, message, Row, Col, Spin, Tag, Pagination, Modal, Button } from 'antd'; import './detail.less'; import { getSearchUrl, getAchievementCategory, getDemandType, getTransferMode, getMaturity } from '../tools'; import { getProvince } from '../NewDicProvinceList'; import { getIndustryCategory } from '../DicIndustryList'; import { getTechField } from '../DicTechFieldList'; import ajax from 'jquery/src/ajax/xhr.js' import $ from 'jquery/src/ajax'; import avatarImg from '../../../image/avatarImg.png'; import list_title_ico_1 from '../../../image/list_title_ico_1.png'; import list_title_ico_2 from '../../../image/list_title_ico_2.png'; import list_title_ico_3 from '../../../image/list_title_ico_3.png'; import demand_ico_5 from '../../../image/demand_ico_5.png'; import demand_ico_3 from '../../../image/demand_ico_3.png'; import demand_ico_2 from '../../../image/demand_ico_2.png'; import demand_ico_1 from '../../../image/demand_ico_1.png'; import achievement_ico_1 from '../../../image/achievement_ico_1.png'; import achievement_ico_2 from '../../../image/achievement_ico_2.png'; import score_ioc from '../../../image/score_ioc.png'; import demand_sup from '../../../image/demand_sup.png'; const Content = React.createClass({ loadData () { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", url: globalConfig.context + "/api/user/partner/detail", data: { uid: this.state.uid, type: this.state.type } }).done(function (data) { if (data.error && data.error.length) { message.warning(data.error[0].message); } else { this.state.data = data.data || {}; this.state.theField = this.state.type == 0 ? (data.data.engagedField ? data.data.engagedField.split(',') : []) : (data.data.field ? data.data.field.split(',') : []); this.state.theImgsrc = this.state.type == 0 ? (data.data.lifePhotoUrl ? data.data.lifePhotoUrl.split(',') : []) : (data.data.publicityPictureUrl ? data.data.publicityPictureUrl.split(',') : []); } this.setState({ data: this.state.data, theField: this.state.theField, theImgsrc: this.state.theImgsrc, loading: false }); }.bind(this)); }, achievementLoadData (pageNo) { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/user/partner/achievementList", data: { ownerId: this.state.uid, pageNo: pageNo || 1, pageSize: this.state.achievementPagination.pageSize }, success: function (data) { let theArr = []; if (!data.data || !data.data.list) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; } else { for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; theArr.push({ key: i, id: thisdata.id, serialNumber: thisdata.serialNumber, dataCategory: thisdata.dataCategory, name: thisdata.name, transferPrice: thisdata.transferPrice, fieldA: thisdata.fieldA, fieldB: thisdata.fieldB, bargainingMode: thisdata.bargainingMode, maturity: thisdata.maturity, keyword: thisdata.keyword, category: thisdata.category, ownerType: thisdata.ownerType, releaseDate: thisdata.releaseDate, releaseDateFormattedDate: thisdata.releaseDateFormattedDate, }); }; } this.state.achievementPagination.current = data.data.pageNo; this.state.achievementPagination.total = data.data.totalCount; this.setState({ achievementDataSource: theArr, achievementPagination: this.state.achievementPagination }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, demandLoadData (pageNo) { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/user/partner/demandList", data: { employerId: this.state.uid, pageNo: pageNo || 1, pageSize: this.state.demandPagination.pageSize }, success: function (data) { let theArr = []; if (!data.data || !data.data.list) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; } else { for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; theArr.push({ key: i, id: thisdata.id, serialNumber: thisdata.serialNumber, dataCategory: thisdata.dataCategory, problemDes: thisdata.problemDes, budgetCost: thisdata.budgetCost, name: thisdata.name, keyword: thisdata.keyword, releaseDate: thisdata.releaseDate, demandType: thisdata.demandType, industryCategoryA: thisdata.industryCategoryA, industryCategoryB: thisdata.industryCategoryB, validityPeriod: thisdata.validityPeriod, validityPeriodFormattedDate: thisdata.validityPeriodFormattedDate, releaseDateFormattedDate: thisdata.releaseDateFormattedDate }); }; } this.state.demandPagination.current = data.data.pageNo; this.state.demandPagination.total = data.data.totalCount; this.setState({ demandDataSource: theArr, demandPagination: this.state.demandPagination }); }.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/interest/interestUser', data: { toUid: this.state.uid }, success: function (data) { if (data.error && data.error.length) { message.warning(data.error[0].message); } else { this.loadData(); }; }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this));; }, addConsultorder () { this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/user/consultorder/add', data: { toUserId: this.state.uid }, success: function (data) { if (data.error && data.error.length) { message.warning(data.error[0].message); } else { this.loadData(); }; }.bind(this), }).always(function () { this.setState({ visible: false, loading: false }); }.bind(this));; }, consultClick () { $.ajax({ method: "get", dataType: "json", url: globalConfig.context + "/api/user/consultorder/price" }).done(function (data) { if (data.error && data.error.length) { message.warning(data.error[0].message); } else { this.state.consultPrice = data.data || 0; } this.setState({ visible: true }); }.bind(this)); }, cancelInterestClick () { this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/user/interest/cancelInterest', data: { interestId: this.state.data.interestId }, success: function (data) { if (data.error && data.error.length) { message.warning(data.error[0].message); } else { this.loadData(); }; }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this));; }, getInitialState () { return { loading: false, visible: false, consultPrice: 0, theField: [], data: {}, theImgsrc: [], achievementPagination: { pageNo: 1, pageSize: 10, total: 0 }, achievementDataSource: [], demandDataSource: [], demandPagination: { pageNo: 1, pageSize: 10, total: 0 }, }; }, componentWillMount () { if (window.location.search) { let theObj = getSearchUrl(window.location.search); if (theObj.rid && theObj.rid != 'null') { this.state.uid = theObj.rid; this.state.type = theObj.type; this.loadData(); this.achievementLoadData(); this.demandLoadData(); }; }; }, achievementListClick (record, index) { window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + record.id + '&type=' + record.ownerType); }, demandListClick (record, index) { window.open(globalConfig.context + '/portal/detail/demandDetail.html?id=' + record.id + '&type=' + record.dataCategory); }, render () { const theData = this.state.data; return (
头像
{theData.interestId ? 不感兴趣 : 感兴趣}
{ this.consultClick() }}> 线下咨询
{this.state.type == 0 ? theData.username : theData.unitName}
Lv. {theData.level} {this.state.type == 0 ? '个人' : '组织'}
简介: {this.state.type == 0 ? theData.personalProfile : theData.companyIntroduction}
所在地:
{getProvince(theData.province, theData.city, theData.area)}
专业领域:
{getTechField(this.state.theField[0], this.state.theField[1], this.state.theField[2])}
能力标签:
{theData.abilityLabel ? theData.abilityLabel.split(',').map((item) => { return {item} }) : ''}
用户展示
{this.state.theImgsrc.map((item, i) => { return
{ window.open(globalConfig.avatarHost + "/upload" + item) }} />
})}
技术成果
{ this.achievementLoadData(e); }} total={this.state.achievementPagination.total} showTotal={() => { return '共' + this.state.achievementPagination.total + '条数据' }} current={this.state.achievementPagination.pageNo} pageSize={this.state.achievementPagination.pageSize} />
技术需求
{ this.demandLoadData(e); }} total={this.state.demandPagination.total} showTotal={() => { return '共' + this.state.demandPagination.total + '条数据' }} current={this.state.demandPagination.pageNo} pageSize={this.state.demandPagination.pageSize} />
{ this.setState({ visible: false }) }} >
{"预约 " + (this.state.type == 0 ? theData.username : theData.unitName) + " 的线下咨询需要支付 " + this.state.consultPrice + " 元,是否确认预约?"}
) } }); export default Content;