import React from 'react';
import './portal.less';
// import ajax from 'jquery/src/ajax/xhr.js';
// import $ from 'jquery/src/ajax';
import $ from 'jquery';
import logoImg from '../../../image/logo-2.png';

function navHover() {
    $('.header_nav_detail .nav_content>li').hover(function () {
        $(this).siblings('.active').addClass('hideSub');
    }, function () {
        $(this).siblings('.active').removeClass('hideSub');
    })
}

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"
        });
    },
    componentDidMount() {
        navHover();
    },
    render() {
        return (
            <div className="portal-header">
                <div className="portal-top">
                    <div className="clearfix">
                        <div className="top-welcomeText">欢迎您来到科技认知计算交易平台-公测版</div>
                        <div className="top-alink">
                            <a href={globalConfig.context + "/portal/index.html"}>返回首页</a>
                            {window.userData.number ?
                                <span>
                                    <a href={globalConfig.context + "/user/account/index"}>尊敬的{userData.nickname || userData.number}</a>
                                    <a onClick={this.logOut}>退出</a>
                                </span>
                                : <span>
                                    <a href={globalConfig.context + "/user/login.html"}>登录</a>
                                    <a href={globalConfig.context + "/user/signIn.html"}>注册</a>
                                </span>}
                            <a href="./index.html">帮助中心</a>
                        </div>
                    </div>
                </div>
                <div className="header_nav_detail">
                    <div className="container clearfix">
                        <div className="col-md-3 logo">
                            <a href={globalConfig.context + '/portal/index.html'}>
                                <img src={logoImg} alt="" />
                            </a>
                        </div>
                        <div className="col-md-9">
                            <ul className="nav_content">
                                <li className="home"><a href={globalConfig.context + "/portal/index.html"}>首页</a> </li>
                                <li className="active">
                                    <a href={globalConfig.context + '/portal/search/achievement.html'}>技术交易</a>
                                    <ul className="secondary_navigation_nav" >
                                        <li><a href={globalConfig.context + '/portal/search/demand.html'}>需求谷</a></li>
                                        <li><a href={globalConfig.context + '/portal/search/achievement.html'}>技术海</a></li>
                                        <li><a href={globalConfig.context + '/portal/search/subscriberOrg.html'}>伙伴</a></li>
                                        <li><a href={globalConfig.context + '/portal/search/subscriberUser.html'}>行家</a></li>
                                        <li><a href={globalConfig.context + '/portal/international/internationalIndex.html'}>国际业务</a></li>
                                    </ul>
                                </li>
                                <li>
                                    <a href={globalConfig.context + '/portal/scienceTechnology/bigShot.html'}>大咖说</a>
                                    <ul className="secondary_navigation_nav">
                                        <li><a href={globalConfig.context + '/portal/scienceTechnology/star.html'}>科技明星</a></li>
                                        <li><a href={globalConfig.context + '/portal/scienceTechnology/lecture.html'}>科技讲堂</a></li>
                                    </ul>
                                </li>
                                <li>
                                    <a href={globalConfig.context + '/portal/activity/activityIndex.html'}>活动圈</a>
                                    <ul className="secondary_navigation_nav">
                                        <li><a href={globalConfig.context + '/portal/activity/details.html'}>活动详情</a></li>
                                    </ul>
                                </li >
                                <li>
                                    <a href={globalConfig.context + '/portal/websiteBuild/websiteBuildIndex.html'}>建设兵团</a>
                                    <ul className="secondary_navigation_nav">
                                        <li><a href={globalConfig.context + '/portal/websiteBuild/websiteBuildIndex.html#customized'}>平台定制</a></li>
                                        <li><a href={globalConfig.context + '/portal/websiteBuild/websiteBuildIndex.html#operates'}>平台运营</a></li>
                                        <li><a href={globalConfig.context + '/portal/websiteBuild/websiteBuildIndex.html#event_planning'}>活动筹划</a></li>
                                    </ul>
                                </li>
                                <li>
                                    <a href={globalConfig.context + '/portal/international/internationalIndex.html'}>国际业务</a>
                                    <ul className="secondary_navigation_nav" >
                                        <li><a href={globalConfig.context + '/portal/international/internationalIndex.html#internationalTechnology'}>国际技术</a></li>
                                        <li><a href={globalConfig.context + '/portal/international/internationalIndex.html#internationalPartner'}>国际伙伴</a></li>
                                        <li><a href={globalConfig.context + '/portal/international/internationalIndex.html#internationalExpert'}>国际专家</a></li>
                                    </ul>
                                </li>
                                <li>
                                    <a href={globalConfig.context + '/portal/service/serviceIndex.html'}>服务汇</a>
                                    <ul className="secondary_navigation_nav">
                                        <li ><a href={globalConfig.context + '/portal/highTech/authentication.html'}>高企培育</a></li>
                                        <li ><a href={globalConfig.context + '/portal/ipr/service.html'}>知识产权</a></li >
                                        <li ><a href={globalConfig.context + '/portal/evaluation/index.html'}>技术评估</a></li>
                                    </ul>
                                </li>
                                <li>
                                    <a href={globalConfig.context + '/portal/news/newsIndex.html'}>策源地</a>
                                    <ul className="secondary_navigation_nav">
                                        <li><a href={globalConfig.context + '/portal/news/newsIndex.html'}>新闻快讯</a></li>
                                        <li><a href={globalConfig.context + '/portal/news/newsIndex.html'}>科技政策</a></li>
                                        <li><a href={globalConfig.context + '/portal/news/newsIndex.html'}>政策解读</a></li>
                                    </ul>
                                </li>
                                <li>
                                    <a href={globalConfig.context + '/portal/entrepreneurship/entrepreneurshipIndex.html'}>创意圈</a>
                                    <ul className="secondary_navigation_nav">
                                        <li><a href={globalConfig.context + '/portal/entrepreneurship/entrepreneurshipIndex.html'}>项目圈</a></li>
                                        <li><a href={globalConfig.context + '/portal/entrepreneurship/entrepreneurshipIndex.html#chuangke'}>创客圈</a></li>
                                        <li><a href={globalConfig.context + '/portal/entrepreneurship/entrepreneurshipIndex.html#jieyi'}>结义园</a></li>
                                    </ul>
                                </li>
                                <li>
                                    <a href={globalConfig.context + '/portal/financial/financialIndex.html'}>金融圈</a>
                                    <ul className="secondary_navigation_nav">
                                        <li ><a href={globalConfig.context + '/portal/financial/financialIndex.html'}>金融街</a></li>
                                    </ul>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div className="secondary_navigation"></div>
                </div>
            </div>
        )
    }
});

export default LoginTop;