topTab.jsx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import React from 'react';
  2. import { Row, Col } from 'antd';
  3. import './topTab.less';
  4. import ajax from 'jquery/src/ajax/xhr.js'
  5. import $ from 'jquery/src/ajax';
  6. import logo from '../../../image/acc-logo.png';
  7. const TopTab = React.createClass({
  8. getInitialState() {
  9. return {
  10. username: 'username',
  11. };
  12. },
  13. logOut() {
  14. $.ajax({
  15. method: "get",
  16. dataType: "json",
  17. url: globalConfig.context + "/login",
  18. }).done(function (data) {
  19. window.location.href = globalConfig.context + "/user/login.html"
  20. });
  21. },
  22. render() {
  23. return (
  24. <div className="account-top" >
  25. <div className="acc-top-user">
  26. <span className="acc-top-user-name">欢迎您, {userData.nickname || userData.number || this.state.username} <a onClick={this.logOut}>[ 退出 ]</a></span>
  27. <span className="acc-top-user-toindex"><a href={userData.type == 1 ? globalConfig.context + "/user/groupCertify.html" : globalConfig.context + "/user/certify.html" }>实名认证</a>&nbsp;&nbsp;&nbsp;<a href={globalConfig.context + "/user/index.html"}>返回首页</a></span>
  28. </div>
  29. <div className="acc-index">
  30. <div className="acc-index-imgbox">
  31. <img src={logo} alt="" />
  32. </div>
  33. <span><a href={globalConfig.context + "/user/account/index.html"}>会员中心首页</a></span>
  34. </div>
  35. <div className="acc-top-tab">
  36. <Row>
  37. <Col className={this.props.active === 'set' ? 'active' : ''} span={3}><a href={globalConfig.context + "/user/account/set.html"}>账号设置</a></Col>
  38. <Col className={this.props.active === 'services' ? 'active' : ''} span={3}><a href={globalConfig.context + "/user/account/services.html"}>科技服务</a></Col>
  39. <Col className={this.props.active === 'achievement' ? 'active' : ''} span={3}><a href="./set.html">科技成果</a></Col>
  40. <Col className={this.props.active === 'demand' ? 'active' : ''} span={3}><a href="./set.html">科技需求</a></Col>
  41. <Col className={this.props.active === 'idea' ? 'active' : ''} span={3}><a href="./set.html">科技思想</a></Col>
  42. </Row>
  43. </div>
  44. </div >
  45. )
  46. }
  47. });
  48. export default TopTab;