/* @author:李霆 @update:2018/05/29 @descript:复制粘贴,拿起来就是干!! */ import React from 'react'; import { Radio, Icon, Button, Cascader, Input, Select, Spin, message, DatePicker, Modal, Upload, Form, Row, Col, } from 'antd'; import $ from 'jquery/src/ajax'; import moment from 'moment'; import './unit.less'; import { areaSelect } from '@/NewDicProvinceList'; import { socialAttribute, industry, } from '@/dataDic.js'; import { splitUrl, } from '@/tools.js'; message.config({ top: 200, }); const FormItem = Form.Item; const monthFormat = 'YYYY/MM'; //图片组件 const PicturesWall = React.createClass({ getInitialState() { return { previewVisible: false, previewImage: '', fileList: [] }; }, handleCancel() { this.setState({ previewVisible: false }); }, handlePreview(file) { this.setState({ previewImage: file.url || file.thumbUrl, previewVisible: true }); }, handleChange(info) { let fileList = info.fileList; this.setState({ fileList }); this.props.fileList(fileList); }, componentWillReceiveProps(nextProps) { this.state.fileList = nextProps.pictureUrl; }, render() { const { previewVisible, previewImage, fileList } = this.state; const uploadButton = (
点击上传
); return (
{fileList.length >= 1 ? null : uploadButton} example
); } }); const Personal = React.createClass({ getInitialState() { return { loading: false, orgCodeUrl: [], companyLogoUrl: [], headPortraitUrl: [], positiveIdUrl: [], oppositeIdUrl: [] }; }, loadInformation(record) { this.setState({ loading: true }); $.ajax({ method: 'get', dataType: 'json', crossDomain: false, url: globalConfig.context + '/api/user/getUserDetail', success: function(data) { let thisData = data.data; if (!thisData) { if (data.error && data.error.length) { message.warning(data.error[0].message); } thisData = {}; } let ProvinceCityArr = []; let ProvinceS = thisData.province; //getprovince let citys = thisData.city; let Areas = thisData.area; ProvinceCityArr.push(ProvinceS, citys, Areas); let month = thisData.dateOfBirthYear ? thisData.dateOfBirthYear + '/' + thisData.dateOfBirthMonth : undefined; this.setState({ InformationId: thisData.id, InformationUid: thisData.uid, identifyName: thisData.identifyName, headPortraitUrl: thisData.headPortraitUrl ? splitUrl(thisData.headPortraitUrl, ',', globalConfig.avatarHost + '/upload') : [], positiveIdUrl: thisData.positiveIdUrl ? splitUrl(thisData.positiveIdUrl, ',', globalConfig.avatarHost + '/upload') : [], oppositeIdUrl: thisData.oppositeIdUrl ? splitUrl(thisData.oppositeIdUrl, ',', globalConfig.avatarHost + '/upload') : [], dataInformation: thisData, idNumber: thisData.idNumber, mobile:thisData.mobile, ProvinceCity: ProvinceCityArr[0] != null ? ProvinceCityArr : undefined, industry: thisData.industry ? String(thisData.industry) : undefined, societyTag: thisData.societyTag || undefined, sex: thisData.sex, yearMonth: month, postalAddress: thisData.postalAddress, fixedTel: thisData.fixedTel, email: thisData.email, qq: thisData.qq, mobile:thisData.mobile, introduction: thisData.introduction, type:thisData.type, authentication:thisData.authentication }); }.bind(this) }).always( function() { this.setState({ loading: false }); }.bind(this) ); }, //图片 getOrgCodeUrl(e) { this.setState({ orgCodeUrl: e }); }, getCompanyLogoUrl(e) { this.setState({ companyLogoUrl: e }); }, //基本信息提交 newSubmit(e) { this.state.data = []; this.setState({ selectedRowKeys: [] }); let theorgCodeUrl = []; if (this.state.headPortraitUrl.length) { let picArr = []; this.state.headPortraitUrl.map(function(item) { if (item.response && item.response.data && item.response.data.length) { picArr.push(item.response.data); } }); theorgCodeUrl = picArr.join(','); } let thecompanyLogoUrl = []; if (this.state.positiveIdUrl.length) { let picArr = []; this.state.positiveIdUrl.map(function(item) { if (item.response && item.response.data && item.response.data.length) { picArr.push(item.response.data); } }); thecompanyLogoUrl = picArr.join(','); } let thecompanyLogoUrls = []; if (this.state.oppositeIdUrl.length) { let picArr = []; this.state.oppositeIdUrl.map(function(item) { if (item.response && item.response.data && item.response.data.length) { picArr.push(item.response.data); } }); thecompanyLogoUrls = picArr.join(','); } let years = []; let yearMonth = this.state.yearMonth != undefined ? new Date(this.state.yearMonth).toLocaleDateString() : ''; years = yearMonth.split('/'); this.setState({ loading: true }); $.ajax({ method: 'post', dataType: 'json', url: globalConfig.context + '/api/user/updateUserDetail', data: { id: this.state.InformationId, uid: this.state.InformationUid, societyTag: this.state.societyTag, identifyName: this.state.identifyName, industry: this.state.industry, dateOfBirthYear: years[0], //出生年 dateOfBirthMonth: years[1], //出生月 province: this.state.ProvinceCity[0], //省- city: this.state.ProvinceCity[1], //市 area: this.state.ProvinceCity[2], //区 sex: this.state.sex, mobile:this.state.mobile, fixedTel: this.state.fixedTel, qq: this.state.qq, idNumber: this.state.idNumber, email: this.state.email, postalAddress: this.state.postalAddress, introduction: this.state.introduction, positiveIdUrl: thecompanyLogoUrl.length != 0 ? thecompanyLogoUrl : '', oppositeIdUrl: thecompanyLogoUrls.length != 0 ? thecompanyLogoUrls : '', headPortraitUrl: theorgCodeUrl.length != 0 ? theorgCodeUrl : '', authentication:this.state.authentication, type:this.state.type } }).done( function(data) { this.setState({ loading: false }); if (!data.error.length) { if(this.state.type!='0'){ message.success('个人认证成功,1s后回到首页.') setTimeout(()=>{ window.location.href = globalConfig.context + "/user/account/index.html"; },1000) }else{ message.success('保存成功!'); this.loadInformation(); } } else { message.warning(data.error[0].message); } }.bind(this) ); }, subFun(){ if(this.state.type=='0'||this.state.type=='1'){ if(!this.state.identifyName){ message.warning("请填写姓名!") return; } if (!this.state.industry) { message.warning('请选择行业!'); return false; } if (!this.state.societyTag) { message.warning('请选择社会性质!'); return false; } if (!this.state.ProvinceCity||!this.state.ProvinceCity.length) { message.warning('请选择地区!'); return false; } if(!this.state.mobile){ message.warning("请填写手机号码!") return; } this.newSubmit() }else{ if(!this.state.identifyName){ message.warning("请填写姓名!") return; } if (!this.state.industry) { message.warning('请选择行业!'); return false; } if (!this.state.societyTag) { message.warning('请选择社会性质!'); return false; } if (!this.state.ProvinceCity||!this.state.ProvinceCity.length) { message.warning('请选择地区!'); return false; } if(!this.state.mobile){ message.warning("请填写手机号码!") return; } this.setState({ visible:true }) } }, handleOk(){ this.newSubmit(); this.setState({ visible:false }) }, handleCancel(){ this.setState({ visible:false }) }, getHeadPortraitUrl(e) { this.setState({ headPortraitUrl: e }); }, getPositiveIdUrl(e) { this.setState({ positiveIdUrl: e }); }, getOppositeIdUrl(e) { this.setState({ oppositeIdUrl: e }); }, componentWillMount() { this.loadInformation(); }, componentWillReceiveProps(nextProps) {}, render() { const { RangePicker, MonthPicker } = DatePicker; const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 } }; return (

个人资料

* 姓名}> { this.setState({ identifyName: e.target.value }); }} /> { this.setState({ sex: e.target.value }); }} >
* 行业}> * 社会属性}> {!this.state.yearMonth ? ( { this.setState({ yearMonth: time }); }} /> ) : ( { this.setState({ yearMonth: time }); }} /> )} { this.setState({ idNumber: e.target.value }); }} />
* 省-市-区}> { this.setState({ ProvinceCity: e }); }} /> { this.setState({ postalAddress: e.target.value }); }} /> * 手机号码}> { this.setState({ mobile: e.target.value }); }} /> { this.setState({ fixedTel: e.target.value }); }} /> { this.setState({ qq: e.target.value }); }} /> { this.setState({ email: e.target.value }); }} />
{ this.setState({ introduction: e.target.value }); }} />

建议:图片要清晰。

建议:图片要清晰。

建议:图片要清晰。

是否申请个人用户认证?

); } }); export default Personal;