<!-- eslint-disable vue/multi-word-component-names -->
<template>
  <!-- 基准的画廊模块，通过不同的 type 展示不同的样式 -->
  <div class="gallery" :class="`gallery_${type}`">
    <!-- 部分类型的画廊需要加一张图片 -->
    <div :class="`gallery-item_center_${type}`"></div>
    <div v-for="item in galleryConfig" :key="item.prop" :class="`gallery-item_${type}`">
      <!-- 画廊项的具体内容填充剩余宽度 -->
      <div class="gallery-item__label">{{ item.label }}</div>
      <div class="gallery-item__value" :class="`gallery-item__value_${item.color}`">{{ item.value }}</div>
    </div>
  </div>
</template>
<script lang="ts" setup>
  // import { get } from 'lodash-es';
  // import { computed } from 'vue';

  withDefaults(
    defineProps<{
      galleryConfig: {
        value: string;
        color: string;
        label: string;
        prop: string;
      }[];
      /** A | B | C | D */
      type: string;
    }>(),
    {
      galleryConfig: () => [],
      type: 'A',
    }
  );
  //   defineEmits(['click']);
</script>
<style lang="less" scoped>
  @import '@/design/vent/color.less';
  .gallery {
    position: relative;
    width: 100%;
    height: 100%;
  }

  .gallery-item_center_A {
    background: url(@/assets/images/home-container/configurable/gallery_center.png) no-repeat;
    width: 144px;
    height: 126px;
    left: calc(50% - 72px);
    top: calc(50% - 63px);
    position: absolute;
    background-size: 100% 100%;
  }
  .gallery > .gallery-item_A {
    background: url(@/assets/images/home-container/configurable/gallery_1.png) no-repeat;
    width: 90px;
    height: 90px;
    position: absolute;
    text-align: center;
  }
  .gallery > .gallery-item_A:nth-child(2) {
    top: 20px;
    left: 60px;
  }
  .gallery > .gallery-item_A:nth-child(3) {
    top: 20px;
    right: 60px;
  }
  .gallery > .gallery-item_A:nth-child(4) {
    bottom: 20px;
    left: 60px;
  }
  .gallery > .gallery-item_A:nth-child(5) {
    bottom: 20px;
    right: 60px;
  }

  .gallery-item_center_B {
    background: url(/@/assets/images/home-container/configurable/deco_2.png) no-repeat;
    width: 100%;
    height: 90%;
    top: 5%;
    position: absolute;
    background-position: center;
    background-size: auto 100%;
  }
  // .gallery .gallery-item__value {
  //   display: none;
  // }
  .gallery > .gallery-item_B {
    background: url(/@/assets/images/home-container/configurable/deco_3.png) no-repeat;
    position: absolute;
    text-align: center;
    background-position: center;
    background-size: auto 100%;
  }
  .gallery > .gallery-item_B:nth-child(2) {
    width: 70px;
    height: 70px;
    line-height: 70px;
    top: 20px;
    left: calc(50% - 70px);
  }
  .gallery > .gallery-item_B:nth-child(3) {
    width: 60px;
    height: 60px;
    line-height: 60px;
    top: 50px;
    // right: 34%;
    right: calc(50% - 70px);
  }
  .gallery > .gallery-item_B:nth-child(4) {
    width: 55px;
    height: 55px;
    line-height: 55px;
    bottom: 90px;
    left: calc(50% - 55px);
  }
  .gallery > .gallery-item_B:nth-child(5) {
    width: 50px;
    height: 50px;
    line-height: 50px;
    bottom: 70px;
    right: calc(50% - 50px);
  }
  .gallery-item_B > .gallery-item__label {
    display: none;
  }

  .gallery-item_center_C {
    background: url(/@/assets/images/home-container/configurable/deco_4.png) no-repeat;
    width: 100%;
    height: 100%;
    // top: 5%;
    position: absolute;
    background-position: center;
    background-size: auto 100%;
  }
  .gallery_C {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    text-align: center;
  }
  .gallery-item_C > .gallery-item__value {
    font-size: 20px;
  }

  .gallery_D {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .gallery-item_center_D {
    background: url(/@/assets/images/home-container/configurable/firehome/img-2.png) no-repeat;
    background-size: auto 100%;
    width: 100px;
    height: 100px;
  }
  .gallery > .gallery-item_D {
    background-image: url(/@/assets/images/home-container/configurable/firehome/img-1.png);
    background-size: 100% auto;
    width: 213px;
    height: 87px;
    text-align: center;
    // line-height: 35px;
    padding-top: 17px;
    padding-left: 40px;
    display: none;

    .gallery-item__value {
      font-size: 24px;
    }
  }
  .gallery > .gallery-item_D:nth-child(2) {
    display: block;
  }

  .gallery-item_center_E {
    background: url(/@/assets/images/home-container/configurable/dusthome/img-8.png) no-repeat;
    width: 200px;
    height: 200px;
    left: calc(50% - 100px);
    top: calc(50% - 100px);
    position: absolute;
    background-size: 100% auto;
  }
  .gallery > .gallery-item_E {
    background: url(/@/assets/images/home-container/configurable/dusthome/img-9.png) no-repeat;
    width: 100px;
    height: 90px;
    position: absolute;
    text-align: center;
    background-size: 100% 100%;

    .gallery-item__label {
      height: 60px;
      text-align: center;
      background-size: 30px 30px;
      background-position: center top;
      background-repeat: no-repeat;
      padding-top: 30px;
    }
  }
  .gallery > .gallery-item_E:nth-child(2) {
    top: calc(50% - 100px);
    // top: 20px;
    left: calc(50% - 150px);
    // left: 80px;
    .gallery-item__label {
      background-image: url(/@/assets/images/home-container/configurable/dusthome/sbzs.png);
    }
  }
  .gallery > .gallery-item_E:nth-child(3) {
    top: calc(50% - 100px);
    right: calc(50% - 150px);
    .gallery-item__label {
      background-image: url(/@/assets/images/home-container/configurable/dusthome/pwkqs.png);
    }
  }
  .gallery > .gallery-item_E:nth-child(4) {
    bottom: calc(50% - 100px);
    left: calc(50% - 150px);
    .gallery-item__label {
      background-image: url(/@/assets/images/home-container/configurable/dusthome/lwsl.png);
    }
  }
  .gallery > .gallery-item_E:nth-child(5) {
    bottom: calc(50% - 100px);
    right: calc(50% - 150px);
    .gallery-item__label {
      background-image: url(/@/assets/images/home-container/configurable/dusthome/dwsl.png);
    }
  }

  // .gallery-item_center_F {
  // }
  .gallery > .gallery-item_F {
    width: 120px;
    height: 60px;
    position: absolute;
    text-align: center;
    padding-left: 20px;
    padding-top: 5px;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    background-image: url(/@/assets/images/home-container/configurable/firehome/img-1.png);

    .gallery-item__value {
      font-size: 20px;
    }
  }
  .gallery > .gallery-item_F:nth-child(2) {
    top: calc(50% - 60px);
    left: calc(50% - 180px);
    width: 120px;
    height: 120px;
    line-height: 120px;
    padding: 0;
    background-image: url(/@/assets/images/home-container/configurable/dusthome/img-7.png);

    .gallery-item__label {
      display: none;
    }
  }
  .gallery > .gallery-item_F:nth-child(3) {
    top: calc(50% - 62px);
    left: calc(50% - 60px);
  }
  .gallery > .gallery-item_F:nth-child(4) {
    top: calc(50% - 62px);
    left: calc(50% + 60px);
  }
  .gallery > .gallery-item_F:nth-child(5) {
    bottom: calc(50% - 62px);
    left: calc(50% - 60px);
  }
  .gallery > .gallery-item_F:nth-child(6) {
    bottom: calc(50% - 62px);
    left: calc(50% + 60px);
  }

  .gallery > .gallery-item_G {
    width: 120px;
    height: 120px;
    position: absolute;
    text-align: center;
    padding-top: 34px;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    background-image: url(/@/assets/images/home-container/configurable/firehome/img-4.png);

    .gallery-item__value {
      font-size: 20px;
    }
  }
  .gallery > .gallery-item_G:nth-child(2) {
    top: calc(50% - 60px);
    left: calc(50% - 60px);
  }
  .gallery > .gallery-item_G:nth-child(3) {
    top: calc(50% - 60px);
    left: calc(50% - 160px);
    transform: scale(0.8);
  }
  .gallery > .gallery-item_G:nth-child(4) {
    top: calc(50% - 60px);
    right: calc(50% - 160px);
    transform: scale(0.8);
  }
  .gallery > .gallery-item_G:nth-child(5) {
    top: calc(50% - 110px);
    left: calc(50% - 230px);
    transform: scale(0.7);
  }
  .gallery > .gallery-item_G:nth-child(6) {
    bottom: calc(50% - 110px);
    left: calc(50% - 230px);
    transform: scale(0.7);
  }
  .gallery > .gallery-item_G:nth-child(7) {
    top: calc(50% - 110px);
    right: calc(50% - 230px);
    transform: scale(0.7);
  }
  .gallery > .gallery-item_G:nth-child(8) {
    bottom: calc(50% - 110px);
    right: calc(50% - 230px);
    transform: scale(0.7);
  }

  .gallery_H {
    background-image: url('/@/assets/images/vent/alarm/bottom1.png'), url('/@/assets/images/vent/alarm/center-bg.png');
    background-repeat: no-repeat, no-repeat;
    background-size:
      auto 90%,
      auto 90%;
    // background-size: contain;
    background-position: center, center;
    position: relative;
  }

  .gallery > .gallery-item_H {
    width: 100px;
    height: 70px;
    display: flex;
    position: absolute;
    text-align: center;
    justify-content: space-evenly;
    background-repeat: no-repeat;
  }
  .gallery > .gallery-item_H:nth-child(2) {
    top: 0%;
    left: calc(50% - 150px);
    width: 300px;
    height: 200px;
    padding-top: 50px;
    background-image: url(/@/assets/images/vent/alarm/warning-icon-bg1.png), url(/@/assets/images/vent/alarm/warning-icon-bg-a1.png);
    background-size:
      auto 100%,
      auto 46%;
    background-position:
      center top,
      center 28%;
    display: block;
  }
  .gallery > .gallery-item_H:nth-child(3) {
    top: calc(50% - 60px);
    left: calc(50% - 170px);
    background-image: url(/@/assets/images/vent/alarm/data-bg.png), url(/@/assets/images/vent/alarm/icon-vent.svg),
      url(/@/assets/images/vent/alarm/icon-bg.png);
    background-size:
      100% auto,
      auto 46%,
      50% 20%;
    background-position:
      center top,
      center 80%,
      center bottom;
  }
  .gallery > .gallery-item_H:nth-child(4) {
    top: calc(50% + 10px);
    left: calc(50% - 170px);
    background-image: url(/@/assets/images/vent/alarm/data-bg.png), url(/@/assets/images/vent/alarm/icon-device.svg),
      url(/@/assets/images/vent/alarm/icon-bg.png);
    background-size:
      100% auto,
      auto 46%,
      50% 20%;
    background-position:
      center top,
      center 80%,
      center bottom;
  }
  .gallery > .gallery-item_H:nth-child(5) {
    top: calc(50% - 60px);
    right: calc(50% - 170px);
    background-image: url(/@/assets/images/vent/alarm/data-bg.png), url(/@/assets/images/vent/alarm/icon-dust.svg),
      url(/@/assets/images/vent/alarm/icon-bg.png);
    background-size:
      100% auto,
      auto 46%,
      50% 20%;
    background-position:
      center top,
      center 80%,
      center bottom;
  }
  .gallery > .gallery-item_H:nth-child(6) {
    top: calc(50% + 10px);
    right: calc(50% - 170px);
    background-image: url(/@/assets/images/vent/alarm/data-bg.png), url(/@/assets/images/vent/alarm/icon-gas.svg),
      url(/@/assets/images/vent/alarm/icon-bg.png);
    background-size:
      100% auto,
      auto 46%,
      50% 20%;
    background-position:
      center top,
      center 80%,
      center bottom;
  }

  .gallery-item__value_red {
    color: red;
  }
  .gallery-item__value_orange {
    color: orange;
  }
  .gallery-item__value_yellow {
    color: yellow;
  }
  .gallery-item__value_green {
    color: yellowgreen;
  }
  .gallery-item__value_blue {
    color: #009bff;
  }
  .gallery-item__value_white {
    color: white;
  }
</style>
