authDetaiel.jsx 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  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
  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. //审核拒绝
  107. refuse(){
  108. this.setState({
  109. refuseValue:'',
  110. refuseVisible:true
  111. })
  112. },
  113. refuseOk(){
  114. if(!this.state.refuseValue){
  115. message.warning('请填写拒绝原因。')
  116. return;
  117. }
  118. this.setState({
  119. refuseVisible:false
  120. })
  121. this.updateFun(3)
  122. },
  123. refuseCancel(){
  124. this.setState({
  125. refuseValue:'',
  126. refuseVisible:false
  127. })
  128. },
  129. componentWillMount() {
  130. if (this.props.data.id) {
  131. this.loadData(this.props.data.uid);
  132. } else {
  133. this.state.data = {};
  134. };
  135. },
  136. componentWillReceiveProps(nextProps) {
  137. if (!this.props.visible && nextProps.visible) {
  138. if (nextProps.data.id) {
  139. this.loadData(nextProps.data.uid);
  140. } else {
  141. this.state.data = {};
  142. };
  143. this.props.form.resetFields();
  144. };
  145. },
  146. render() {
  147. const theData = this.state.data || {};
  148. const FormItem = Form.Item
  149. const formItemLayout = {
  150. labelCol: { span: 6 },
  151. wrapperCol: { span: 12 },
  152. };
  153. return (
  154. <div className='login'>
  155. <Form layout="horizontal" id="demand-form">
  156. <Spin spinning={this.state.loading}>
  157. <div className="clearfix">
  158. <FormItem className="half-item" {...formItemLayout} label="姓名">
  159. <span>{theData.identifyName}</span>
  160. </FormItem>
  161. <FormItem className="half-item" {...formItemLayout} label="行业">
  162. <span>{getIndustry(theData.industry)}</span>
  163. </FormItem>
  164. <FormItem className="half-item" {...formItemLayout} label="社会属性">
  165. <span>{getSocialAttribute(theData.societyTag)}</span>
  166. </FormItem>
  167. <FormItem className="half-item" {...formItemLayout} label="性别">
  168. <span>{theData.sex}</span>
  169. </FormItem>
  170. <FormItem className="half-item" {...formItemLayout} label="出生日期">
  171. <span>{theData.dateOfBirthYear?theData.dateOfBirthYear + '/' + theData.dateOfBirthMonth:''}</span>
  172. </FormItem>
  173. <FormItem className="half-item" {...formItemLayout} label="身份证号码">
  174. <span>{theData.idNumber}</span>
  175. </FormItem>
  176. <FormItem className="half-item" {...formItemLayout} label="省-市-区">
  177. <span>{this.state.ProvinceCity}</span>
  178. </FormItem>
  179. <FormItem className="half-item" {...formItemLayout} label="通信地址">
  180. <span>{theData.postalAddress}</span>
  181. </FormItem>
  182. <FormItem className="half-item" {...formItemLayout} label="手机号码">
  183. <span>{theData.contactMobile}</span>
  184. </FormItem>
  185. <FormItem className="half-item" {...formItemLayout} label="固定电话">
  186. <span>{theData.fixedTel}</span>
  187. </FormItem>
  188. <FormItem className="half-item" {...formItemLayout} label="QQ">
  189. <span>{theData.qq}</span>
  190. </FormItem>
  191. <FormItem className="half-item" {...formItemLayout} label="电子邮箱">
  192. <span>{theData.email}</span>
  193. </FormItem>
  194. </div>
  195. <div className="clearfix">
  196. <FormItem
  197. labelCol={{ span: 3 }}
  198. wrapperCol={{ span: 18 }}
  199. label="个人简介">
  200. <span>{theData.introduction}</span>
  201. </FormItem>
  202. </div>
  203. <p style={{fontSize:16}}>{theData.expert=='1'?'专家认证':'顾问认证'}</p>
  204. {theData.expert=='1'?<div>
  205. <FormItem className="half-item" {...formItemLayout} label="毕业院校">
  206. <span>{theData.graduateSchool}</span>
  207. </FormItem>
  208. <FormItem className="half-item" {...formItemLayout} label="专业类别">
  209. <span>{theData.majorCategory}</span>
  210. </FormItem>
  211. <FormItem className="half-item" {...formItemLayout} label="职业资格">
  212. <span>{theData.qualification}</span>
  213. </FormItem>
  214. <FormItem className="half-item" {...formItemLayout} label="就职单位">
  215. <span>{theData.workUnit}</span>
  216. </FormItem>
  217. <FormItem className="half-item" {...formItemLayout} label="职称">
  218. <span>{theData.professionalTitle}</span>
  219. </FormItem>
  220. <div className="clearfix">
  221. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 13 }} label="专家照片">
  222. <Upload className="demandDetailShow-upload"
  223. listType="picture-card"
  224. fileList={this.state.headPortraitUrl}
  225. onPreview={(file) => {
  226. this.setState({
  227. previewImage: file.url || file.thumbUrl,
  228. previewVisible: true,
  229. });
  230. }} >
  231. </Upload>
  232. <Modal maskClosable={false} footer={null}
  233. visible={this.state.previewVisible}
  234. onCancel={() => { this.setState({ previewVisible: false }) }}>
  235. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  236. </Modal>
  237. </FormItem>
  238. </div>
  239. </div>:<div>
  240. <FormItem className="half-item" {...formItemLayout} label="顾问类型">
  241. <span>{getAdviserType(theData.consultantType)}</span>
  242. </FormItem>
  243. {
  244. theData.consultantType=='4'?<div className="clearfix">
  245. <div className="clearfix">
  246. <FormItem className="half-item" {...formItemLayout} label="律师事务所">
  247. <span>{theData.workUnit1}</span>
  248. </FormItem>
  249. </div>
  250. <div className="clearfix">
  251. <FormItem className="half-item" {...formItemLayout} label="职称">
  252. <span>{theData.honer}</span>
  253. </FormItem>
  254. </div>
  255. <div className="clearfix">
  256. <FormItem
  257. labelCol={{ span: 3 }}
  258. wrapperCol={{ span: 10 }}
  259. label="擅长行业"
  260. >
  261. <span>{theData.goodAtIndustry}</span>
  262. </FormItem>
  263. </div>
  264. <div className="clearfix">
  265. <FormItem
  266. labelCol={{ span: 3 }}
  267. wrapperCol={{ span: 10 }}
  268. label="典型案例"
  269. >
  270. <span>{theData.typicalCase}</span>
  271. </FormItem>
  272. </div></div>:''
  273. }
  274. <div className="clearfix">
  275. <FormItem className="half-item" labelCol={{ span: 6 }} wrapperCol={{ span: 10 }} label="顾问照片">
  276. <Upload className="demandDetailShow-upload"
  277. listType="picture-card"
  278. fileList={this.state.headPortraitUrl}
  279. onPreview={(file) => {
  280. this.setState({
  281. previewImage: file.url || file.thumbUrl,
  282. previewVisible: true,
  283. });
  284. }} >
  285. </Upload>
  286. <Modal maskClosable={false} footer={null}
  287. visible={this.state.previewVisible}
  288. onCancel={() => { this.setState({ previewVisible: false }) }}>
  289. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  290. </Modal>
  291. </FormItem>
  292. {theData.consultantType=='4'&&<FormItem className="half-item" labelCol={{ span: 6 }} wrapperCol={{ span: 10 }} label="律师职业资格证">
  293. <Upload className="demandDetailShow-upload"
  294. listType="picture-card"
  295. fileList={this.state.lawUrl}
  296. onPreview={(file) => {
  297. this.setState({
  298. previewImage: file.url || file.thumbUrl,
  299. previewVisible: true,
  300. });
  301. }} >
  302. </Upload>
  303. <Modal maskClosable={false} footer={null}
  304. visible={this.state.previewVisible}
  305. onCancel={() => { this.setState({ previewVisible: false }) }}>
  306. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  307. </Modal>
  308. </FormItem>}
  309. </div>
  310. </div>}
  311. <div>
  312. <FormItem className="half-item" labelCol={{ span: 6 }} wrapperCol={{ span: 10 }} label="身份证正面">
  313. <div className="clearfix">
  314. <Upload className="demandDetailShow-upload"
  315. listType="picture-card"
  316. fileList={this.state.positiveIdUrl}
  317. onPreview={(file) => {
  318. this.setState({
  319. previewImage: file.url || file.thumbUrl,
  320. previewVisible: true,
  321. });
  322. }} >
  323. </Upload>
  324. <Modal maskClosable={false} footer={null}
  325. visible={this.state.previewVisible}
  326. onCancel={() => { this.setState({ previewVisible: false }) }}>
  327. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  328. </Modal>
  329. </div>
  330. </FormItem>
  331. <FormItem className="half-item" labelCol={{ span:6 }} wrapperCol={{ span: 10 }} label="身份证反面">
  332. <div className="clearfix">
  333. <Upload className="demandDetailShow-upload"
  334. listType="picture-card"
  335. fileList={this.state.oppositeIdUrl}
  336. onPreview={(file) => {
  337. this.setState({
  338. previewImage: file.url || file.thumbUrl,
  339. previewVisible: true,
  340. });
  341. }} >
  342. </Upload>
  343. <Modal maskClosable={false} footer={null}
  344. visible={this.state.previewVisible}
  345. onCancel={() => { this.setState({ previewVisible: false }) }}>
  346. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  347. </Modal>
  348. </div>
  349. </FormItem>
  350. </div>
  351. <div className="clearfix">
  352. {this.props.examineState&&<FormItem wrapperCol={{ span: 12, offset: 3 }}>
  353. <Button className="set-submit" type="primary" onClick={(e)=>{this.updateFun(2)}} >
  354. 审核通过
  355. </Button>
  356. <Button type="danger" style={{marginRight:20}} onClick={(e)=>{this.refuse()}}>
  357. 审核拒绝
  358. </Button>
  359. <Button className="set-submit" type="ghost" onClick={this.cancelFun}>
  360. 取消
  361. </Button>
  362. </FormItem>}
  363. </div>
  364. </Spin>
  365. </Form>
  366. <Modal
  367. title="审核拒绝"
  368. visible={this.state.refuseVisible}
  369. onOk={this.refuseOk}
  370. onCancel={this.refuseCancel}
  371. >
  372. <div>
  373. <FormItem labelCol={{ span: 4 }} wrapperCol={{ span: 18 }} label="拒绝原因">
  374. <Input type="textarea" rows={4} value={this.state.refuseValue} placeholder="输入拒绝原因" onChange={(e)=>{this.setState({refuseValue:e.target.value})}}/>
  375. </FormItem>
  376. </div>
  377. </Modal>
  378. </div>
  379. )
  380. }
  381. }));
  382. export default AuthDetail;