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() {
        $.ajax({
            method: "POST",
            dataType: "json",
            url: globalConfig.context + "/login",
        }).done(function (data) {
                window.location.href = "../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="../index.html">返回首页</a></span>
                </div>
                <div className="acc-index">
                    <div className="acc-index-imgbox">
                        <img src={logo} alt="" />
                    </div>
                    <span><a href="./index.html">会员中心首页</a></span>
                </div>
                <div className="acc-top-tab">
                    <Row>
                        <Col className={this.props.active === 'set' ? 'active' : ''} span={2}><a href="./set.html">账号设置</a></Col>
                        <Col className={this.props.active === 'guanli' ? 'active' : ''} span={2}><a href="./set.html">供需管理</a></Col>
                        <Col className={this.props.active === 'jiaoliu' ? 'active' : ''} span={2}><a href="./set.html">交流互动</a></Col>
                        <Col className={this.props.active === 'huodong' ? 'active' : ''} span={2}><a href="./set.html">活动管理</a></Col>
                        <Col className={this.props.active === 'jishu' ? 'active' : ''} span={2}><a href="./set.html">技术评估</a></Col>
                        <Col className={this.props.active === 'pingshen' ? 'active' : ''} span={2}><a href="./set.html">评审管理</a></Col>
                        <Col className={this.props.active === 'yanfa' ? 'active' : ''} span={2}><a href="./set.html">研发平台</a></Col>
                    </Row>
                </div>
            </div >
        )
    }
});

export default TopTab;