topTab.jsx 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. let theActive = this.props.active;
  15. $.ajax({
  16. method: "get",
  17. dataType: "json",
  18. url: globalConfig.context + "/login",
  19. }).done(function (data) {
  20. if ( theActive === undefined ) {
  21. window.location.href = "./login.html"
  22. } else {
  23. window.location.href = "../login.html"
  24. }
  25. });
  26. },
  27. render() {
  28. return (
  29. <div className="account-top" >
  30. <div className="acc-top-user">
  31. <span className="acc-top-user-name">欢迎您, {userData.nickname || userData.number || this.state.username} <a onClick={this.logOut}>[ 退出 ]</a></span>
  32. <span className="acc-top-user-toindex"><a href="./index.html">返回首页</a></span>
  33. </div>
  34. <div className="acc-index">
  35. <div className="acc-index-imgbox">
  36. <img src={logo} alt="" />
  37. </div>
  38. <span><a href="../index.html">管理中心首页</a></span>
  39. </div>
  40. <div className="acc-top-tab">
  41. <Row>
  42. <Col className={this.props.active === 'set' ? 'active' : ''} span={3}><a href="./userManage.html">用户管理</a></Col>
  43. <Col className={this.props.active === 'services' ? 'active' : ''} span={3}><a href="./servicesManage/patent.html">科技服务管理</a></Col>
  44. <Col className={this.props.active === 'achievement' ? 'active' : ''} span={3}><a href="">科技成果管理</a></Col>
  45. <Col className={this.props.active === 'demand' ? 'active' : ''} span={3}><a href="">科技需求管理</a></Col>
  46. <Col className={this.props.active === 'idea' ? 'active' : ''} span={3}><a href="">科技思想管理</a></Col>
  47. </Row>
  48. </div>
  49. </div >
  50. )
  51. }
  52. });
  53. export default TopTab;