import React from 'react';
import './detail.less';
import logo from '../../../image/logo.png';
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-logo clearfix">
                    <div className="portal-text">
                        <span className="text">用户详情</span>
                        <span className="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>
                        </span>
                    </div>
                </div>
            </div>
        )
    }
});

export default LoginTop;