<template >
  <div class="center-panel none-events">
    <div class="top-panel events">
      <div v-for="(nav,index) in topNav" class="__item" @click="() => onClickNavHandler(nav, index)">
        <div :class="['value', activeTop === nav.key ? 'active' : '']">{{nav.value}}</div>
        <div class="label">{{nav.label}}</div>
      </div>
    </div>
    <div class="bottom-panel events">
      <div  v-for="(item,index) in bottomPanel"  class="__item" @click="() => onClickBottomNavHandler(item, index)">
        <div :class="['value', activeBottom === item.key ? 'active' : '']">
          <img :src="require(`@/assets/images/icon/${item.value}.png`)" />
        </div>
        <div class="label">{{item.label}}</div>
      </div>
    </div>
  </div>
</template>

<script>

export default {
  name: 'CenterPanel',
  data() {
    return {
      topNav: [
        {  key: 'doHandler01', label: '设备状态预警', value: 28 },
        {  key: 'doHandler02', label: '设备监测预警', value: 23 },
        {  key: 'doHandler03', label: '火警', value: 12 },
        {  key: 'doHandler04', label: '消防通道预警', value: 23 },
        {  key: 'doHandler05', label: '消控室预警', value: 20 },
      ],
      bottomPanel: [
        { key: 'sp', label: '视频', value: 'sp' },
        { key: 'sb', label: '物联', value: 'sb' },
        { key: 'jz', label: '建筑', value: 'jz' },
        { key: 'sy', label: '水源', value: 'sy' },
      ],
      activeTop: 'doHandler01',
      activeBottom: ''
    }
  },
  methods: {
    onClickNavHandler (nav, index) {
      this.activeTop = nav.key
      this.$emit('clickTopNavItem', {nav, index})
    },
    onClickBottomNavHandler(nav, index) {
      this.activeBottom = nav.key
      this.$emit('clickBottomNavItem', {nav, index})
    }
  }
}
</script>

<style scoped lang='less'>
.center-panel {
  position: fixed;
  width: 100vw;
  height: 100vh;
  .top-panel {
    display: flex;
    width: 687px;
    justify-content: space-between;
    align-items: center;
    margin: 0 auto;
    .__item {
      color: #85e9ff;
      font-size: 16px;
      display: flex;
      flex-direction: column;
      align-items: center;
      cursor: pointer;

      .value {
        background: url('@/assets/images/item-bg.png') no-repeat;
        background-size: 100% 100%;
        width: 111px;
        height: 111px;
        display: flex;
        justify-content: center;
        align-items: center;
        font-family: Anton-Regular;
        color: #ffde24;
        font-size: 23px;
        letter-spacing: 2px;
        font-weight: 800;
      }
      .active {
        background: url('@/assets/images/item-active-bg.png') no-repeat;
        background-size: 100% 100%;
        width: 111px;
        height: 111px;
      }
    }
  }

  .bottom-panel {
    position: fixed;
    bottom: 22px;
    right: 421px;
    width: 86px;
    height: 376px;
    background: url('@/assets/images/bottom-panel-bg.png') no-repeat;
    background-size: 100% 100%;
    color: #fff;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    .__item {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      cursor: pointer;
      .value img {
        width: 52px;
        height: 54px;
        
      }
      .active {
        background: #85e9ff50;
        width: 52px;
        height: 54px;
        border-radius: 50%;
        background-size: 100% 100%;
      }
    }
  }
}
</style>
