|
@@ -1,13 +1,13 @@
|
|
|
import React from 'react';
|
|
|
import $ from 'jquery/src/ajax';
|
|
|
import {
|
|
|
- Modal,
|
|
|
- message,
|
|
|
- Spin,
|
|
|
- Upload,
|
|
|
- Input,
|
|
|
- Button,
|
|
|
- Form
|
|
|
+ Modal,
|
|
|
+ message,
|
|
|
+ Spin,
|
|
|
+ Upload,
|
|
|
+ Input,
|
|
|
+ Button,
|
|
|
+ Form, Icon
|
|
|
} from 'antd';
|
|
|
|
|
|
import { getAdviserType,getIndustry,getSocialAttribute,splitUrl } from '@/tools.js';
|
|
@@ -104,6 +104,46 @@ const AuthDetail = Form.create()(React.createClass({
|
|
|
};
|
|
|
}.bind(this));
|
|
|
},
|
|
|
+ beforeUpload(file) {
|
|
|
+ const isJPG = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg';
|
|
|
+ if (!isJPG) {
|
|
|
+ message.error('只能上传图片文件!');
|
|
|
+ return isJPG;
|
|
|
+ }
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 10;
|
|
|
+ if (!isLt2M) {
|
|
|
+ message.error('图片大小不能超过 10MB!');
|
|
|
+ return isLt2M;
|
|
|
+ }
|
|
|
+ return isJPG && isLt2M;
|
|
|
+ },
|
|
|
+ //上传图片
|
|
|
+ updateConsultantFun(){
|
|
|
+ this.setState({
|
|
|
+ loading:true
|
|
|
+ });
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "JSON",
|
|
|
+ crossDomain: false,
|
|
|
+ url: globalConfig.context + '/api/admin/updatePictureUrl',
|
|
|
+ data: {
|
|
|
+ url:this.state.consultantFileData,
|
|
|
+ uid:this.props.data.uid,
|
|
|
+ }
|
|
|
+ }).done(function (data) {
|
|
|
+ if (!data.error.length) {
|
|
|
+ message.success('操作成功!');
|
|
|
+ this.setState({
|
|
|
+ loading: false,
|
|
|
+ consultantFileData: '',
|
|
|
+ });
|
|
|
+ // this.props.handOk()
|
|
|
+ } else {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
//审核拒绝
|
|
|
refuse(){
|
|
|
this.setState({
|
|
@@ -151,6 +191,12 @@ const AuthDetail = Form.create()(React.createClass({
|
|
|
labelCol: { span: 6 },
|
|
|
wrapperCol: { span: 12 },
|
|
|
};
|
|
|
+ const uploadButton = (
|
|
|
+ <div>
|
|
|
+ <Icon type="plus" />
|
|
|
+ <div className="ant-upload-text">点击上传</div>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
return (
|
|
|
<div className='login'>
|
|
|
<Form layout="horizontal" id="demand-form">
|
|
@@ -274,26 +320,63 @@ const AuthDetail = Form.create()(React.createClass({
|
|
|
}
|
|
|
<div className="clearfix">
|
|
|
<FormItem className="half-item" labelCol={{ span: 6 }} wrapperCol={{ span: 10 }} label="顾问照片">
|
|
|
- <Upload className="demandDetailShow-upload"
|
|
|
- listType="picture-card"
|
|
|
- fileList={this.state.headPortraitUrl}
|
|
|
- onPreview={(file) => {
|
|
|
+ {/*<Upload className="demandDetailShow-upload"*/}
|
|
|
+ {/* listType="picture-card"*/}
|
|
|
+ {/* fileList={this.state.headPortraitUrl} */}
|
|
|
+ {/* onPreview={(file) => {*/}
|
|
|
+ {/* this.setState({*/}
|
|
|
+ {/* previewImage: file.url || file.thumbUrl,*/}
|
|
|
+ {/* previewVisible: true,*/}
|
|
|
+ {/* });*/}
|
|
|
+ {/* }} >*/}
|
|
|
+ {/*</Upload>*/}
|
|
|
+ <Upload
|
|
|
+ action={globalConfig.context + '/api/admin/uploadPicture'}
|
|
|
+ data={{ sign: 'user_picture',uid:this.props.data.uid}}
|
|
|
+ listType="picture-card"
|
|
|
+ fileList={this.state.headPortraitUrl}
|
|
|
+ beforeUpload={this.beforeUpload}
|
|
|
+ onPreview={(file) => {
|
|
|
+ this.setState({
|
|
|
+ previewImage: file.url || file.thumbUrl,
|
|
|
+ previewVisible: true,
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ onChange={(info)=>{
|
|
|
+ if(info.file.status) {
|
|
|
+ let fileList = info.fileList;
|
|
|
this.setState({
|
|
|
- previewImage: file.url || file.thumbUrl,
|
|
|
- previewVisible: true,
|
|
|
+ headPortraitUrl: fileList,
|
|
|
});
|
|
|
- }} >
|
|
|
- </Upload>
|
|
|
- <Modal maskClosable={false} footer={null}
|
|
|
- visible={this.state.previewVisible}
|
|
|
- onCancel={() => { this.setState({ previewVisible: false }) }}>
|
|
|
- <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
|
|
|
- </Modal>
|
|
|
+ if (info.file.status === 'done') {
|
|
|
+ this.setState({
|
|
|
+ consultantFileData: info.file.response.data,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }}>
|
|
|
+ {this.state.headPortraitUrl.length === 0 ? uploadButton : null}
|
|
|
+ </Upload>
|
|
|
+ <Button
|
|
|
+ style={{
|
|
|
+ marginLeft:'30px'
|
|
|
+ }}
|
|
|
+ type="primary"
|
|
|
+ onClick={(e)=>{this.updateConsultantFun()}}
|
|
|
+ disabled={!this.state.consultantFileData || this.state.headPortraitUrl.length === 0}
|
|
|
+ >
|
|
|
+ 保存
|
|
|
+ </Button>
|
|
|
+ <Modal maskClosable={false} footer={null}
|
|
|
+ visible={this.state.previewVisible}
|
|
|
+ onCancel={() => { this.setState({ previewVisible: false }) }}>
|
|
|
+ <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
|
|
|
+ </Modal>
|
|
|
</FormItem>
|
|
|
{theData.consultantType=='4'&&<FormItem className="half-item" labelCol={{ span: 6 }} wrapperCol={{ span: 10 }} label="律师职业资格证">
|
|
|
<Upload className="demandDetailShow-upload"
|
|
|
listType="picture-card"
|
|
|
- fileList={this.state.lawUrl}
|
|
|
+ fileList={this.state.lawUrl}
|
|
|
onPreview={(file) => {
|
|
|
this.setState({
|
|
|
previewImage: file.url || file.thumbUrl,
|