<template>
  <div id="tabbar">
    <div class="tab" :class="active=='ZZY'?'active':''" @click="handZZY">
      <img v-if="active=='ZZY'" src="../assets/tabbar2/tab2_on.png" alt="">
      <img v-else src="../assets/tabbar2/tab2_off.png" alt="">
      <p>周周营</p>
    </div>
    <div class="tab" :class="active=='QXY'?'active':''" @click="handleQYX">
      <img v-if="active=='QXY'" src="../assets/tabbar2/tab3_on.png" alt="">
      <img v-else src="../assets/tabbar2/tab3_off.png" alt="">
      <p>趣学院</p>
    </div>
    <div class="tab" :class="active=='center'?'active':''" @click="handleCenter">
      <img v-if="active=='center'" src="../assets/tabbar2/tab4_on.png" alt="">
      <img v-else src="../assets/tabbar2/tab4_off.png" alt="">
      <p>我的</p>
    </div>
  </div>
</template>
<script>
export default {
  name: 'Tabbar3',
  props: {
    active: String
  },
  methods: {
    handZZY () {
      let publicName = sessionStorage.getItem('publicName');
      this.$router.push({ name: 'Service' + publicName, query: { showTab: 'ZZY' } })
    },
    handleQYX () {
      let publicName = sessionStorage.getItem('publicName');
      this.$router.push({ name: 'Service' + publicName, query: { showTab: 'QXY' } })
    },
    handleCenter () {
      let publicName = sessionStorage.getItem('publicName');
      this.$router.push({ name: 'Home'+publicName })
    }
  }
}
</script>
<style lang="scss" scoped>
#tabbar {
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 100px;
  background: #fff;
  display: flex;
  justify-content: space-around;
  padding-bottom: 40px;
  z-index: 99;
  .tab {
    padding: 18px;
    img {
      width: 36px;
      padding: 20px;
      display: block;
      margin: 0 auto;
    }
    .block {
      width: 52px;
      height: 52px;
    }
    p {
      font-size: 20px;
      color: #999999;
      text-align: center;
    }
    &.active {
      p {
        color: #5789ff;
      }
    }
  }
  .center {
    width: 92px;
    height: 92px;
    padding: 30px;
    background: transparent;
    position: absolute;
    top: -60px;
    left: 299px;
    overflow: hidden;
    z-index: 1;
    .tip {
      width: 92px;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      z-index: -1;
    }
  }
}
</style>