<template>
  <div id="node3">
    <div class="title">今日所有小区智能硬件数据统计</div>
    <div class="table">
      <div
        v-for="(item,index) in arr"
        :key="index"
        :class="{active:item.active}"
        @mouseover="item.active = true"
        @mouseout="item.active=false"
      >
        <div>{{ item.text }}</div>
        <div>{{ item.num }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState, mapActions } from 'vuex'

export default {
  data() {
    return {
      arr: [
        { text: '小区门禁开启', num: '13400次', active: false },
        { text: '单元门开启', num: '12788次', active: false },
        { text: '车辆进入数量', num: '5664辆', active: false },
        { text: '咖啡厅销量', num: '3994次', active: false },
        { text: '智慧食堂销量', num: '5664人次', active: false },
        { text: '健身房健身', num: '1255人次', active: false }
      ]
    }
  },
  computed: {
    ...mapState('trunkIndex', {
      hardData: item => item.trunkIndex.hardData
    })
  },
  created() {
    // this.GetHardData().then(() => {
    //   console.log(this.hardData)
    //   this.hardData.forEach(item => {
    //     if (item.message === '小区开门次数') {
    //       this.arr[0].num = item.count + '次'
    //     } else if (item.message === '单元门开门次数') {
    //       this.arr[1].num = item.count + '次'
    //     }
    //   })
    //   this.arr = JSON.parse(JSON.stringify(this.arr))
    // })
  },
  methods: {
    ...mapActions('trunkIndex', [
      'GetHardData'
    ])
  }
}
</script>

<style lang="scss" scoped>
#node3 {
  position: relative;
  .title {
    text-align: center;
    padding: 3% 0 30px 0;
    color: #a4b6c5;
  }
  .table {
    display: flex;
    flex-flow: row wrap;
    border: 1px solid #a4b6c5;
    width: 302px;
    margin: 0 auto;
    > div {
      width: 100px;
      height: 100px;
      border: 1px solid #a4b6c5;
      display: flex;
      flex-flow: column nowrap;
      justify-content: center;
      align-items: center;
      &:hover {
        cursor: pointer;
      }
      div {
        color: #a4b6c5;
        margin: 5px;
        font-size: 13px;
      }
    }
    .active {
      outline: 2px solid #53f9ff;
      z-index: 1;
      div {
        color: #53f9ff;
      }
    }
  }
}
</style>
