import React from 'react'; import { Icon, message, Row, Col, Spin, Tag } from 'antd'; import './detail.less'; import { getSearchUrl } from '../tools'; import { getProvince } from '../NewDicProvinceList'; import { getTechField } from '../DicTechFieldList'; import ajax from 'jquery/src/ajax/xhr.js' import $ from 'jquery/src/ajax'; import avatarImg from '../../../image/avatarImg.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.setState({ data: this.state.data, loading: false }); }.bind(this)); }, getInitialState() { return { loading: false, data: {}, pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadData(page); }.bind(this), showTotal: function (total) { return '共' + total + '条数据'; } }, columns: [ { title: '编号', dataIndex: 'serialNumber', key: 'serialNumber', }, { title: '名称', dataIndex: 'name', key: 'name', }, { title: '关键字', dataIndex: 'keyword', key: 'keyword', }, { title: '成果类型', dataIndex: 'dataCategory', key: 'dataCategory', render: text => { switch (text) { case "0": return 成果; case "1": return 技术; case "2": return 项目; } } }, { title: '类型', dataIndex: 'category', key: 'category', render: text => { return getAchievementCategory(text); } }, { title: '行业分类', dataIndex: 'field', key: 'field', render: text => { return getIndustryCategory(text[0], text[1]) } }, { title: '所有人名称', dataIndex: 'ownerName', key: 'ownerName', }, { title: '所有人类型', dataIndex: 'ownerType', key: 'ownerType', render: text => { switch (text) { case "0": return 个人; case "1": return 组织 } } }, { title: '发布时间', dataIndex: 'releaseDateFormattedDate', key: 'releaseDateFormattedDate', } ], dataSource: [] }; }, 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(); }; }; }, render() { const theData = this.state.data; return ( 用户名称 {this.state.type == 0 ? theData.username : theData.unitName} 用户类型 {this.state.type == 0 ? '个人' : '组织'} 用户等级 Lv.{theData.level} 所在地 {getProvince(theData.province, theData.city, theData.area)} 专业领域 {getTechField(this.state.type == 0 ? theData.engagedField.split(',') : theData.field.split(','))} 能力标签 {theData.abilityLabel ? theData.abilityLabel.join(',').map((item) => { return {item} }) : ''} ) } }); export default Content;