topTab.jsx 2.3 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. let theActive = this.props.active;
  15. $.ajax({
  16. method: "get",
  17. dataType: "json",
  18. url: globalConfig.context + "/login",
  19. }).done(function (data) {
  20. window.location.href = globalConfig.context + "/admin/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">欢迎您, {adminData.nickname || adminData.number || this.state.username} <a onClick={this.logOut}>[ 退出 ]</a></span>
  28. <span className="acc-top-user-toindex"><a href={globalConfig.context + "/admin/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={globalConfig.context + "/admin/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={globalConfig.context + "/admin/userManage.html"}>用户管理</a></Col>
  39. <Col className={this.props.active === 'services' ? 'active' : ''} span={3}><a href={globalConfig.context + "/admin/servicesManage/patent.html"}>科技服务管理</a></Col>
  40. <Col className={this.props.active === 'achievement' ? 'active' : ''} span={3}><a href="">科技成果管理</a></Col>
  41. <Col className={this.props.active === 'demand' ? 'active' : ''} span={3}><a href="">科技需求管理</a></Col>
  42. <Col className={this.props.active === 'idea' ? 'active' : ''} span={3}><a href="">科技思想管理</a></Col>
  43. </Row>
  44. </div>
  45. </div >
  46. )
  47. }
  48. });
  49. export default TopTab;