normal.jsx 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. import React from 'react';
  2. import { Spin, Button, Tabs, message, Modal } from 'antd';
  3. import $ from 'jquery/src/ajax';
  4. import { Link } from 'react-router';
  5. import '../content.less';
  6. import './content.less';
  7. import Collection from './collection';
  8. import defaultAvatar from '../../../../image/avatarImg.png'
  9. const Content = React.createClass({
  10. getInitialState () {
  11. return {
  12. loading: false,
  13. visible: false
  14. };
  15. },
  16. getData () {
  17. if(this.state.nickname){return;}
  18. this.setState({
  19. loading: false
  20. });
  21. $.ajax({
  22. method: "get",
  23. dataType: "json",
  24. url: globalConfig.context + "/api/user/homePage"
  25. }).done(function (data) {
  26. if (data.error && data.error.length) {
  27. message.warning(data.error[0].message);
  28. } else {
  29. this.setState({
  30. achievementNum: data.data.achievementNum,
  31. copyrightNum: data.data.copyrightNum,
  32. demandNum: data.data.demandNum,
  33. gradeName: data.data.gradeName,
  34. email: data.data.email,
  35. intellectualPropertyNum: data.data.intellectualPropertyNum,
  36. logoUrl: data.data.logoUrl,
  37. level: data.data.lvl,
  38. authentication:data.data.authentication, //0-专家 1--顾问
  39. nickname: data.data.nickname,
  40. number: data.data.number,
  41. auditStatus: data.data.auditStatus,
  42. patentNum: data.data.patentNum,
  43. personPortraitUrl: data.data.headPortraitUrl,
  44. techProjectNum: data.data.techProjectNum,
  45. type: data.data.type,
  46. uid: data.data.uid,
  47. expert:data.data.expert,
  48. visible: (data.data.type=='0'&&(data.data.auditStatus=='0'||data.data.auditStatus==null))? true : false
  49. })
  50. }
  51. }.bind(this)).always(function () {
  52. this.setState({
  53. loading: false
  54. });
  55. }.bind(this));
  56. },
  57. jump(){
  58. window.location.hash='/personal';
  59. },
  60. componentWillMount () {
  61. this.getData();
  62. },
  63. render () {
  64. return (
  65. <Spin spinning={this.state.loading} className='spin-box'>
  66. <div className="index-content">
  67. <div className="index-userdata clearfix">
  68. <p className="acc-title">
  69. 欢迎,
  70. <span>{this.state.nickname}</span>
  71. </p>
  72. <div className="userdata-img">
  73. {this.state.personPortraitUrl || this.state.logoUrl ?
  74. <img src={globalConfig.avatarHost + "/upload" + (this.state.type == 0 ? this.state.personPortraitUrl : this.state.logoUrl)} alt="" />
  75. : <img src={defaultAvatar} alt="" />}
  76. </div>
  77. <div className="userdata-content">
  78. {(() => {
  79. if (this.state.type == '0') {
  80. if(this.state.auditStatus=='2'){
  81. if(this.state.expert=='2'){
  82. return <p className="userdata-lvl">个人用户(<span style={{color:'#5cb85c'}}>已认证顾问</span>)</p>
  83. }else if(this.state.expert=='1'){
  84. return <p className="userdata-lvl">个人用户(<span style={{color:'#5cb85c'}}>已认证专家</span>)</p>
  85. }
  86. }else{
  87. if(this.state.auditStatus=='1'){
  88. return <p className="userdata-lvl">个人用户(<span style={{color:'#5cb85c'}}>认证审核中</span>)</p>
  89. }else if(this.state.auditStatus=='3'){
  90. return <p className="userdata-lvl">个人用户(<span style={{color:'#f00'}}>认证失败</span>)<Button type="primary" style={{margin:10}} onClick={this.jump}>重新认证</Button></p>
  91. }else{
  92. return <p className="userdata-lvl">个人用户(<span style={{color:'#f00'}}>未认证</span>)<Button type="primary" style={{margin:10}} onClick={this.jump}>去认证</Button></p>
  93. }
  94. }
  95. } else if(this.state.type == '1'){
  96. return <p className="userdata-lvl"><span>企业用户</span></p>
  97. }
  98. })()}
  99. <div>
  100. {
  101. (()=>{
  102. if(this.state.type=='0'){
  103. return <p><Link to="/personal">填写完整资料</Link>,有助于提高您的资信</p>
  104. }
  105. if(this.state.type=='1'){
  106. return <p><Link to="/unit">填写完整资料</Link>,有助于提高您的资信</p>
  107. }
  108. })()
  109. }
  110. </div>
  111. </div>
  112. </div>
  113. <div className="index-activity">
  114. <Collection nub={1}/>
  115. </div>
  116. </div>
  117. <Modal maskClosable={false}
  118. title="认证提示"
  119. visible={this.state.visible}
  120. onCancel={() => {
  121. this.setState({
  122. visible: false,
  123. });
  124. }}
  125. width='400px'
  126. footer={[]} >
  127. <p style={{ textAlign: 'center' }}>
  128. <span>您还未进行 ( 顾问 ) 认证,请完成认证,为您提供更多服务</span>
  129. </p>
  130. <div style={{ marginTop: '20px', textAlign: 'center' }}>
  131. {/* <Button type="primary" style={{marginRight:15}}><Link to="/personal">专家认证</Link></Button> */}
  132. <Button type="primary"><Link to="/personal">顾问认证</Link></Button>
  133. </div>
  134. </Modal>
  135. </Spin>
  136. )
  137. }
  138. });
  139. export default Content;