<template>
  <div
    class="deviceCardAir"
    :style="{
      backgroundColor: color,
      border: activeList.length > 0 && activeList.indexOf(item.id) != -1 ? '1px solid #000' : '1px solid #00000000',
      boxShadow:
        activeList.length > 0 && activeList.indexOf(item.id) != -1 ? '0 1px 2px ' + color : '0 1px 2px rgba(0, 0, 0, 0.15)'
    }"
    @click="domClick(item.id)"
  >
    <div class="deviceCardAir-top">
      <span>#{{ item.id }}</span>
      <span
        @click.stop="toggle(item)"
        class="anticon"
        style="float: right;border-radius: 15px;cursor: pointer;padding: 6px 8px 7px;margin-right: 15px"
      >
        <a-icon type="poweroff" />
      </span>
    </div>

    <!--<div class="deviceCardAir-content">-->
    <!--  <div style="font-size: 18px;width: 20px;margin-left: 20px;margin-top: 12px;display: inline-block">-->
    <!--    <span v-if="item.online && item.mode=='hot'">制热</span>-->
    <!--    <span v-if="item.online && item.mode=='cold'">制冷</span>-->
    <!--    <span v-if="!item.online">-</span>-->
    <!--  </div>-->
    <!--  <div style="display: inline-block;font-size: 25px;vertical-align: top;padding-top: 20px;margin-left: 10%">-->
    <!--    <span>{{ item.tm }}ºC</span>-->
    <!--  </div>-->
    <!--</div>-->

    <div class="deviceCardAir-bottom">
      <span class="anticon" @click.stop="click"> <a-icon type="setting" /> </span>
      <span style="margin-left: 15px"> {{ item.name }} </span>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      color: ""
    };
  },
  props: {
    item: Object,
    activeList: Array,
    click: Function,
    toggle: Function,
    domClick: Function
  },
  watch: {
    "item.online": function(val) {
      if (this.item.online) {
        this.color = "#2ea8e5";
      } else {
        this.color = "#bebebe";
      }
    }
  },
  mounted() {
    if (this.item.online) {
      this.color = "#2ea8e5";
    } else {
      this.color = "#bebebe";
    }
  },
  methods: {}
};
</script>

<style lang="less" scoped>
* {
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
}
.deviceCardAir {
  width: 100%;
  height: 10rem;
  background-color: #2ea8e5;
  border-radius: 4px;
  color: white;
  background-image: url("@/assets/images/scene/device/bulb-full.png");
  background-repeat: no-repeat;
  background-position: 85% 70%;
  background-size: 25%;
  .deviceCardAir-top {
    padding-top: 14px;
    padding-left: 20px;
    font-size: 20px;
    .anticon:hover {
      background-color: rgba(182, 182, 182, 0.7);
    }
  }
  .deviceCardAir-bottom {
    margin-top: 15%;
    margin-left: 18px;
    font-size: 23px;
  }
  .anticon {
    cursor: pointer;
  }
}
</style>
