<!-- 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/theme.less';

  .gallery {
    position: relative;
    width: 100%;
    height: 100%;
  }
  .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: aqua;
  }
  .gallery-item__value_white {
    color: white;
  }
  .gallery-item__value_lightblue {
    color: lightblue;
  }

  .gallery > .gallery-item_A {
    width: 200px;
    height: 30px;
    position: absolute;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: bottom;
    background-image: url('/@/assets/images/sealedGoaf/configurable/gallery/bg-A-5.png');
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    .gallery-item__value {
      font-size: 20px;
      font-family: 'DDIN-Bold';
    }
    .gallery-item__label {
      color: black;
      font-size: 12px;
      font-weight: bold;
    }
  }
  .gallery > .gallery-item_A:nth-child(2) {
    top: calc(50% - 65px);
    left: calc(50% - 200px);
    width: 130px;
    height: 130px;
    line-height: 130px;
    padding: 0;
    background-image: url('/@/assets/images/sealedGoaf/configurable/gallery/bg-A-1.png');
    display: flex;
    flex-direction: column;
    justify-content: center; // 建议添加，使内容在 110px 高度内垂直居中
    align-items: center;     // 建议添加，使内容水平居中

    .gallery-item__label {
      // display: none;
      color: black;
      font-size: 17px;
      font-weight: bold;
      order: 2;
      margin-top: 10px;
    }
    .gallery-item__value {
      width: 100%;
      height: 30px;
      text-align: center;
      font-size: 30px;
      color: #0070ff;
      font-weight: bold;
      font-family: 'DDIN-Bold';
      order: 1;
    }

    &::after {
      content: '';
      position: absolute;
      top: -15px; 
      left: 88%;
      width: 55px;
      height: 160px;
      background-image: url('/@/assets/images/sealedGoaf/configurable/gallery/bg-A-2.png');
      background-size: 100% 100%;
      background-repeat: no-repeat;
      pointer-events: none;
    }
  }
  .gallery > .gallery-item_A:nth-child(3) {
    top: calc(10px);
    left: calc(50%);
    .gallery-item__value {
      color: #00b161;
    }

    &::before {
      content: '';
      position: absolute;
      top: 8px;
      left: -63px;
      width: 68px;
      height: 8px;
      background-image: url('/@/assets/images/sealedGoaf/configurable/gallery/bg-A-3.png');
      background-size: 100% 100%;
      background-repeat: no-repeat;
      pointer-events: none;
    }
  }
  .gallery > .gallery-item_A:nth-child(4) {
    top: calc(50% - 38px);
    left: calc(50%);
    .gallery-item__value {
      color: #0070ff;
    }
    &::before {
      content: '';
      position: absolute;
      top: 10px;
      left: -40px;
      width: 43px;
      height: 8px;
      background-image: url('/@/assets/images/sealedGoaf/configurable/gallery/bg-A-4.png');
      background-size: 100% 100%;
      background-repeat: no-repeat;
      pointer-events: none;
    }
  }
  .gallery > .gallery-item_A:nth-child(5) {
    top: calc(50% + 8px);
    left: calc(50%);
    .gallery-item__value {
      color: #6b7772;
    }

    &::before {
      content: '';
      position: absolute;
      top: 8px;
      left: -38px;
      width: 43px;
      height: 8px;
      background-image: url('/@/assets/images/sealedGoaf/configurable/gallery/bg-A-4.png');
      background-size: 100% 100%;
      background-repeat: no-repeat;
      pointer-events: none;
    }
  }
  .gallery > .gallery-item_A:nth-child(6) {
    bottom: calc(10px);
    left: calc(50%);
    .gallery-item__value {
      color: #ee0000;
    }
    &::before {
      content: '';
      position: absolute;
      top: 8px;
      left: -58px;
      width: 68px;
      height: 8px;
      background-image: url('/@/assets/images/sealedGoaf/configurable/gallery/bg-A-3.png');
      background-size: 100% 100%;
      background-repeat: no-repeat;
      pointer-events: none;
    }
  }

  .gallery-item_center_B {
    background: url('/@/assets/images/sealedGoaf/configurable/gallery/bg-B-1.png') no-repeat;
    width: 200px;
    height: 200px;
    left: calc(50% - 100px);
    top: calc(50% - 100px);
    position: absolute;
    background-size: 100% auto;
    z-index: 1;
  }
  .gallery > .gallery-item_B {
    background-image: url('/@/assets/images/sealedGoaf/configurable/gallery/bg-B-2.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    width: 180px;
    height: 70px;
    position: absolute;
    text-align: center;
    background-size: 100% 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: start;
    padding: 0 20px;
    .gallery-item__label {
      height: 60px;
      color: black;
      margin-top: 10px;
      font-weight: bold;
    }
    .gallery-item__value {
      font-size: 30px;
      font-family: 'DDIN-Bold';
    }
  }
  .gallery > .gallery-item_B:nth-child(2) {
    top: calc(50% - 100px);
    left: calc(50% - 200px);
    .gallery-item__value{
      color: #0070ff;
    }

  }
  .gallery > .gallery-item_B:nth-child(3) {
    top: calc(50% - 100px);
    right: calc(50% - 200px);
    background: url('/@/assets/images/sealedGoaf/configurable/gallery/bg-B-3.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    align-items: end;
    .gallery-item__value{
      color: #b39f01;
    }
  }
  .gallery > .gallery-item_B:nth-child(4) {
    bottom: calc(50% - 100px);
    left: calc(50% - 200px);
    .gallery-item__value{
      color: #e6a23d;
    }
  }
  .gallery > .gallery-item_B:nth-child(5) {
    bottom: calc(50% - 100px);
    right: calc(50% - 200px);
    background: url('/@/assets/images/sealedGoaf/configurable/gallery/bg-B-3.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    align-items: end;
    .gallery-item__value{
      color: #d04f56;
    }
  }

  .gallery_C {
    background-image: url('/@/assets/images/sealedGoaf/configurable/gallery/bg-C-1.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    height: calc(100% - 20px) !important;
  }
  .gallery-item_center_C {
    width: 120px;
    height: 100px;
    background-image: url('/@/assets/images/sealedGoaf/configurable/gallery/bg-C-2.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    margin-right: 40px;
  }
  .gallery > .gallery-item_C {
    height: 70px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: start;
    padding: 0 20px;
    .gallery-item__label {
      color: black;
      margin-bottom: 10px;
      font-weight: bold;
      font-size: 20px;
    }
    .gallery-item__value {
      font-size: 30px;
      font-family: 'DDIN-Bold';
      color: #0070ff;
    }
  }
</style>
