authDetaiel.jsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. import React from 'react';
  2. import $ from 'jquery/src/ajax';
  3. import {
  4. Modal,
  5. message,
  6. Spin,
  7. Upload,
  8. Input,
  9. Button,
  10. Form, Icon
  11. } from 'antd';
  12. import { getAdviserType,getIndustry,getSocialAttribute,splitUrl } from '@/tools.js';
  13. import { getProvince } from '@/NewDicProvinceList';
  14. const AuthDetail = Form.create()(React.createClass({
  15. getInitialState() {
  16. return {
  17. visible: false,
  18. loading: false,
  19. pictureUrl: [],
  20. headPortraitUrl: [],
  21. adviserUrl:[],
  22. positiveIdUrl: [],
  23. oppositeIdUrl: [],
  24. lawUrl:[],
  25. };
  26. },
  27. loadData(id) {
  28. this.setState({
  29. loading: true
  30. });
  31. $.ajax({
  32. method: "get",
  33. dataType: "json",
  34. crossDomain: false,
  35. url: globalConfig.context + '/api/admin/getUserIdentityByUid' ,
  36. data: {
  37. uid: id
  38. },
  39. success: function (data) {
  40. let thisData = data.data;
  41. if (!thisData) {
  42. if (data.error && data.error.length) {
  43. message.warning(data.error[0].message);
  44. };
  45. thisData = {};
  46. };
  47. let provice;
  48. provice=getProvince(thisData.province,thisData.city,thisData.area);
  49. this.setState({
  50. id:thisData.id,
  51. data: thisData,
  52. ProvinceCity:provice,
  53. headPortraitUrl: thisData.headPortraitUrl //专家照片
  54. ? splitUrl(thisData.headPortraitUrl, ',', globalConfig.avatarHost + '/upload')
  55. : [],
  56. adviserUrl: thisData.adviserUrl //顾问照片
  57. ? splitUrl(thisData.adviserUrl, ',', globalConfig.avatarHost + '/upload')
  58. : [],
  59. positiveIdUrl: thisData.positiveIdUrl
  60. ? splitUrl(thisData.positiveIdUrl, ',', globalConfig.avatarHost + '/upload')
  61. : [],
  62. oppositeIdUrl: thisData.oppositeIdUrl
  63. ? splitUrl(thisData.oppositeIdUrl, ',', globalConfig.avatarHost + '/upload')
  64. : [],
  65. lawUrl:thisData.consultantCertificateUrl
  66. ? splitUrl(thisData.consultantCertificateUrl, ',', globalConfig.avatarHost + '/upload')
  67. : [],
  68. });
  69. }.bind(this),
  70. }).always(function () {
  71. this.setState({
  72. loading: false
  73. });
  74. }.bind(this));
  75. },
  76. cancelFun(){
  77. this.props.closeDesc();
  78. },
  79. //审核通过/拒绝
  80. updateFun(index){
  81. this.setState({
  82. loading:true
  83. });
  84. $.ajax({
  85. method: "post",
  86. dataType: "JSON",
  87. crossDomain: false,
  88. url: globalConfig.context + '/api/admin/auditing',
  89. data: {
  90. id: this.state.id,
  91. auditStatus:index,
  92. auditInfo:this.state.refuseValue
  93. }
  94. }).done(function (data) {
  95. if (!data.error.length) {
  96. message.success('操作成功!');
  97. this.setState({
  98. loading: false,
  99. });
  100. this.props.handOk()
  101. } else {
  102. message.warning(data.error[0].message);
  103. };
  104. }.bind(this));
  105. },
  106. beforeUpload(file) {
  107. const isJPG = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg';
  108. if (!isJPG) {
  109. message.error('只能上传图片文件!');
  110. return isJPG;
  111. }
  112. const isLt2M = file.size / 1024 / 1024 < 10;
  113. if (!isLt2M) {
  114. message.error('图片大小不能超过 10MB!');
  115. return isLt2M;
  116. }
  117. return isJPG && isLt2M;
  118. },
  119. //上传图片
  120. updateConsultantFun(){
  121. this.setState({
  122. loading:true
  123. });
  124. $.ajax({
  125. method: "get",
  126. dataType: "JSON",
  127. crossDomain: false,
  128. url: globalConfig.context + '/api/admin/updatePictureUrl',
  129. data: {
  130. url:this.state.consultantFileData,
  131. uid:this.props.data.uid,
  132. }
  133. }).done(function (data) {
  134. if (!data.error.length) {
  135. message.success('操作成功!');
  136. this.setState({
  137. loading: false,
  138. consultantFileData: '',
  139. });
  140. // this.props.handOk()
  141. } else {
  142. message.warning(data.error[0].message);
  143. };
  144. }.bind(this));
  145. },
  146. //审核拒绝
  147. refuse(){
  148. this.setState({
  149. refuseValue:'',
  150. refuseVisible:true
  151. })
  152. },
  153. refuseOk(){
  154. if(!this.state.refuseValue){
  155. message.warning('请填写拒绝原因。')
  156. return;
  157. }
  158. this.setState({
  159. refuseVisible:false
  160. })
  161. this.updateFun(3)
  162. },
  163. refuseCancel(){
  164. this.setState({
  165. refuseValue:'',
  166. refuseVisible:false
  167. })
  168. },
  169. componentWillMount() {
  170. if (this.props.data.id) {
  171. this.loadData(this.props.data.uid);
  172. } else {
  173. this.state.data = {};
  174. };
  175. },
  176. componentWillReceiveProps(nextProps) {
  177. if (!this.props.visible && nextProps.visible) {
  178. if (nextProps.data.id) {
  179. this.loadData(nextProps.data.uid);
  180. } else {
  181. this.state.data = {};
  182. };
  183. this.props.form.resetFields();
  184. };
  185. },
  186. render() {
  187. const theData = this.state.data || {};
  188. const FormItem = Form.Item
  189. const formItemLayout = {
  190. labelCol: { span: 6 },
  191. wrapperCol: { span: 12 },
  192. };
  193. const uploadButton = (
  194. <div>
  195. <Icon type="plus" />
  196. <div className="ant-upload-text">点击上传</div>
  197. </div>
  198. );
  199. return (
  200. <div className='login'>
  201. <Form layout="horizontal" id="demand-form">
  202. <Spin spinning={this.state.loading}>
  203. <div className="clearfix">
  204. <FormItem className="half-item" {...formItemLayout} label="姓名">
  205. <span>{theData.identifyName}</span>
  206. </FormItem>
  207. <FormItem className="half-item" {...formItemLayout} label="行业">
  208. <span>{getIndustry(theData.industry)}</span>
  209. </FormItem>
  210. <FormItem className="half-item" {...formItemLayout} label="社会属性">
  211. <span>{getSocialAttribute(theData.societyTag)}</span>
  212. </FormItem>
  213. <FormItem className="half-item" {...formItemLayout} label="性别">
  214. <span>{theData.sex}</span>
  215. </FormItem>
  216. <FormItem className="half-item" {...formItemLayout} label="出生日期">
  217. <span>{theData.dateOfBirthYear?theData.dateOfBirthYear + '/' + theData.dateOfBirthMonth:''}</span>
  218. </FormItem>
  219. <FormItem className="half-item" {...formItemLayout} label="身份证号码">
  220. <span>{theData.idNumber}</span>
  221. </FormItem>
  222. <FormItem className="half-item" {...formItemLayout} label="省-市-区">
  223. <span>{this.state.ProvinceCity}</span>
  224. </FormItem>
  225. <FormItem className="half-item" {...formItemLayout} label="通信地址">
  226. <span>{theData.postalAddress}</span>
  227. </FormItem>
  228. <FormItem className="half-item" {...formItemLayout} label="手机号码">
  229. <span>{theData.contactMobile}</span>
  230. </FormItem>
  231. <FormItem className="half-item" {...formItemLayout} label="固定电话">
  232. <span>{theData.fixedTel}</span>
  233. </FormItem>
  234. <FormItem className="half-item" {...formItemLayout} label="QQ">
  235. <span>{theData.qq}</span>
  236. </FormItem>
  237. <FormItem className="half-item" {...formItemLayout} label="电子邮箱">
  238. <span>{theData.email}</span>
  239. </FormItem>
  240. </div>
  241. <div className="clearfix">
  242. <FormItem
  243. labelCol={{ span: 3 }}
  244. wrapperCol={{ span: 18 }}
  245. label="个人简介">
  246. <span>{theData.introduction}</span>
  247. </FormItem>
  248. </div>
  249. <p style={{fontSize:16}}>{theData.expert=='1'?'专家认证':'顾问认证'}</p>
  250. {theData.expert=='1'?<div>
  251. <FormItem className="half-item" {...formItemLayout} label="毕业院校">
  252. <span>{theData.graduateSchool}</span>
  253. </FormItem>
  254. <FormItem className="half-item" {...formItemLayout} label="专业类别">
  255. <span>{theData.majorCategory}</span>
  256. </FormItem>
  257. <FormItem className="half-item" {...formItemLayout} label="职业资格">
  258. <span>{theData.qualification}</span>
  259. </FormItem>
  260. <FormItem className="half-item" {...formItemLayout} label="就职单位">
  261. <span>{theData.workUnit}</span>
  262. </FormItem>
  263. <FormItem className="half-item" {...formItemLayout} label="职称">
  264. <span>{theData.professionalTitle}</span>
  265. </FormItem>
  266. <div className="clearfix">
  267. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 13 }} label="专家照片">
  268. <Upload className="demandDetailShow-upload"
  269. listType="picture-card"
  270. fileList={this.state.headPortraitUrl}
  271. onPreview={(file) => {
  272. this.setState({
  273. previewImage: file.url || file.thumbUrl,
  274. previewVisible: true,
  275. });
  276. }} >
  277. </Upload>
  278. <Modal maskClosable={false} footer={null}
  279. visible={this.state.previewVisible}
  280. onCancel={() => { this.setState({ previewVisible: false }) }}>
  281. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  282. </Modal>
  283. </FormItem>
  284. </div>
  285. </div>:<div>
  286. <FormItem className="half-item" {...formItemLayout} label="顾问类型">
  287. <span>{getAdviserType(theData.consultantType)}</span>
  288. </FormItem>
  289. {
  290. theData.consultantType=='4'?<div className="clearfix">
  291. <div className="clearfix">
  292. <FormItem className="half-item" {...formItemLayout} label="律师事务所">
  293. <span>{theData.workUnit1}</span>
  294. </FormItem>
  295. </div>
  296. <div className="clearfix">
  297. <FormItem className="half-item" {...formItemLayout} label="职称">
  298. <span>{theData.honer}</span>
  299. </FormItem>
  300. </div>
  301. <div className="clearfix">
  302. <FormItem
  303. labelCol={{ span: 3 }}
  304. wrapperCol={{ span: 10 }}
  305. label="擅长行业"
  306. >
  307. <span>{theData.goodAtIndustry}</span>
  308. </FormItem>
  309. </div>
  310. <div className="clearfix">
  311. <FormItem
  312. labelCol={{ span: 3 }}
  313. wrapperCol={{ span: 10 }}
  314. label="典型案例"
  315. >
  316. <span>{theData.typicalCase}</span>
  317. </FormItem>
  318. </div></div>:''
  319. }
  320. <div className="clearfix">
  321. <FormItem className="half-item" labelCol={{ span: 6 }} wrapperCol={{ span: 10 }} label="顾问照片">
  322. {/*<Upload className="demandDetailShow-upload"*/}
  323. {/* listType="picture-card"*/}
  324. {/* fileList={this.state.headPortraitUrl} */}
  325. {/* onPreview={(file) => {*/}
  326. {/* this.setState({*/}
  327. {/* previewImage: file.url || file.thumbUrl,*/}
  328. {/* previewVisible: true,*/}
  329. {/* });*/}
  330. {/* }} >*/}
  331. {/*</Upload>*/}
  332. <Upload
  333. action={globalConfig.context + '/api/admin/uploadPicture'}
  334. data={{ sign: 'user_picture',uid:this.props.data.uid}}
  335. listType="picture-card"
  336. fileList={this.state.headPortraitUrl}
  337. beforeUpload={this.beforeUpload}
  338. onPreview={(file) => {
  339. this.setState({
  340. previewImage: file.url || file.thumbUrl,
  341. previewVisible: true,
  342. });
  343. }}
  344. onChange={(info)=>{
  345. if(info.file.status) {
  346. let fileList = info.fileList;
  347. this.setState({
  348. headPortraitUrl: fileList,
  349. });
  350. if (info.file.status === 'done') {
  351. this.setState({
  352. consultantFileData: info.file.response.data,
  353. });
  354. }
  355. }
  356. }}>
  357. {this.state.headPortraitUrl.length === 0 ? uploadButton : null}
  358. </Upload>
  359. <Button
  360. style={{
  361. marginLeft:'30px'
  362. }}
  363. type="primary"
  364. onClick={(e)=>{this.updateConsultantFun()}}
  365. disabled={!this.state.consultantFileData || this.state.headPortraitUrl.length === 0}
  366. >
  367. 保存
  368. </Button>
  369. <Modal maskClosable={false} footer={null}
  370. visible={this.state.previewVisible}
  371. onCancel={() => { this.setState({ previewVisible: false }) }}>
  372. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  373. </Modal>
  374. </FormItem>
  375. {theData.consultantType=='4'&&<FormItem className="half-item" labelCol={{ span: 6 }} wrapperCol={{ span: 10 }} label="律师职业资格证">
  376. <Upload className="demandDetailShow-upload"
  377. listType="picture-card"
  378. fileList={this.state.lawUrl}
  379. onPreview={(file) => {
  380. this.setState({
  381. previewImage: file.url || file.thumbUrl,
  382. previewVisible: true,
  383. });
  384. }} >
  385. </Upload>
  386. <Modal maskClosable={false} footer={null}
  387. visible={this.state.previewVisible}
  388. onCancel={() => { this.setState({ previewVisible: false }) }}>
  389. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  390. </Modal>
  391. </FormItem>}
  392. </div>
  393. </div>}
  394. <div>
  395. <FormItem className="half-item" labelCol={{ span: 6 }} wrapperCol={{ span: 10 }} label="身份证正面">
  396. <div className="clearfix">
  397. <Upload className="demandDetailShow-upload"
  398. listType="picture-card"
  399. fileList={this.state.positiveIdUrl}
  400. onPreview={(file) => {
  401. this.setState({
  402. previewImage: file.url || file.thumbUrl,
  403. previewVisible: true,
  404. });
  405. }} >
  406. </Upload>
  407. <Modal maskClosable={false} footer={null}
  408. visible={this.state.previewVisible}
  409. onCancel={() => { this.setState({ previewVisible: false }) }}>
  410. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  411. </Modal>
  412. </div>
  413. </FormItem>
  414. <FormItem className="half-item" labelCol={{ span:6 }} wrapperCol={{ span: 10 }} label="身份证反面">
  415. <div className="clearfix">
  416. <Upload className="demandDetailShow-upload"
  417. listType="picture-card"
  418. fileList={this.state.oppositeIdUrl}
  419. onPreview={(file) => {
  420. this.setState({
  421. previewImage: file.url || file.thumbUrl,
  422. previewVisible: true,
  423. });
  424. }} >
  425. </Upload>
  426. <Modal maskClosable={false} footer={null}
  427. visible={this.state.previewVisible}
  428. onCancel={() => { this.setState({ previewVisible: false }) }}>
  429. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  430. </Modal>
  431. </div>
  432. </FormItem>
  433. </div>
  434. <div className="clearfix">
  435. {this.props.examineState&&<FormItem wrapperCol={{ span: 12, offset: 3 }}>
  436. <Button className="set-submit" type="primary" onClick={(e)=>{this.updateFun(2)}} >
  437. 审核通过
  438. </Button>
  439. <Button type="danger" style={{marginRight:20}} onClick={(e)=>{this.refuse()}}>
  440. 审核拒绝
  441. </Button>
  442. <Button className="set-submit" type="ghost" onClick={this.cancelFun}>
  443. 取消
  444. </Button>
  445. </FormItem>}
  446. </div>
  447. </Spin>
  448. </Form>
  449. <Modal
  450. title="审核拒绝"
  451. visible={this.state.refuseVisible}
  452. onOk={this.refuseOk}
  453. onCancel={this.refuseCancel}
  454. >
  455. <div>
  456. <FormItem labelCol={{ span: 4 }} wrapperCol={{ span: 18 }} label="拒绝原因">
  457. <Input type="textarea" rows={4} value={this.state.refuseValue} placeholder="输入拒绝原因" onChange={(e)=>{this.setState({refuseValue:e.target.value})}}/>
  458. </FormItem>
  459. </div>
  460. </Modal>
  461. </div>
  462. )
  463. }
  464. }));
  465. export default AuthDetail;