<template>
  <!-- 本月预警排名情况 -->
  <div class="main" style="height: 636px">
    <div class="mian-contain">
      <div class="top">
        <div class="top-tit">
          <img src="../../../assets/arrow.png" alt="" />
          <i>本月预警排名情况</i>
        </div>
        <div class="top-line">
          <img src="../../../assets/top-line.png" alt="" />
        </div>
      </div>
      <div class="container19">
        <div
          class="item-box"
          v-for="(item, index) in monthWarningList1"
          :key="index"
        >
          <div class="title">目的地1</div>
          <div class="item-icon">
            <div>
              <div
                class="bright-box"
                :style="{ width: item.percent + 'px' }"
              ></div>
            </div>
            <div class="item-num">{{ item.num }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      monthWarningList1: [
        { name: "", num: 26, percent: 50 },
        { name: "", num: 24, percent: 30 },
        { name: "", num: 20, percent: 20 },
        { name: "", num: 18, percent: 20 },
        { name: "", num: 16, percent: 20 },
        { name: "", num: 14, percent: 50 },
        { name: "", num: 12, percent: 30 },
        { name: "", num: 10, percent: 20 },
        { name: "", num: 8, percent: 20 },
      ],
    };
  },
  created() {
    this.handleData1();
  },
  methods: {
    handleData1() {
      const total = 26;
      this.monthWarningList1.forEach((item) => {
        item.percent = ((367 / total) * item.num).toFixed(2);
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.main {
  width: 455px;
  height: 308px;
  border-radius: 8px;
  // background: rgba(26, 52, 125, 0.95);
  padding: 10px;
}
.top {
  height: 45px;
  .top-tit {
    font-size: 18px;
    font-weight: 600;
    line-height: 23.4px;
    text-align: left;
    color: #ffffff;
    img {
      margin-right: 10px;
    }
  }
  .top-line {
    margin-top: -7px;
  }
}
.mian-contain {
  border-radius: 8px;
  padding: 10px;
  background: rgba(29, 65, 171);
  // overflow: hidden;
  height: 100%;
}
.container19 {
  padding: 0 15px;
  .item-box {
    margin-bottom: 15px;
    .title {
      font-size: 15px;
      font-weight: 500;
      line-height: 22.5px;
      text-align: left;
      color: #f1f3ff;
    }
    .item-icon {
      display: flex;
      align-items: center;
      margin-top: 3px;
      .bright-box {
        width: 367px;
        height: 9px;
        border-radius: 8px;
        background: linear-gradient(
          270deg,
          #45d5d5 0%,
          rgba(61, 111, 240, 0.35) 81.5%
        );
      }
      .item-num {
        color: rgba(227, 232, 255, 0.5);
        font-size: 20px;
        margin-left: 20px;
      }
    }
  }
}
</style>
