<template>
  <div class="top-tabbar">
    <div class="tabbar">
      <div class="tab-one">
        <div class="tab-t1" @click="tabClick('/index',0)">网站首页</div>
      </div>
      <div class="tab-one tab-4">
        <div class="tab-t1" @click="tabClick('/explain/int',0)">委员会简介</div>
        <div class="tab-tow">
          <div @click="tabClick('/explain/int',0)">基本介绍</div>
          <div @click="tabClick('/explain/arch',1)">组织架构</div>
          <div @click="tabClick('/explain/bylaws',2)">促进会章程</div>
        </div>
      </div>
      <div class="tab-one tab-3">
        <div class="tab-t1" @click="tabClick('/new/study',0)">新闻动态</div>
        <div class="tab-tow">
          <div @click="tabClick('/new/study',0)">学习强国</div>
          <div @click="tabClick('/new/association',1)">科协新闻</div>
          <div @click="tabClick('/new/party',2)">党建动态</div>
        </div>
      </div>
      <div class="tab-one tab-1">
        <div class="tab-t1" @click="tabClick('/question/qinfo',0)">专家智库</div>
        <div class="tab-tow">
          <div @click="tabClick('/question/qinfo',0)">智库专家团队</div>
        </div>
      </div>
      <div class="tab-one tab-1">
        <div class="tab-t1" @click="tabClick('/cooperation/union',0)">合作前沿</div>
        <div class="tab-tow">
          <div  @click="tabClick('/cooperation/union',0)">联合战略单位</div>
        </div>
      </div>
      <div class="tab-one tab-3">
        <div class="tab-t1" @click="tabClick('/committee/apply',1)">委员会成员</div>
        <div class="tab-tow">
          <div @click="tabClick('/committee/invitation',4)">邀请函</div>
          <div @click="tabClick('/committee/apply',1)">入会须知</div>
          <div @click="tabClick('/committee/load',2)">申请表下载</div>
        </div>
      </div>
      <div class="tab-one">
        <div class="tab-t1" @click="tabClick('/About/contcat',0)">联系我们</div>
      </div>
    </div>
  </div>
</template>

<script>
import {mapState, mapMutations } from 'vuex'
export default {
  name: "Toptabbar",
  computed: {
    ...mapState(['current'])
  },
  methods: {
    ...mapMutations(['changeCurrent']),
    tabClick(e,index) {
      if( this.$route.path !== e ){
        this.$router.push(e)
      }
      this.changeCurrent(index)
    },
  },
};
</script>

<style lang="scss" scoped>
.top-tabbar {
  height: 60px;
  background-color: #e13e00;
  .tabbar {
    margin: 0 auto;
    width: 1234px;
    height: 60px;
    background-color: #e13e00;
    display: flex;
    .tab-one {
      width: 120px;
      display: inline-block;
      line-height: 60px;
      color: #fff;
      position: relative;
      cursor: pointer;
      .tab-t1 {
        padding: 0 20px;
      }
      .tab-t1:hover {
        background-color: #ba3300;
      }
      .tab-tow {
        transition: height 218ms;
        height: 0;
        position: absolute;
        top: 60px;
        left: 0;
        border-top: 2px solid #fff;
        overflow: hidden;
        div {
          line-height: 35px;
          height: 35px;
          padding: 0 20px;
          width: 110px;
          background-color: #e13e00;
          &:hover {
            background-color: #ba3300;
          }
        }
      }
    }
    .tab-1:hover {
      .tab-tow {
        height: 38px;
      }
    }
    .tab-2:hover {
      .tab-tow {
        height: 73px;
      }
    }
    .tab-3:hover {
      .tab-tow {
        height: 108px;
        z-index: 998;
      }
    }
    .tab-4:hover {
      .tab-tow {
        height: 143px;
      }
    }
  }
}
</style>>