import React from 'react';
import './portal.less';
import ajax from 'jquery/src/ajax/xhr.js';
import $ from 'jquery/src/ajax';

const LoginTop = React.createClass({
    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="portal-header">
                <div className="portal-top clearfix">
                    <div className="top-welcomeText">欢迎您来到科技认知计算交易平台!</div>
                    <div className="top-alink">
                        <a href={globalConfig.context + "/user/account/index.html"}>返回首页</a>
                        {window.userData.number ?
                            <span>
                                <a href={globalConfig.context + "/user/account/index"}>尊敬的{userData.nickname || userData.number}</a>
                                <a href="./index.html">交易管理中心</a>
                                <a href="./index.html">消息</a>
                            </span>
                            : <a href={globalConfig.context + "/user/login/index"}>请登录</a>}
                        <a onClick={this.logOut}>退出</a>
                        <a href="./index.html">帮助中心</a>
                    </div>
                </div>
            </div>
        )
    }
});

export default LoginTop;