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: "get",
            dataType: "json",
            url: globalConfig.context + "/login",
        }).done(function (data) {
            window.location.href = globalConfig.context + "/user/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 + "/portal/index.html"}>返回首页</a></span>
                </div>
                <div className="acc-index">
                    <div className="acc-index-imgbox">
                        <img src={logo} alt="" />
                    </div>
                    <span><a href={globalConfig.context + "/user/account/index.html"}>会员中心首页</a></span>
                </div>
                <div className="acc-top-tab">
                    <Row>
                        <Col className={this.props.active === 'set' ? 'active' : ''} span={3}><a href={globalConfig.context + "/user/account/set.html"}>账号设置</a></Col>
                        <Col className={this.props.active === 'services' ? 'active' : ''} span={3}><a href={globalConfig.context + "/user/account/services.html"}>科技服务</a></Col>
                        <Col className={this.props.active === 'achievement' ? 'active' : ''} span={3}><a href={globalConfig.context + "/user/account/achievement.html"}>科技成果</a></Col>
                        <Col className={this.props.active === 'demand' ? 'active' : ''} span={3}><a href={globalConfig.context + "/user/account/demand.html"}>科技需求</a></Col>
                        <Col className={this.props.active === 'idea' ? 'active' : ''} span={3}><a href={globalConfig.context + "/user/account/idea.html"}>科技思想</a></Col>
                    </Row>
                </div>
            </div >
        )
    }
});

export default TopTab;