import React from 'react'; import { Icon, message, Row, Col, Spin, Tag, Pagination } 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, 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, name: thisdata.name, keyword: thisdata.keyword, releaseDate: thisdata.releaseDate, demandType: thisdata.demandType, 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));; }, cancelInterestClick() { this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/user/interest/cancelInterest', data: { id: this.state.data.interestId }, 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));; }, getInitialState() { return { loading: false, theField: [], data: {}, theImgsrc: [], achievementPagination: { a_pageNo: 1, a_pageSize: 10, a_total: 0 }, achievementDataSource: [], demandDataSource: [], demandPagination: { d_pageNo: 1, d_pageSize: 10, d_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; const { a_pageNo, a_pageSize, a_total } = this.state.achievementPagination; const { d_pageNo, d_pageSize, d_total } = this.state.demandPagination; return (
头像
{theData.interestId ? 不感兴趣 : 感兴趣}
{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
})}
技术成果
{ this.achievementLoadData(e); }} total={a_total} showTotal={() => { return '共' + a_total + '条数据' }} current={a_pageNo} pageSize={a_pageSize} />
技术成果
{ this.demandLoadData(e); }} total={d_total} showTotal={() => { return '共' + d_total + '条数据' }} current={d_pageNo} pageSize={d_pageSize} />
) } }); export default Content;