topTab.jsx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. debugger
  20. window.location.href = "../login.html"
  21. });
  22. },
  23. render() {
  24. return (
  25. <div className="account-top" >
  26. <div className="acc-top-user">
  27. <span className="acc-top-user-name">欢迎您, { userData.nickname || userData.number || this.state.username} <a onClick={this.logOut}>[ 退出 ]</a></span>
  28. <span className="acc-top-user-toindex"><a href="../index.html">返回首页</a></span>
  29. </div>
  30. <div className="acc-index">
  31. <div className="acc-index-imgbox">
  32. <img src={logo} alt="" />
  33. </div>
  34. <span><a href="./index.html">会员中心首页</a></span>
  35. </div>
  36. <div className="acc-top-tab">
  37. <Row>
  38. <Col className={this.props.active === 'set' ? 'active' : ''} span={3}><a href="./set.html">账号设置</a></Col>
  39. <Col className={this.props.active === 'services' ? 'active' : ''} span={3}><a href="./services.html">科技服务</a></Col>
  40. <Col className={this.props.active === 'achievement' ? 'active' : ''} span={3}><a href="./set.html">科技成果</a></Col>
  41. <Col className={this.props.active === 'demand' ? 'active' : ''} span={3}><a href="./set.html">科技需求</a></Col>
  42. <Col className={this.props.active === 'idea' ? 'active' : ''} span={3}><a href="./set.html">科技思想</a></Col>
  43. </Row>
  44. </div>
  45. </div >
  46. )
  47. }
  48. });
  49. export default TopTab;