Browse Source

Merge branch 'master' of ssh://git.jishutao.com:55555/jishutao/jitao-client

dengzhiguo 6 years ago
parent
commit
fce592840f

+ 137 - 12
js/component/account/setAccount/expert.jsx

@@ -1,7 +1,6 @@
 /* 
 	@author:李霆
 	@update:2018/05/29
-	@descript:复制粘贴,拿起来就是干!!
 */
 
 import React from 'react';
@@ -25,10 +24,11 @@ import $ from 'jquery/src/ajax';
 import moment from 'moment';
 import './unit.less';
 import { areaSelect } from '@/NewDicProvinceList';
-import { socialAttribute, industry,adviserType } from '@/dataDic.js';
+import { socialAttribute, industry,adviserType,lawType } from '@/dataDic.js';
 import { splitUrl,getAuthState,getAdviserType ,getSocialAttribute } from '@/tools.js';
 const FormItem = Form.Item;
 const monthFormat = 'YYYY/MM';
+
 //图片组件
 
 const PicturesWall = React.createClass({
@@ -95,8 +95,10 @@ const Expert = React.createClass({
 			orgCodeUrl: [],
 			companyLogoUrl: [],
 			headPortraitUrl: [],
+			lawState:false,
 			adviserUrl:[],
 			positiveIdUrl: [],
+			lawUrl:[],
 			oppositeIdUrl: [],
 			authenticationState:undefined
 		};
@@ -137,7 +139,7 @@ const Expert = React.createClass({
 					authenticationState:authenticationState,
 					dateOfBirthYear:thisData.dateOfBirthYear,
 					dateOfBirthMonth:thisData.dateOfBirthMonth,
-					type:thisData.type,          //0-个人认证  1-企业认证 
+					type:thisData.type,
 					expert:thisData.expert,   //认证类型   0-未认证专家顾问  1-专家认证 2-顾问认证
  					authMessage:thisData.auditInfo,
 					auditStatus:thisData.auditStatus||'0', //认证状态  0-未认证  1-认证审核中   2-已认证 3-认证失败
@@ -153,6 +155,9 @@ const Expert = React.createClass({
 					oppositeIdUrl: thisData.oppositeIdUrl
 						? splitUrl(thisData.oppositeIdUrl, ',', globalConfig.avatarHost + '/upload')
 						: [],
+					lawUrl:thisData.oppositeIdUrl
+					? splitUrl(thisData.oppositeIdUrl, ',', globalConfig.avatarHost + '/upload')
+					: [],
 					data: thisData,
 					ProvinceCity: ProvinceCityArr[0] != null ? ProvinceCityArr : undefined,
 					yearMonth: month,
@@ -220,6 +225,17 @@ const Expert = React.createClass({
 				});
 				thecompanyLogoUrls = picArr.join(',');
 			}
+			//律师证书
+			let lawUrls = [];
+			if (this.state.lawUrl.length) {
+				let picArr = [];
+				this.state.lawUrl.map(function(item) {
+					if (item.response && item.response.data && item.response.data.length) {
+						picArr.push(item.response.data);
+					}
+				});
+				lawUrls = picArr.join(',');
+			}
 			let years = [];
 			years = this.state.yearList!=undefined?(this.state.yearList).split('/'):[this.state.dateOfBirthYear,this.state.dateOfBirthMonth];
         this.setState({
@@ -262,6 +278,9 @@ const Expert = React.createClass({
 				dataList.oppositeIdUrl=thecompanyLogoUrls.length != 0 ? thecompanyLogoUrls : '';
 		}else if(this.state.authenticationState=='1'){
 				dataList.expert='2';
+				dataList.lawFirm=values.adviserType=='4'?values.lawFirm:'';
+				dataList.lawType=values.adviserType=='4'?values.lawType:'';
+				dataList.lawUrl=values.adviserType=='4'&&lawUrls.length !=0 ?lawUrls:''; //法律职业资格证
 				dataList.consultantType=values.adviserType;//顾问类型
 				dataList.headPortraitUrl=theorgCodeUrl.length != 0 ? theorgCodeUrl : '';	//顾问照片
 				dataList.positiveIdUrl=thecompanyLogoUrl.length != 0 ? thecompanyLogoUrl : '';
@@ -296,6 +315,10 @@ const Expert = React.createClass({
 						message.warning(this.state.authenticationState=='1'?'请上传顾问照片!':'请上传专家照片');
 						return;
 					}
+					if(!(this.state.lawUrl.length)){
+						message.warning('请上传您的律师职业资格证!');
+						return;
+					}
 					if(!(this.state.oppositeIdUrl.length)||!(this.state.positiveIdUrl.length)){
 						message.warning('请上传您的身份证正反照片!');
 						return;
@@ -321,6 +344,18 @@ const Expert = React.createClass({
 			visible: false
 		});
 	},
+	//顾问选择法律顾问
+	handleSelectChange(value){
+		if(value=='4'){
+			this.setState({
+				lawState:true
+			})
+		}else{
+			this.setState({
+				lawState:false
+			})
+		}
+	},
 	getHeadPortraitUrl(e) {
 		this.setState({ headPortraitUrl: e });
 	},
@@ -374,9 +409,9 @@ const Expert = React.createClass({
 							<FormItem className="half-item" {...formItemLayout} label="社会属性">
 								{getFieldDecorator('societyTag', {
 									rules: [ { required: true, message: '此项为必填项!' } ],
-									initialValue: theData.societyTag
+									initialValue: theData.societyTag||undefined
 								})(
-									<Select placeholder="客户社会属性">
+									<Select placeholder="客户社会属性" placeholder="请选择社会属性">
 										{socialAttribute.map(function(item) {
 											return <Select.Option key={item.value}>{item.key}</Select.Option>;
 										})}
@@ -454,11 +489,12 @@ const Expert = React.createClass({
 						<div className="clearfix">
 							<FormItem
 								labelCol={{ span: 3 }}
-								wrapperCol={{ span: 18 }}
+								wrapperCol={{ span: 10 }}
 								label="个人简介"
 							>
 								{getFieldDecorator('introduction', {
-									initialValue: theData.introduction
+									initialValue: theData.introduction,
+									rules: [ { required: true, message: '此项为必填项!' } ]
 								})(<Input type="textarea" rows={4} maxLength={512} placeholder="输入个人简介,比如案例、简介、从业时间、服务企业等"/>)}
 							</FormItem>
 						</div>
@@ -513,9 +549,9 @@ const Expert = React.createClass({
 								<FormItem className="half-item" {...formItemLayout} label="顾问类型">
 								{getFieldDecorator('adviserType', {
 									rules: [ { required: true, message: '此项为必填项!' } ],
-									initialValue: (theData.consultantType||theData.consultantType=='0')&&theData.consultantType.toString()
+									initialValue: (theData.consultantType||theData.consultantType=='0')?theData.consultantType.toString():undefined
 								})(
-									<Select placeholder="选择类型">
+									<Select placeholder="选择类型" onChange={this.handleSelectChange.bind(this)}>
 										{adviserType.map(function(item) {
 											return <Select.Option key={item.value}>{item.key}</Select.Option>;
 										})}
@@ -523,20 +559,70 @@ const Expert = React.createClass({
 								)}
 								</FormItem>
 							</div>:''}
+							{
+								this.state.lawState?<div className="clearfix"><div>
+									<FormItem className="half-item" {...formItemLayout} label="法律顾问类型">
+										{getFieldDecorator('lawType', {
+											rules: [ { required: true, message: '此项为必填项!' } ],
+											initialValue: (theData.lawType||theData.lawType=='0')?theData.lawType.toString():undefined
+										})(
+											<Select placeholder="选择类型">
+												{lawType.map(function(item) {
+													return <Select.Option key={item.value}>{item.key}</Select.Option>;
+												})}
+											</Select>
+										)}
+								    </FormItem>
+								</div>
+								<div className="clearfix">
+									<FormItem className="half-item" {...formItemLayout} label="律师事务所">
+										{getFieldDecorator('lawFirm', {
+											rules: [ { required: true, message: '此项为必填项!' } ],
+											initialValue: theData.lawFirm
+										})(
+											<Input placeholder="请填写所在律师事务所全称"/>
+										)}
+								    </FormItem>
+								</div>
+								<div className="clearfix">
+									<FormItem
+										labelCol={{ span: 3 }}
+										wrapperCol={{ span: 10 }}
+										label="典型案例"
+									>
+										{getFieldDecorator('case', {
+											initialValue: theData.case,
+											rules: [ { required: true, message: '此项为必填项!' } ]
+										})(<Input type="textarea" rows={4} maxLength={10000} placeholder="输入典型案例"/>)}
+									</FormItem>
+								</div></div>:''
+							}
 							{this.state.authenticationState=='1'||this.state.authenticationState=='0'?<div className="clearfix pictures">
 								<div className="clearfix">
 									<FormItem
 										className="picWidth"
 										labelCol={{ span: 9 }}
 										wrapperCol={{ span: 10 }}
-										label={<span><strong style={{color:"#f00"}}>*</strong><span>{this.state.authenticationState=='0'?'专家照片':'顾问照片'}</span></span> }
+										label={<span><strong style={{color:"#f00"}}> * </strong><span>{this.state.authenticationState=='0'?'专家照片':'顾问照片'}</span></span> }
 									>
 										<PicturesWall
 											fileList={this.getHeadPortraitUrl}
 											pictureUrl={this.state.headPortraitUrl}
 										/>
-										<p>建议:图片要清晰1。</p>
+										<p>建议:图片要清晰。</p>
 									</FormItem>
+									{this.state.lawState?<FormItem
+										className="picWidth"
+										labelCol={{ span: 9 }}
+										wrapperCol={{ span: 10 }}
+										label={<span><strong style={{color:"#f00"}}> * </strong><span>律师职业资格证</span></span> }
+									>
+										<PicturesWall
+											fileList={(e)=>{this.setState({lawUrl:e})}}
+											pictureUrl={this.state.lawUrl}
+										/>
+										<p>建议:图片要清晰。</p>
+									</FormItem>:''}
 								</div>
 								<FormItem
 									className="picWidth"
@@ -556,6 +642,7 @@ const Expert = React.createClass({
 									<PicturesWall fileList={this.getOppositeIdUrl} pictureUrl={this.state.oppositeIdUrl} />
 									<p>建议:图片要清晰。</p>
 								</FormItem>
+
 							</div>:''}
 						</div>:(this.state.auditStatus=='2'||this.state.auditStatus=='1')&&this.state.expert=='1'?
 					    <div>
@@ -639,8 +726,29 @@ const Expert = React.createClass({
 							<FormItem className="half-item" {...formItemLayout} label="顾问类型">
 								<span>{getAdviserType(theData.consultantType)}</span>
 							</FormItem>
+							{
+								theData.consultantType=='4'?<div className="clearfix"><div>
+									<FormItem className="half-item" {...formItemLayout} label="法律顾问类型">
+										<span>{lawType(theData.lawType)}</span>
+								    </FormItem>
+								</div>
+								<div className="clearfix">
+									<FormItem className="half-item" {...formItemLayout} label="律师事务所">
+										<span>{theData.lawFirm}</span>
+								    </FormItem>
+								</div>
+								<div className="clearfix">
+									<FormItem
+										labelCol={{ span: 3 }}
+										wrapperCol={{ span: 10 }}
+										label="典型案例"
+									>
+										<span>{theData.case}</span>
+									</FormItem>
+								</div></div>:''
+							}
 							<div className="clearfix">
-								<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 13 }} label="顾问照片">
+								<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 10 }} label="顾问照片">
 										<Upload className="demandDetailShow-upload"
 											listType="picture-card"
 											fileList={this.state.headPortraitUrl}                               
@@ -657,6 +765,23 @@ const Expert = React.createClass({
 											<img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
 										</Modal>
 								</FormItem>
+								<FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 10 }} label="律师职业资格证">
+										<Upload className="demandDetailShow-upload"
+											listType="picture-card"
+											fileList={this.state.layUrl}                               
+											onPreview={(file) => {
+												this.setState({
+													previewImage: file.url || file.thumbUrl,
+													previewVisible: true,
+												});
+											}} >
+										</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>
+								</FormItem>
 							</div>
 							<div>
 								<FormItem className="picWidth" labelCol={{ span: 9 }} wrapperCol={{ span: 10 }} label="身份证正面">

+ 106 - 76
js/component/account/setAccount/unit.jsx

@@ -31,6 +31,7 @@ import {
 	splitUrl,
 } from '@/tools.js';
 const FormItem = Form.Item;
+import Crop from '@/crop/cropBlock';
 //图片组件
 const PicturesWall = React.createClass({
 	getInitialState() {
@@ -170,11 +171,13 @@ const Unit = React.createClass({
 					}
 					thisData = {};
 				}
+				// thisData.companyLogoUrl='/user/33e04d30-d001-45c5-8e1e-33a1964d2498/1104216629777565_user_picture.jpg'
 				// let ProvinceCityArr = [];
 				// let ProvinceS = thisData.locationProvince; //getprovince
 				// let citys = thisData.locationCity;
 				// let Areas = thisData.locationArea;
 				// ProvinceCityArr.push(ProvinceS, citys, Areas);
+
 				this.setState({
 					InformationId: thisData.id,
 					InformationUid: thisData.uid,
@@ -184,9 +187,10 @@ const Unit = React.createClass({
 					orgCodeUrl: thisData.orgCodeUrl
 						? splitUrl(thisData.orgCodeUrl, ',', globalConfig.avatarHost + '/upload')
 						: [],
-					companyLogoUrl: thisData.companyLogoUrl
-						? splitUrl(thisData.companyLogoUrl, ',', globalConfig.avatarHost + '/upload')
-						: [],
+					// companyLogoUrl: thisData.companyLogoUrl
+					// 	? splitUrl(thisData.companyLogoUrl, ',', globalConfig.avatarHost + '/upload')
+					// 	: [],
+					companyLogoUrl:thisData.companyLogoUrl?thisData.companyLogoUrl.split(','):[],
 					qualiUrl: thisData.honorPicture
 					? splitUrl(thisData.honorPicture, ',', globalConfig.avatarHost + '/upload')
 					: [],
@@ -206,6 +210,8 @@ const Unit = React.createClass({
 					businessScope: thisData.businessScope,
 					orgCode: thisData.orgCode,
 					type:thisData.type,
+					qq:thisData.qq,
+					email:thisData.email,
 					authentication:thisData.authentication
 				});
 			}.bind(this)
@@ -235,11 +241,9 @@ const Unit = React.createClass({
 	},
 	//基本信息提交
 	newSubmit(e) {
-		
 		this.setState({
 			selectedRowKeys: []
 		});
-		
 		let theorgCodeUrl = [];
 		if (this.state.orgCodeUrl.length) {
 			let picArr = [];
@@ -250,16 +254,16 @@ const Unit = React.createClass({
 			});
 			theorgCodeUrl = picArr.join(',');
 		}
-		let thecompanyLogoUrl = [];
-		if (this.state.companyLogoUrl.length) {
-			let picArr = [];
-			this.state.companyLogoUrl.map(function(item) {
-				if (item.response && item.response.data && item.response.data.length) {
-					picArr.push(item.response.data);
-				}
-			});
-			thecompanyLogoUrl = picArr.join(',');
-		}
+		//let thecompanyLogoUrl = [];
+		// if (this.state.companyLogoUrl.length) {
+		// 	let picArr = [];
+		// 	this.state.companyLogoUrl.map(function(item) {
+		// 		if (item.response && item.response.data && item.response.data.length) {
+		// 			picArr.push(item.response.data);
+		// 		}
+		// 	});
+		// 	thecompanyLogoUrl = picArr.join(',');
+		// }
 		let thequaliUrl = [];
 		if (this.state.qualiUrl.length) {
 			let picArr = [];
@@ -300,12 +304,15 @@ const Unit = React.createClass({
 				orgCode: this.state.orgCode,
 				businessScope: this.state.businessScope,
 				introduction: this.state.introduction,
-				companyLogoUrl: thecompanyLogoUrl.length != 0 ? thecompanyLogoUrl : '',
+				// companyLogoUrl: thecompanyLogoUrl.length != 0 ? thecompanyLogoUrl : '',
+				companyLogoUrl:this.state.companyLogoUrl.length>0?(this.state.companyLogoUrl).join(','):[],
 				honorPicture: thequaliUrl.length != 0 ? thequaliUrl : '',
 				orgCodeUrl: theorgCodeUrl.length != 0 ? theorgCodeUrl : '',
 				auditStatus: this.state.auditStatus,
 				authentication:this.state.authentication,
-				type:this.state.type
+				type:this.state.type,
+				qq:this.state.qq,
+				email:this.state.email
 			}
 		}).done(
 			function(data) {
@@ -313,15 +320,8 @@ const Unit = React.createClass({
 					loading: false
 				});
 				if (!data.error.length) {
-					if(this.state.type!='1'){
-						message.success('企业认证成功,1s后回到首页.')
-						setTimeout(()=>{
-							window.location.href = globalConfig.context + "/user/account/index.html";
-						},1000)  
-					}else{
-						message.success('保存成功');
-						this.loadInformation();
-					}
+					message.success('保存成功');
+					this.loadInformation();
 				} else {
 					message.warning(data.error[0].message);
 				}
@@ -329,45 +329,39 @@ const Unit = React.createClass({
 		);
 	},
 	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 (isNaN(this.state.registeredCapital)) {
-				message.warning('注册资本只能输入数字!');
-				return false;
-			}
-			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 (isNaN(this.state.registeredCapital)) {
-				message.warning('注册资本只能输入数字!');
-				return false;
-			}
-			this.setState({
-				visible:true
-			})
+		if(!this.state.identifyName){
+			message.warning("请填写单位名称")
+			return;
+		}
+		if (!this.state.industry) {
+			message.warning('请选择行业!');
+			return false;
+		}
+		if (!this.state.societyTag) {
+			message.warning('请选择社会性质!');
+			return false;
 		}
+		if (isNaN(this.state.registeredCapital)) {
+			message.warning('注册资本只能输入数字!');
+			return false;
+		}
+		if (!this.state.email) {
+			message.warning('请填写企业邮箱!');
+			return false;
+		}
+		if (!this.state.qq) {
+			message.warning('请填写企业QQ!');
+			return false;
+		}
+		if (this.state.companyLogoUrl&&(this.state.companyLogoUrl.length)<1) {
+			message.warning('请上传企业LOGO.');
+			return false;
+		}
+		if (this.state.qualiUrl&&(this.state.qualiUrl.length)<1) {
+			message.warning('请上传资质荣誉照片.');
+			return false;
+		}
+		this.newSubmit()
 	},
 	handleOk(){
 		this.newSubmit();
@@ -380,6 +374,12 @@ const Unit = React.createClass({
 			visible:false
 		})
 	},
+	//logo图片获取
+	getAllImg(imgArr){
+		this.setState({
+			companyLogoUrl:imgArr
+		})
+	},
 	componentWillMount() {
 		this.loadInformation();
 	},
@@ -510,7 +510,6 @@ const Unit = React.createClass({
 									}}
 								/>
 							</FormItem>
-							
 							<FormItem
 								className="half-item"
 								labelCol={{ span: 4 }}
@@ -581,6 +580,34 @@ const Unit = React.createClass({
 									}}
 								/>
 							</FormItem>
+							<FormItem
+								className="half-item"
+								labelCol={{ span: 4 }}
+								wrapperCol={{ span: 18 }}
+								label={<span><span className="color-red"> * </span>企业邮箱</span>}
+							>
+								<Input
+									placeholder="请填写企业邮箱"
+									value={this.state.email}
+									onChange={(e) => {
+										this.setState({ email: e.target.value });
+									}}
+								/>
+							</FormItem>
+							<FormItem
+								className="half-item"
+								labelCol={{ span: 4 }}
+								wrapperCol={{ span: 18 }}
+								label={<span><span className="color-red"> * </span>企业QQ</span>}
+							>
+								<Input
+									placeholder="填写企业QQ"
+									value={this.state.qq}
+									onChange={(e) => {
+										this.setState({ qq: e.target.value });
+									}}
+								/>
+							</FormItem>
 							<FormItem className="half-item" labelCol={{ span: 4 }} wrapperCol={{ span: 18 }} label="高新">
 								<Radio.Group
 									value={this.state.highTechZone}
@@ -621,16 +648,26 @@ const Unit = React.createClass({
 								</FormItem>
 								<FormItem
 									className="half-item"
+									style={{paddingTop:15}}
 									labelCol={{ span: 4 }}
 									wrapperCol={{ span: 18 }}
-									label="企业logo"
+								label={<span><span className="color-red"> * </span>企业logo</span>}
 								>
-									<PicturesWall
+									{/* <PicturesWall
 										pictureSign="logo"
 										fileList={this.getCompanyLogoUrl}
 										pictureUrl={this.state.companyLogoUrl}
 									/>
-									<p>图片建议:图片要清晰。</p>
+									<p>图片建议:图片要清晰。</p> */}
+									<Crop 
+										getAllImg={this.getAllImg}
+										number = {1} 
+										aspectRatio = {1/1}
+										url ={globalConfig.context + '/api/user/uploadPicture64'}
+										uploadData = {{sign:'user_picture'}} 
+										urlArr = {this.state.companyLogoUrl} 
+									/>
+									<p>图片建议 : 图片要清晰。</p> 
 								</FormItem>
 							</div>
 							<div className="clearfix">
@@ -672,7 +709,7 @@ const Unit = React.createClass({
 									labelCol={{ span: 2 }}
 									wrapperCol={{ span: 18 }}
 									style={{ marginTop: 15 }}
-									label="荣誉资质"
+									label={<span><span className="color-red"> * </span>荣誉资质</span>}
 								>
 									<PicturesWallMore
 										pictureSign="PIC"
@@ -693,13 +730,6 @@ const Unit = React.createClass({
 						</div>
 					</Spin>
 				</Form>
-				<Modal
-					visible={this.state.visible}
-					onOk={this.handleOk}
-					onCancel={this.handleCancel}
-					>
-						<p>是否申请企业用户认证?</p>
-				</Modal>
 			</div>
 		);
 	}

+ 7 - 2
js/component/account/setAccount/unit.less

@@ -21,9 +21,14 @@
         }
     }
     .color-red{
+        display: inline-block;
+        font-size: 16px;
+        margin-right: 5px;
+        font-weight: 900;
         color:#f5222d;
-        margin-left: 5px
-        
+        margin-left: 5px;
+        vertical-align: top;
+        margin-top: 2px;
     }
     .picWidth{
         width: 33.33%;

+ 91 - 21
js/component/crop/crop.css

@@ -6,22 +6,85 @@
 }
 .crop-add-img {
 	position: relative;
+	border: 1px dashed #d9d9d9;
+    width: 96px;
+    height: 96px;
+    border-radius: 4px;
+    background-color: #fbfbfb;
+    text-align: center;
+    cursor: pointer;
+    transition: border-color 0.3s ease;
+    display: inline-block;
+    vertical-align: top;
+	margin-top: 2px;
+	color: #999;
+}
+.crop-input{
+	height: 70px;
+	line-height:70px;
+}
+.crop-input button{
+	float: left;
+}
+.selectFile {
+	visibility: hidden;
+	margin-top: -20px;
+}
+.crop-add-img:hover{
+	border-color: #2F86C9;
+}
+.crop-add-img>span{
 	display: inline-block;
-	width: 80px;
-	height: 24px;
-	line-height: 24px;
-	text-align: center;
-	font-size: 12px;
-	border: 1px solid #2F86C9;
-	color: #2F86C9;
-	cursor: pointer;
+	font-size: 18px;
+	color: #999;
+	margin-top: 16px;
 }
 .crop-img-block {
+	position: relative;
+	box-sizing: border-box;
 	display: inline-block;
-	width: 50px;
-	height: 50px;
-	margin: 5px;
-	
+	width: 94px;
+	height: 96px;
+	margin:0 5px;
+	padding: 8px;
+    border-radius: 4px;
+	border: 1px solid #d9d9d9;
+	margin-top: 2px;
+}
+.crop-img-block:hover{
+	box-shadow: 0 0 3px #ccc;
+}
+.crop-img-block:hover span{
+	display: block;
+}
+.crop-img-block img{
+	width: 100%;
+	height: 100%;
+	position: absolute;
+	left:0px;
+	padding: 8px;
+	top:0px;
+}
+.crop-img-block span{
+	cursor: pointer;
+	position: absolute;
+	padding: 8px;
+	top:0px;
+	left:0px;
+	display: none;
+	width: 92px;
+	height: 94px;
+	font-size: 24px;
+	background: rgba(0, 0, 0, .3);
+	color: #fff;
+	line-height:84px;
+	text-align: center;
+}
+.crop-img-block span .anticon{
+	color: #fff;
+}
+.crop-img-block span .anticon:hover{
+	color: #f00;
 }
 .crop-img {
 	max-width: 100%;
@@ -49,33 +112,40 @@
 .crop-box-content {
 	position: relative;
 	width: 800px;
-	height: 500px;
-	margin: 50px auto 0 auto;
+	height: 525px;
+	margin: 100px auto 0 auto;
 	background-color: #fff;
 }
 .crop-close {
 	position: absolute;
 	right: 10px;
 	top: 10px;
-	border: 1px solid #2F86C9;
-	color: #2F86C9;
-	font-size: 12px;
+	font-size: 30px;
+	color: #666;
 	padding: 0 5px;
 	height: 24px;
 	line-height: 24px;
 	cursor: pointer;
 }
+.crop-close:hover{
+	color: #f00;
+}
 .crop-input {
 	position: relative;
 	padding: 10px;
 	text-align: center;
-	border-bottom: 1px solid #2F86C9;
+	border-bottom: 1px solid #ccc;
 }
 .crop-area {
 	position: relative;
 	padding-left: 200px;
-	border-bottom: 1px solid #2F86C9;
+	border-bottom: 1px solid #ccc;
+}
+.btnGrounpCrop{
+	width: 100%;
+	margin: 0!important;
+	text-align: center;
 }
-.crop-sure-btn {
-	margin: 10px 0 0 350px;
+.btnGrounpCrop button{
+	margin: 10px ;
 }

+ 32 - 22
js/component/crop/cropBlock.jsx

@@ -3,6 +3,7 @@ import React, {
 } from 'react';
 import CropBox from './cropBox.jsx';
 import './crop.css';
+import {Icon,message} from 'antd';
 
 class CropBlock extends Component {
 	constructor(props) {
@@ -31,28 +32,28 @@ class CropBlock extends Component {
 		})
 		this.getAllImg(urlArr2);
 	}
-
 	addImg() {
 		if(!this.state.number || (this.state.urlArr.length < this.state.number)) {
 			this.setState({
 				close: false
 			})
-		}
-		else {
-			alert("最多上传"+this.state.number+"张图片!");
+		}else {
+			message.warning("最多上传"+this.state.number+"张图片!");
 		}
 	}
-
+	closeFun(state){
+		this.setState({
+			close:state
+		})
+	}
 	delImg(index) {
-		if(window.confirm("你确定要删除改图片吗")) {
-			let urlArr2 = this.state.urlArr;
-			urlArr2.splice(index, 1);
-			this.setState({
-				urlArr: urlArr2,
-				close: true
-			})
-			this.getAllImg(urlArr2);
-		}
+		let urlArr2 = this.state.urlArr;
+		urlArr2.splice(index, 1);
+		this.setState({
+			urlArr: urlArr2,
+			close: true
+		})
+		this.getAllImg(urlArr2);
 	}
 
 	getAllImg(urlArr) {
@@ -60,19 +61,28 @@ class CropBlock extends Component {
 			this.props.getAllImg(urlArr);
 		}
 	}
-
+	componentWillReceiveProps(data){
+		if(data.urlArr.length>0){
+			this.setState({
+				urlArr:data.urlArr
+			})
+		}
+	}
 	render() {
-		console.log(this.state.urlArr)
 		let imgList = this.state.urlArr.map((src, index) =>
 			<div key = {index} className="crop-img-block">
-				<img alt = "图片" className = "crop-img" title = "删除" src = {src} onClick = {this.delImg.bind(this, index)} />
+				<img alt = "图片" className = "crop-img" title ="" src = {globalConfig.avatarHost + '/upload'+src} />
+				<span className="del"><Icon type='delete'  onClick = {this.delImg.bind(this, index)}/></span>
 			</div>
 		)
 		return (
 			<div className = "crop-block">
-			   {imgList}
-				<div className="crop-add-img" onClick = {this.addImg}>添加图片</div>
-				<CropBox getUrl = {this.getUrl} uploadData = {this.state.uploadData} aspectRatio = {this.state.aspectRatio} url = {this.state.url} close = {this.state.close}/>
+			    {imgList}
+				{this.state.urlArr.length < this.state.number&&<div className="crop-add-img" onClick = {this.addImg}>
+					<span>+</span>
+					<p>点击上传</p>
+				</div>}
+				<CropBox closeFun={this.closeFun.bind(this)} getUrl = {this.getUrl} uploadData = {this.state.uploadData} aspectRatio = {this.state.aspectRatio} url = {this.state.url} close = {this.state.close}/>
 			</div>
 		)
 	}
@@ -84,8 +94,8 @@ export default CropBlock;
 /* 
    //调用
  <Crop 
- number = {5} 
- aspectRatio = {1/1}
+  number = {5} 
+  aspectRatio = {1/1}
   url ={globalConfig.context + '/api/admin/banners/uploadPicture'}
   uploadData = {{sign: 'banners'}} 
   urlArr = {[]} 

+ 52 - 36
js/component/crop/cropBox.jsx

@@ -4,33 +4,30 @@ import React, {
 import $ from 'jquery';
 import Cropper from 'react-cropper';
 import 'cropperjs/dist/cropper.css';
+import {Button,message} from 'antd';
 
 class CropBox extends Component {
 	constructor(props) {
 		super(props);
-
 		this.state = {
-	      src: '',
+		  src: '',
+		  imgName:'',
 	      close: this.props.close ? this.props.close : true,
 	      url: this.props.url ? this.props.url : '',
 	      uploadData: this.props.uploadData ? this.props.uploadData : {},
 	      aspectRatio: this.props.aspectRatio ? this.props.aspectRatio : ''
 	    }
-
 	    this.onChange = this.onChange.bind(this);
 	    this.cropImage = this.cropImage.bind(this);
 	    this.convertBase64UrlToBlob = this.convertBase64UrlToBlob.bind(this);
 	    this.submitUpload = this.submitUpload.bind(this);
 	    this.closeBox = this.closeBox.bind(this);
-
 	}
-
 	componentWillReceiveProps(nextProps) {
         this.setState({
             close: nextProps.close
         })
     }
-
 	onChange(e) {
 	    e.preventDefault();
 	    let files;
@@ -44,49 +41,61 @@ class CropBox extends Component {
 	      this.setState({
 	        src: reader.result
 	      });
-	    };
+		};
+		this.setState({
+			imgName:files[0].name
+		})
 	    reader.readAsDataURL(files[0]);
 	}
-
 	cropImage() {
-	    if (typeof this.cropper.getCroppedCanvas() === 'undefined') {
-	      return;
+	    if (typeof this.cropper.getCroppedCanvas() == 'undefined'||this.cropper.getCroppedCanvas()==undefined) {
+			message.warning('请选择图片!')
+			return;
 	    }
 		let img64Data = this.cropper.getCroppedCanvas().toDataURL();
-		console.log(img64Data)
-		//let imgblobDate = this.convertBase64UrlToBlob(img64Data);
-		let imgblobDate = this.dataURLtoFile(img64Data,'nihao');
-	    this.submitUpload(imgblobDate);
+		let imgblobDates = this.convertBase64UrlToBlob(img64Data);  //二进制文件格式
+		let imgfileDate = this.dataURLtoFile(img64Data,this.state.imgName); //文件流格式
+	    this.submitUpload(imgfileDate,img64Data);
 	}
-
-	submitUpload(imgBlob) {
-		console.log(imgBlob)
-		let _this = this;
-		let fd = new FormData();
-		fd.append('file', imgBlob);
+	submitUpload(imgBlob,img64Data) {
+		if(imgBlob.size>(2097152/2)){
+			message.warning('图片不能超过1M.');
+			return false;
+		}
+		this.props.closeFun(true);
+		let _this = this,dataList={};
+		//转换为文件流传输
+		/* let fd = new FormData();
 		for(let key in this.state.uploadData) {
 			fd.append(key, this.state.uploadData[key]);
-		}
-		
+		} 
+		fd.append('file',imgBlob); */
+		dataList.filename=this.state.imgName;
+		dataList.sign=this.state.uploadData['sign'];
+		dataList.picturebase=img64Data.split(',')[1];
 		$.ajax({
 		    url: this.state.url,
 		    type: 'POST',
-		    data: fd,
-		    contentType: false,
-		    processData: false,
-		    dataType: 'json',
+			dataType: 'json',
+			// processData: false,  // 注意:让jQuery不要处理数据
+            // contentType: false,  // 注意:让jQuery不要设置contentType
+			data:dataList,
 		    success: function (data) {
-	    		console.log(data.result);
-	    		if(_this.props.getUrl) {
-	    			_this.props.getUrl(data.result);
-	    		}
+	    		if(data.error&&data.error.length>0){
+					message.error(data.error[0].message);
+				}else{
+					if(_this.props.getUrl) {
+						_this.props.getUrl(data.data);
+					}
+					message.success('上传成功');
+				}
 	    		_this.setState({
 	    			close: true,
 	    			src: ''
-	    		})
+				})
 		    },
 		    error: function(err) {
-		    	console.log(err);
+		    	message.error(err)
 		    }
 		});
 	}
@@ -110,10 +119,14 @@ class CropBox extends Component {
 	    }  
 	    return new Blob( [ab] , {type : 'image/png'});
 	}
+	selFile(){
+		document.querySelector('.crop-input input[type=file]').click();
+	}
 	closeBox() {
 		this.setState({
 			close: true
 		})
+		this.props.closeFun(true)
 	}
 	render() {
 		return (
@@ -121,8 +134,9 @@ class CropBox extends Component {
 				<div className="crop-box-bg"></div>
 				<div className="crop-box-content">
 					<div className="crop-input">	
-						<input type="file" onChange={this.onChange} key = {this.state.src}/>
-						<div className="crop-close" onClick = {this.closeBox}>关闭</div>
+						<Button type="primary" style={{marginTop:10}} onClick={this.selFile.bind(this)}>选择图片</Button>
+						<input type="file" className="selectFile" onChange={this.onChange} key = {this.state.src}/>
+						<div className="crop-close" onClick = {this.closeBox}>x</div>
 					</div>
 					<div className="crop-area">
 						<Cropper key = {this.state.src}
@@ -134,8 +148,10 @@ class CropBox extends Component {
 				            ref={cropper => { this.cropper = cropper; }}
 				        />
 					</div>
-					<button className = "crop-sure-btn" onClick={this.cropImage}>确认裁剪</button>
-					
+					<div className="btnGrounpCrop">
+						<Button type="primary" className = "crop-sure-btn" onClick={this.cropImage}>确认裁剪</Button>
+						<Button onClick = {this.closeBox}>取消</Button>
+					</div>
 				</div>
 			</div>
 		);

+ 25 - 0
js/component/dataDic.js

@@ -2320,6 +2320,31 @@ module.exports = {
         }, {
 	        value: "3",
 	        key: "商标顾问"
+        }, 
+        // {
+	    //     value: "4",
+	    //     key: "法律顾问"
+        // }
+    ],
+    lawType:[
+        {
+	        value: "0",
+	        key: "专职律师"
+	    },{
+	        value: "1",
+	        key: "兼职律师"
+	    }, {
+	        value: "2",
+	        key: "实习律师"
+        }, {
+	        value: "3",
+	        key: "律师助理"
+        }, {
+	        value: "4",
+	        key: "公职律师"
+        },{
+	        value: "4",
+	        key: "公司律师"
         }
     ],
     //认证状态

+ 15 - 1
js/component/tools.js

@@ -83,7 +83,8 @@ import {
     newType,
     adviserType,
     authState,
-    typeModule
+    typeModule,
+    lowType
 } from './dataDic.js';
 
 import { provinceList} from './NewDicProvinceList.js';
@@ -1526,5 +1527,18 @@ module.exports = {
             });
             return theType;
         }
+     },
+     //律师类型
+     getLowType:function(e){
+        if (e||e==0) {
+            let str=e.toString();
+            let theType = '';
+            lowType.map(function (item) {
+                if (item.value == str) {
+                    theType = item.key;
+                };
+            });
+            return theType;
+        }
      }
 }

+ 1 - 1
webpack-dll.config.js

@@ -10,7 +10,7 @@ let theme = {
   '@link-color': '#58a3ff'
 };
 module.exports = (function () {
-	let staticHost = 'http://192.168.0.190:8088';    
+	let staticHost = 'http://192.168.0.188:8088';   
     switch (argv.env.deploy) {
         case 'test':
             staticHost = 'http://statics.jishutao.com';