<template>
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <div class="navbar-header">
                <button type="button"
                        class="navbar-toggle collapsed"
                        data-toggle="collapse"
                        data-target="#bs-example-navbar-collapse-1"
                        aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand"
                   href="javascript:void(0)"
                   style="padding-top: 6px;">

                   
                <span class="glyphicon glyphicon-circle-arrow-left m-image"
                    @click="goBack"></span>

                </a>
            </div>

            <div class="collapse navbar-collapse"
                 id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li @click="openProject"
                        :class="{'active' : type == 'traceProject'}">
                        <a class="nav-item-a"
                           href="javascript:void(0)">项目</a>
                    </li>
                    <li @click="openSelf"
                        :class="{'active' : type == 'traceList'}">
                        <a class="nav-item-a"
                           href="javascript:void(0)">我自己</a>
                    </li>
                    <li @click="openDynamic"
                        :class="{'active' : type == 'traceDynamic'}">
                        <a class="nav-item-a"
                           href="javascript:void(0)">动态</a>
                    </li>
                    <li @click="team"
                        :class="{'active' : type == 'team'}">
                        <a class="nav-item-a"
                           href="javascript:void(0)">团队</a>
                    </li>
                    <li @click="goHome">
                        <a class="nav-item-a"
                           href="javascript:void(0)">主页</a>
                    </li>
                    <li @click="traceSetting" v-if="isShow">
                        <a class="nav-item-a"
                           href="javascript:void(0)">任务配置</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
</template>

<script>

var Uuid = require("pc-client-component").Uuid;
var Common = require("../common/Common.js");

export default {
    props: ["type"],

    data: function () {
        return {
			isShow:"false",
        }
    },

    methods: {
        /**
         * 打开项目界面
         */
        openProject() {
            var _self = this;
            this.$router.push("/desktop/projectList");
        },

        /**
         * 打开动态界面
         */
        openDynamic() {
            var _self = this;
            this.$router.push("/desktop/traceDynamic");
        },

        /**
         * 打开我自己界面
         */
        openSelf() {
            this.$router.push("/desktop/traceList/I_LAUNCH");
        },

        /**
         * 打开团队界面
         */
        team() {
            this.$router.push("/desktop/teamList");
        },

        goBack() {
            history.back();
        },

        goHome() {
            this.$router.push("/desktop/dashboard");
        },
        
        traceSetting(){
        	this.$router.push("/desktop/traceConfig");
        },
        /**
         * 查询配置信息
         * @return {[type]} [description]
         */
        queryIsAdmin: function () {
            var _self = this;
            $.ajax({
                url: Common.getApiURL('TraceResource/queryIsAdmin'),
                type: "get",
                dataType: "json",
                beforeSend: function (request) {
                    Common.addTokenToRequest(request);
                },
                success: function (data) {
                    _self.isShow = data;
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    Common.processException(XMLHttpRequest, textStatus, errorThrown);
                }
            });
        },
        
        
    },
    mounted: function () {
       
        this.queryIsAdmin();
    }
}
</script>
<style scoped>
.nav-item-a {
    padding-top: 15px;
    padding-bottom: 15px;
}
</style>
