| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424 | 
							- import React from 'react';
 
- import { Input, Button, Form, Upload, Icon, Spin, message, Row, Col } from 'antd';
 
- import './certify.less';
 
- import { addressInit, getBase64, beforeUpload, beforeUploadFile } from '../tools.js';
 
- import ajax from 'jquery/src/ajax/xhr.js'
 
- import $ from 'jquery/src/ajax';
 
- import card1 from '../../../image/idcard1.jpg';
 
- import card2 from '../../../image/idcard2.jpg';
 
- class Avatar extends React.Component {
 
-     constructor(props) {
 
-         super(props);
 
-         this.state = {
 
-             imageUrl: ''
 
-         }
 
-     }
 
-     handleChange(info) {
 
-         if (info.file.status === 'done') {
 
-             // Get this url from response in real world.
 
-             getBase64(info.file.originFileObj, imageUrl => this.setState({ imageUrl }));
 
-             this.props.urlData(info.file.response.data);
 
-         }
 
-     }
 
-     render() {
 
-         const imageUrl = this.state.imageUrl;
 
-         return (
 
-             <Upload
 
-                 className="avatar-uploader"
 
-                 name={this.props.name}
 
-                 showUploadList={false}
 
-                 action={globalConfig.context + "/api/user/identity/upload"}
 
-                 data={{ 'sign': this.props.name }}
 
-                 beforeUpload={beforeUpload}
 
-                 onChange={this.handleChange.bind(this)}
 
-             >
 
-                 {
 
-                     imageUrl ?
 
-                         <img src={imageUrl} role="presentation" id={this.props.name} /> :
 
-                         <Icon type="plus" className="avatar-uploader-trigger" />
 
-                 }
 
-             </Upload>
 
-         );
 
-     }
 
- };
 
- class UploadFile extends React.Component {
 
-     constructor(props) {
 
-         super(props);
 
-     }
 
-     handleChange(info) {
 
-         if (info.file.status === 'done') {
 
-             this.props.urlData(info.file.response.data);
 
-         }
 
-     }
 
-     render() {
 
-         return (
 
-             <Upload
 
-                 name={this.props.name}
 
-                 action={globalConfig.context + "/api/user/identity/upload"}
 
-                 data={{ 'sign': this.props.name }}
 
-                 beforeUpload={beforeUploadFile}
 
-                 onChange={this.handleChange.bind(this)}
 
-             >
 
-                 <Button><Icon type="upload" />上传</Button>
 
-             </Upload>
 
-         );
 
-     }
 
- };
 
- const Content = Form.create()(React.createClass({
 
-     getData() {
 
-         this.setState({
 
-             loading: true
 
-         });
 
-         $.ajax({
 
-             method: "get",
 
-             dataType: "json",
 
-             url: globalConfig.context + "/api/user/orgProcess",
 
-             success: function (data) {
 
-                 if (data.data) {
 
-                     addressInit('cmbProvince', 'cmbCity', 'cmbArea',
 
-                         data.data.licenceProvince, data.data.licenceCity, data.data.licenceArea);
 
-                     this.setState({
 
-                         contacts:data.data.contacts,
 
-                         contactMobile: data.data.contactMobile,
 
-                         aftUsername: data.data.aftUsername,
 
-                         unitName: data.data.unitName,
 
-                         registeredCapital: data.data.registeredCapital,
 
-                         licenceNumber: data.data.licenceNumber,
 
-                         orgCode: data.data.orgCode,
 
-                         legalPerson: data.data.legalPerson,
 
-                         legalPersonIdCard: data.data.legalPersonIdCard,
 
-                         licenceScanningUrl: data.data.licenceScanningUrl,
 
-                         orgCodeUrl: data.data.orgCodeUrl,
 
-                         lastYearTaxReportUrl: data.data.lastYearTaxReportUrl
 
-                     });
 
-                 };
 
-             }.bind(this),
 
-         }).done(function (data) {
 
-             if (data.error.length) {
 
-                 message.warning(data.error[0].message);
 
-             }
 
-         }.bind(this)).always(function () {
 
-             this.setState({
 
-                 loading: false
 
-             });
 
-         }.bind(this));
 
-     },
 
-     getInitialState() {
 
-         return {
 
-             loading: false,
 
-             vsCodeSrc : globalConfig.context + '/open/getVCode'
 
-         };
 
-     },
 
-     handleSubmit(e) {
 
-         e.preventDefault();
 
-         this.props.form.validateFields((err, values) => {
 
-             //地址值
 
-             let cmbP = document.getElementById('cmbProvince').value;
 
-             let cmbC = document.getElementById('cmbCity').value;
 
-             let cmbA = document.getElementById('cmbArea').value;
 
-             if (!cmbP || !cmbC || !cmbA) {
 
-                 message.warning("请选择所在地!");
 
-                 return;
 
-             };
 
-             if (!this.state.licenceScanningUrl) {
 
-                 message.warning("请上传营业执照副本!");
 
-                 return;
 
-             };
 
-             if (!this.state.orgCodeUrl) {
 
-                 message.warning("请上传组织机构代码证!");
 
-                 return;
 
-             };
 
-             if (!this.state.lastYearTaxReportUrl) {
 
-                 message.warning("请上传上年度纳税报表!");
 
-                 return;
 
-             };
 
-             if (!err) {
 
-                 this.setState({
 
-                     loading: true
 
-                 });
 
-                 $.ajax({
 
-                     method: "POST",
 
-                     dataType: "json",
 
-                     crossDomain: false,
 
-                     url: globalConfig.context + "/api/user/orgNextPro",
 
-                     data: {
 
-                         contacts: values.contacts,
 
-                         contactMobile: values.contactMobile,
 
-                         aftUsername: values.aft,
 
-                         unitName: values.unitName,
 
-                         registeredCapital: values.registeredCapital,
 
-                         licenceNumber: values.licenceNumber,
 
-                         licenceProvince: cmbP,
 
-                         licenceCity: cmbC,
 
-                         licenceArea: cmbA,
 
-                         licenceScanningUrl: this.state.licenceScanningUrl,
 
-                         orgCode: values.orgCode,
 
-                         orgCodeUrl: this.state.orgCodeUrl,
 
-                         lastYearTaxReportUrl: this.state.lastYearTaxReportUrl,
 
-                         legalPerson: values.legalPerson,
 
-                         legalPersonIdCard: values.legalPersonIdCard,
 
-                         verificationCode: values.captcha,
 
-                         process: 1
 
-                     }
 
-                 }).done(function (data) {
 
-                     if (!data.error.length) {
 
-                         message.success('保存成功!');
 
-                         this.props.changeStep(2);
 
-                     } else {
 
-                         message.warning(data.error[0].message);
 
-                         this.reloadVCode();
 
-                         this.setState({
 
-                             loading: false
 
-                         });
 
-                     }
 
-                 }.bind(this));
 
-             }
 
-         });
 
-     },
 
-     checkIdcardnum(rule, value, callback) {
 
-         if (!/(^\d{15}$)|(^\d{17}(\d|X)$)/.test(value)) {
 
-             callback('请输入正确的身份证号!');
 
-         } else {
 
-             callback();
 
-         }
 
-     },
 
-     checkPhone(rule, value, callback) {
 
-         const form = this.props.form;
 
-         const _me = this;
 
-         if (!(/^1[34578]\d{9}$/.test(value))) {
 
-             callback('请输入正确的手机号码!');
 
-             _me.setState({
 
-                 getCodeButton: true
 
-             });
 
-         } else {
 
-             callback();
 
-             _me.setState({
 
-                 getCodeButton: false
 
-             });
 
-         }
 
-     },
 
-     checkNumber(rule, value, callback) {
 
-         if (!/(^\d{15}$)/.test(value)) {
 
-             callback('请输入正确的营业执照注册号!');
 
-         } else {
 
-             callback();
 
-         }
 
-     },
 
-     getLicenceScanningUrl(e) {
 
-         this.state.licenceScanningUrl = e;
 
-     },
 
-     getOrgCodeUrl(e) {
 
-         this.state.orgCodeUrl = e;
 
-     },
 
-     getLastYearTaxReportUrl(e) {
 
-         this.state.lastYearTaxReportUrl = e;
 
-     },
 
-     componentDidMount() {
 
-         addressInit('cmbProvince', 'cmbCity', 'cmbArea');
 
-         this.getData();
 
-     },
 
-     reloadVCode() {
 
-         this.setState({
 
-             vsCodeSrc:globalConfig.context + '/open/getVCode?t=' + Math.random()
 
-         });
 
-     },
 
-     render() {
 
-         const FormItem = Form.Item;
 
-         const { getFieldDecorator } = this.props.form;
 
-         const formItemLayout = {
 
-             labelCol: { span: 6 },
 
-             wrapperCol: { span: 12 },
 
-         };
 
-         const _me = this;
 
-         return (
 
-             <Spin spinning={this.state.loading} className="certify-spin">
 
-                 <Form horizontal onSubmit={this.handleSubmit} className="certify-form">
 
-                     <FormItem
 
-                         {...formItemLayout}
 
-                         label="用户名"
 
-                         extra={<span><Icon type="exclamation-circle" /> 建议字母、数字和符号两种以上组合,6-20个字符</span>}
 
-                     >
 
-                         {getFieldDecorator('aftUsername', {
 
-                             initialValue: this.state.aftUsername || null,
 
-                             rules: [{ required: true, message: '请输入用户名!' }]
 
-                         })(
 
-                             <Input />
 
-                             )}
 
-                     </FormItem>
 
-                     <FormItem
 
-                         {...formItemLayout}
 
-                         label="企业名称"
 
-                     >
 
-                         {getFieldDecorator('unitName', {
 
-                             initialValue: this.state.unitName || null,
 
-                             rules: [{ required: true, message: '请输入企业名称!' }]
 
-                         })(
 
-                             <Input placeholder="请输入企业名称" />
 
-                             )}
 
-                     </FormItem>
 
-                     <FormItem
 
-                         {...formItemLayout}
 
-                         label="注册资金"
 
-                     >   {getFieldDecorator('registeredCapital', {
 
-                             initialValue: this.state.registeredCapital || null
 
-                         })(
 
-                             <Input />
 
-                             )}
 
-                         <span className="fromItem-postfix">万元</span>
 
-                     </FormItem>
 
-                     <FormItem
 
-                         {...formItemLayout}
 
-                         label="联系人"
 
-                     >
 
-                         {getFieldDecorator('contacts', {
 
-                             initialValue: this.state.contacts || null,
 
-                             rules: [{ required: true, message: '请输入联系人姓名!' }]
 
-                         })(
 
-                             <Input />
 
-                             )}
 
-                     </FormItem>
 
-                     <FormItem
 
-                         {...formItemLayout}
 
-                         label="联系方式"
 
-                         extra={<span><Icon type="exclamation-circle" /> 请填写联系人手机号码,我们会将重要进度以短信形式通知您</span>}
 
-                     >
 
-                         {getFieldDecorator('contactMobile', {
 
-                             initialValue: this.state.contactMobile || null,
 
-                             rules: [{ validator: this.checkPhone }]
 
-                         })(
 
-                             <Input placeholder="建议使用常用手机" />
 
-                             )}
 
-                     </FormItem>
 
-                     <FormItem
 
-                         {...formItemLayout}
 
-                         label="法人姓名"
 
-                     >
 
-                         {getFieldDecorator('legalPerson', {
 
-                             initialValue: this.state.legalPerson || null,
 
-                             rules: [{ required: true, message: '请输入联系人姓名!' }]
 
-                         })(
 
-                             <Input />
 
-                             )}
 
-                     </FormItem>
 
-                     <FormItem
 
-                         {...formItemLayout}
 
-                         label="身份证号"
 
-                     >
 
-                         {getFieldDecorator('legalPersonIdCard', {
 
-                             rules: [{
 
-                                 validator: this.checkIdcardnum,
 
-                             }],
 
-                             initialValue: this.state.legalPersonIdCard || null
 
-                         })(
 
-                             <Input placeholder="请输入真实有效的身份证号码" />
 
-                             )}
 
-                     </FormItem>
 
-                     <FormItem
 
-                         {...formItemLayout}
 
-                         label="营业执照注册号"
 
-                     >
 
-                         {getFieldDecorator('licenceNumber', {
 
-                             initialValue: this.state.licenceNumber || null,
 
-                             rules: [{
 
-                                 validator: this.checkNumber,
 
-                             }],
 
-                         })(
 
-                             <Input />
 
-                             )}
 
-                     </FormItem>
 
-                     <FormItem
 
-                         labelCol={{ span: 6 }}
 
-                         wrapperCol={{ span: 18 }}
 
-                         label="营业执照所在地"
 
-                     >
 
-                         {getFieldDecorator('address')(
 
-                             <div>
 
-                                 <select id="cmbProvince" name="cmbProvince"></select>
 
-                                 <select id="cmbCity" name="cmbCity"></select>
 
-                                 <select id="cmbArea" name="cmbArea"></select>
 
-                             </div>
 
-                         )}
 
-                     </FormItem>
 
-                     <FormItem
 
-                         labelCol={{ span: 6 }}
 
-                         wrapperCol={{ span: 18 }}
 
-                         label="营业执照副本扫描件"
 
-                     >
 
-                         {getFieldDecorator('licenceScanningUrl')(
 
-                             <Avatar name="licenceScanningUrl" urlData={this.getLicenceScanningUrl} />
 
-                         )}
 
-                     </FormItem>
 
-                     <FormItem wrapperCol={{ span: 21, offset: 6 }}>
 
-                         <p>1.企业营业执照副本复印件加盖企业公章后,扫描或拍照上传,图片大小不超过2M以内,仅支持jpg格式。</p>
 
-                         <p>2.若已办理三证合一,请输入统一社会信用代码并上传营业执照副本复印件(加盖企业公章)。</p>
 
-                     </FormItem>
 
-                     <FormItem
 
-                         {...formItemLayout}
 
-                         label="组织机构代码证号码"
 
-                         extra={<span><Icon type="exclamation-circle" /> 如机构已五证合一,社会统一注册号的第九位至倒数第二位,即为您单位的组织机构代码证号码。</span>}
 
-                     >
 
-                         {getFieldDecorator('orgCode', {
 
-                             initialValue: this.state.orgCode || null,
 
-                             rules: [{ required: true, message: '请输入组织机构代码证号码!' }]
 
-                         })(
 
-                             <Input />
 
-                             )}
 
-                     </FormItem>
 
-                     <FormItem
 
-                         labelCol={{ span: 6 }}
 
-                         wrapperCol={{ span: 18 }}
 
-                         label="组织机构代码证扫描件"
 
-                     >
 
-                         {getFieldDecorator('orgCodeUrl')(
 
-                             <Avatar name="orgCodeUrl" urlData={this.getOrgCodeUrl} />
 
-                         )}
 
-                     </FormItem>
 
-                     <FormItem wrapperCol={{ span: 21, offset: 6 }}>
 
-                         <p>1.组织机构代码证副本复印件加盖企业公章后,扫描或拍照上传,图片大小不超过2M以内,仅支持jpg格式。</p>
 
-                         <p>2.若已办理三证合一,请输入统一社会信用代码并上传营业执照副本复印件(加盖企业公章)。</p>
 
-                     </FormItem>
 
-                     <FormItem
 
-                         labelCol={{ span: 6 }}
 
-                         wrapperCol={{ span: 18 }}
 
-                         label="上年度纳税报表"
 
-                     >
 
-                         {getFieldDecorator('lastYearTaxReportUrl')(
 
-                             <UploadFile name="lastYearTaxReportUrl" urlData={this.getLastYearTaxReportUrl} />
 
-                         )}
 
-                     </FormItem>
 
-                     <FormItem
 
-                         {...formItemLayout}
 
-                         label="验证码"
 
-                         extra={<span style={{ 'color': '#ea0862' }}><Icon type="exclamation-circle" /> 看不清?点击图片更换验证码</span>}
 
-                     >
 
-                         <Row gutter={8}>
 
-                             <Col span={16}>
 
-                                 {getFieldDecorator('captcha', {
 
-                                     rules: [{ required: true, message: '请输入图片中的验证码' }],
 
-                                 })(
 
-                                     <Input />
 
-                                     )}
 
-                             </Col>
 
-                             <Col span={8}>
 
-                                 <div className="getVcode">
 
-                                     <img id="VCode" src={this.state.vsCodeSrc} alt="" onClick={this.reloadVCode} />
 
-                                 </div>
 
-                             </Col>
 
-                         </Row>
 
-                     </FormItem>
 
-                     <FormItem wrapperCol={{ span: 12, offset: 6 }}>
 
-                         <Button className="set-submit" type="primary" htmlType="submit">下一步</Button>
 
-                         <Button className="exit" type="ghost">退出实名认证</Button>
 
-                     </FormItem>
 
-                 </Form >
 
-             </Spin >
 
-         );
 
-     },
 
- }));
 
- export default Content;
 
 
  |