<template>
  <div class="header ng-scope">
    <div class="p-wrap-full clear">
      <div class="logo fl" style="padding-top: 24px;">
        <a href="javascript:void(0)" style="text-decoration: none"
            class="rel ng-binding waphide" @click="$router.push('/')">
           {{config.title}}
          <div class="hover-block" style="padding-top: 24px;">

            <div class="hover-bd ng-scope" style="width:137px;margin-top: -20px" @click="$router.push('/')">
              <i class="arrowleft"></i>
              <div>点击进入门户首页</div>
            </div>

          </div>
        </a>
      </div>
      <div class="nav fr">
        <a href="javascript:void(0)" @click="gotoPage('/')" >
          <span class="p-ico2 ico-index" ></span>
          <span class="nav-txt">回到主页</span>
        </a>
        <a href="javascript:void(0)"  @click="gotoPage('/center/market')" :class="{'current': $route.path == '/center/market'}">
          <span class="p-ico2 ico-center"></span>
          <span class="nav-txt">继续教育</span>
        </a>

        <a href="javascript:void(0)" @click="gotoPage('/center/trainMarket')" :class="{'current': $route.path == '/center/trainMarket'}">
          <span class="p-ico2 ico-bmpx"></span>
          <span class="nav-txt">教育培训</span>
        </a>

        <span class="p-ico2 ico-line"></span>
        <a href="javascript:void(0)" @click="logout()">
          <span class="p-ico2 ico-exit"></span>
          <span class="nav-txt">退出</span>
        </a>
      </div>
    </div>
  </div>
</template>

<script>
  import { mapActions } from "vuex";
  export default {
    props: {
      user: {
        type: Object,
        default: {
          nickanme: '',
          headImg:''
        }
      }
    },
    data(){
      return {
        config: window.baseConfig,
      }
    },
    methods:{
      ...mapActions("user", [ "doLogout"]),
      gotoPage( route ){
        if( this.$route.path == route){
          return;
        }
        this.$router.push(route);
      },
      isActive( path ){
        let rpath = this.$route.path;
        return rpath.indexOf( path )> -1;
      },
      logout(){
        this.doLogout().then( res=>{
          this.$router.push('/');
        })
      }
    }
  }
</script>

<style>
  @import url("./index.css");
</style>
