import React from 'react'; import { Icon, message, Row, Col, Select, Radio, Checkbox, Input, InputNumber, Button, Table, Spin, Pagination } from 'antd'; import '../portal.less'; import logoImg from 'img/logo.png'; import searchImg from 'img/search.png'; import { techFieldList, getTechField } from '@/DicTechFieldList'; import { provinceList, getProvince } from '@/NewDicProvinceList'; import { companySearch } from '@/tools'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import avatarImg from 'img/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 }); }; }; 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: 1, fieldFirstOption: [], fieldSecondOption: [], fieldThirdOption: [], pagination: { pageNo: 1, pageSize: 12, total: 0 }, dataSource: [] }; }, componentWillMount() { let theFieldArr = [], theProvinceArr = []; theFieldArr.push( 不限 ); techFieldList.map((item) => { theFieldArr.push( {item.label} ) }); provinceList.map((item) => { theProvinceArr.push( {item.name} ) }); this.state.fieldFirstOption = theFieldArr; this.state.provinceOption = theProvinceArr; 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(); }, provinceChange(e) { let theArr = []; provinceList.map((item) => { if (item.id == e) { item.cityList.map((city) => { theArr.push( {city.name} ) }); } }); this.state.province = e; this.state.city = undefined; this.state.area = undefined; this.setState({ cityOption: theArr, province: e, city: undefined, area: undefined }); this.loadData(); }, cityChange(e) { let theArr = [], _me = this; provinceList.map((item) => { if (item.id == _me.state.province) { item.cityList.map((city) => { if (city.id == e) { city.areaList.map((area) => { theArr.push( {area.name} ) }); }; }); }; }); this.state.city = e; this.state.area = undefined; this.setState({ areaOption: theArr, city: e, area: undefined }); 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.unitName}
    区: {getProvince(item.province)}
    求: {item.demandNum || 0}
    技术成果: {item.achievementNum || 0}
  • })}
{ this.loadData(e); }} total={total} showTotal={() => { return '共' + total + '条数据' }} current={pageNo} pageSize={pageSize} />
) } }); export default SubContent; // // // 地区 // // // // // // // //