import React from 'react';
import { Row, Col } from 'antd';
import './topTab.less';
import ajax from 'jquery/src/ajax/xhr.js'
import $ from 'jquery/src/ajax';


import logo from '../../../image/acc-logo.png';

const TopTab = React.createClass({
    getInitialState() {
        return {
            username: 'username',
        };
    },
    logOut() {
        let theActive = this.props.active;
        $.ajax({
            method: "get",
            dataType: "json",
            url: globalConfig.context + "/login",
        }).done(function (data) {
            window.location.href = globalConfig.context + "/admin/login.html"
        });
    },
    render() {
        return (
            <div className="account-top" >
                <div className="acc-top-user">
                    <span className="acc-top-user-name">欢迎您, {userData.nickname || userData.number || this.state.username} <a onClick={this.logOut}>[ 退出 ]</a></span>
                    <span className="acc-top-user-toindex"><a href={globalConfig.context + "/admin/index.html"}>返回首页</a></span>
                </div>
                <div className="acc-index">
                    <div className="acc-index-imgbox">
                        <img src={logo} alt="" />
                    </div>
                    <span><a href={globalConfig.context + "/admin/index.html"}>管理中心首页</a></span>
                </div>
                <div className="acc-top-tab">
                    <Row>
                        <Col className={this.props.active === 'set' ? 'active' : ''} span={3}><a href={globalConfig.context + "/admin/userManage.html"}>用户管理</a></Col>
                        <Col className={this.props.active === 'services' ? 'active' : ''} span={3}><a href={globalConfig.context + "/admin/servicesManage/patent.html"}>科技服务管理</a></Col>
                        <Col className={this.props.active === 'achievement' ? 'active' : ''} span={3}><a href="">科技成果管理</a></Col>
                        <Col className={this.props.active === 'demand' ? 'active' : ''} span={3}><a href="">科技需求管理</a></Col>
                        <Col className={this.props.active === 'idea' ? 'active' : ''} span={3}><a href="">科技思想管理</a></Col>
                    </Row>
                </div>
            </div >
        )
    }
});

export default TopTab;