import React from 'react'; import $ from 'jquery/src/ajax'; import { Modal, message, Spin, Upload, Input, Button, Form } from 'antd'; import { getAdviserType,getIndustry,getSocialAttribute,splitUrl } from '@/tools.js'; import { getProvince } from '@/NewDicProvinceList'; const AuthDetail = Form.create()(React.createClass({ getInitialState() { return { visible: false, loading: false, pictureUrl: [], headPortraitUrl: [], adviserUrl:[], positiveIdUrl: [], oppositeIdUrl: [], lawUrl:[], }; }, loadData(id) { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/getUserIdentityByUid' , data: { uid: id }, success: function (data) { let thisData = data.data; if (!thisData) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; thisData = {}; }; let provice; provice=getProvince(thisData.province,thisData.city,thisData.area); this.setState({ id:thisData.id, data: thisData, ProvinceCity:provice, headPortraitUrl: thisData.headPortraitUrl //专家照片 ? splitUrl(thisData.headPortraitUrl, ',', globalConfig.avatarHost + '/upload') : [], adviserUrl: thisData.adviserUrl //顾问照片 ? splitUrl(thisData.adviserUrl, ',', globalConfig.avatarHost + '/upload') : [], positiveIdUrl: thisData.positiveIdUrl ? splitUrl(thisData.positiveIdUrl, ',', globalConfig.avatarHost + '/upload') : [], oppositeIdUrl: thisData.oppositeIdUrl ? splitUrl(thisData.oppositeIdUrl, ',', globalConfig.avatarHost + '/upload') : [], lawUrl:thisData.consultantCertificateUrl ? splitUrl(thisData.consultantCertificateUrl, ',', globalConfig.avatarHost + '/upload') : [], }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, cancelFun(){ this.props.closeDesc(); }, //审核通过/拒绝 updateFun(index){ this.setState({ loading:true }); $.ajax({ method: "post", dataType: "JSON", crossDomain: false, url: globalConfig.context + '/api/admin/auditing', data: { id: this.state.id, auditStatus:index, auditInfo:this.state.refuseValue } }).done(function (data) { if (!data.error.length) { message.success('操作成功!'); this.setState({ loading: false, }); this.props.handOk() } else { message.warning(data.error[0].message); }; }.bind(this)); }, //审核拒绝 refuse(){ this.setState({ refuseValue:'', refuseVisible:true }) }, refuseOk(){ if(!this.state.refuseValue){ message.warning('请填写拒绝原因。') return; } this.setState({ refuseVisible:false }) this.updateFun(3) }, refuseCancel(){ this.setState({ refuseValue:'', refuseVisible:false }) }, componentWillMount() { if (this.props.data.id) { this.loadData(this.props.data.uid); } else { this.state.data = {}; }; }, componentWillReceiveProps(nextProps) { if (!this.props.visible && nextProps.visible) { if (nextProps.data.id) { this.loadData(nextProps.data.uid); } else { this.state.data = {}; }; this.props.form.resetFields(); }; }, render() { const theData = this.state.data || {}; const FormItem = Form.Item const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 12 }, }; return (
{theData.identifyName} {getIndustry(theData.industry)} {getSocialAttribute(theData.societyTag)} {theData.sex} {theData.dateOfBirthYear?theData.dateOfBirthYear + '/' + theData.dateOfBirthMonth:''} {theData.idNumber} {this.state.ProvinceCity} {theData.postalAddress} {theData.contactMobile} {theData.fixedTel} {theData.qq} {theData.email}
{theData.introduction}

{theData.expert=='1'?'专家认证':'顾问认证'}

{theData.expert=='1'?
{theData.graduateSchool} {theData.majorCategory} {theData.qualification} {theData.workUnit} {theData.professionalTitle}
{ this.setState({ previewImage: file.url || file.thumbUrl, previewVisible: true, }); }} > { this.setState({ previewVisible: false }) }}>
:
{getAdviserType(theData.consultantType)} { theData.consultantType=='4'?
{theData.workUnit1}
{theData.honer}
{theData.goodAtIndustry}
{theData.typicalCase}
:'' }
{ this.setState({ previewImage: file.url || file.thumbUrl, previewVisible: true, }); }} > { this.setState({ previewVisible: false }) }}> {theData.consultantType=='4'&& { this.setState({ previewImage: file.url || file.thumbUrl, previewVisible: true, }); }} > { this.setState({ previewVisible: false }) }}> }
}
{ this.setState({ previewImage: file.url || file.thumbUrl, previewVisible: true, }); }} > { this.setState({ previewVisible: false }) }}>
{ this.setState({ previewImage: file.url || file.thumbUrl, previewVisible: true, }); }} > { this.setState({ previewVisible: false }) }}>
{this.props.examineState&& }
{this.setState({refuseValue:e.target.value})}}/>
) } })); export default AuthDetail;