import React from 'react'; import { Icon, message, Row, Col, Radio, Input, Button, Table, Spin, Pagination } from 'antd'; import '../portal.less'; import logoImg from '../../../../image/logo.png'; import searchImg from '../../../../image/search.png'; import { techFieldList, getTechField } from '../../DicTechFieldList'; import { getProvince } from '../../NewDicProvinceList'; import { companySearch } from '../../tools'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import avatarImg from '../../../../image/avatarImg.png'; const SubContent = React.createClass({ loadData(pageNo) { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", url: globalConfig.context + "/portal/search/subscriberList", data: { "level": this.state.level, //认证状态 (0--未认证,1--认证) "type": this.state.type, //用户类型 (0--个人用户,1--组织用户) "field": this.state.firstField ? ((this.state.firstField || '') + (this.state.secondField ? (',' + this.state.secondField) : '') + (this.state.thirdField ? (',' + this.state.thirdField) : '')) : null, "province": this.state.province, "city": this.state.city, "area": this.state.area, "name": this.state.searchName, "pageNo": pageNo || 1, "pageSize": this.state.pagination.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, uid: thisdata.uid, //用户ID identityId: thisdata.identityId, //认证ID (详情接口传入ID) username: thisdata.username,// 用户名称 unitName: thisdata.unitName, type: this.state.type, personPortraitUrl: thisdata.personPortraitUrl,//用户头像URL logoUrl: thisdata.logoUrl, achievementNum: thisdata.achievementNum, //科技成果数量 demandNum: thisdata.demandNum, //科技需求数量 province: thisdata.province, engagedField: thisdata.engagedField ? thisdata.engagedField.split(',') : [], workUnit: thisdata.workUnit, position: thisdata.position }); }; }; this.state.pagination.pageNo = data.data.pageNo; this.state.pagination.total = data.data.totalCount; this.setState({ dataSource: theArr, pagination: this.state.pagination }); }.bind(this), }).done(function (data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; this.setState({ loading: false }); }.bind(this)); }, getInitialState() { return { loading: false, type: 0, fieldFirstOption: [], fieldSecondOption: [], fieldThirdOption: [], pagination: { pageNo: 1, pageSize: 12, total: 0 }, dataSource: [] }; }, componentWillMount() { let theFieldArr = []; theFieldArr.push( 不限 ); techFieldList.map((item) => { theFieldArr.push( {item.label} ) }); this.state.fieldFirstOption = theFieldArr; if (window.location.search) { let theUrl = window.location.search this.state.searchName = theUrl.substring(1, theUrl.length); this.state.searchName = decodeURIComponent(this.state.searchName); }; this.loadData(); }, fieldFirstChange(e) { let theArr = []; if (e.target.value !== 999) { theArr.push( 不限 ); techFieldList.map((item) => { if (item.value == e.target.value) { item.children.map((children) => { theArr.push( {children.label} ) }); } }); this.state.firstField = e.target.value; } else { this.state.firstField = null; }; this.state.secondField = null; this.state.thirdField = null; this.setState({ fieldSecondOption: theArr, fieldThirdOption: [] }); this.loadData(); }, fieldSecondChange(e) { let theArr = [], _me = this; if (e.target.value !== 999) { theArr.push( 不限 ); techFieldList.map((item) => { if (item.value == _me.state.firstField) { item.children.map((children) => { if (children.value == e.target.value) { children.children.map((third) => { theArr.push( {third.label} ) }) } }); } }); this.state.secondField = e.target.value; } else { this.state.secondField = null; this.state.thirdField = null; }; this.setState({ fieldThirdOption: theArr }); this.loadData(); }, tableRowClick(record, index) { window.open(globalConfig.context + '/user/subscriberDetail.html?rid=' + record.uid + '&type=' + record.type); }, render() { const { pageNo, pageSize, total } = this.state.pagination; const _me = this; return (
行业分类 {this.state.fieldFirstOption} {this.state.fieldSecondOption.length > 1 ? 行业二级分类 {this.state.fieldSecondOption} :
} {this.state.fieldThirdOption.length > 1 ? 行业三级分类 { if (e.target.value !== 999) { this.state.thirdField = e.target.value; } else { this.state.thirdField = null; } this.loadData() }}> {this.state.fieldThirdOption} :
} 行家名称
{ this.setState({ searchName: e.target.value }); }} />
    {this.state.dataSource.map((item, i) => { return
  • { _me.tableRowClick(item); }}>
    头像
    {item.username || 'UserName'}
    {item.workUnit || '单位'}
    {item.position || '职位'}
    {getTechField(item.engagedField[0], item.engagedField[1], item.engagedField[2])}
    求: {item.demandNum || 0}
    技术成果: {item.achievementNum || 0}
    丝: {0}
  • })}
{ this.loadData(e); }} total={total} showTotal={() => { return '共' + total + '条数据' }} current={pageNo} pageSize={pageSize} />
) } }); export default SubContent;