<template>
  <div class="container">
    <!-- 遮罩层 -->
    <div class="mask" @click="handleClose"></div>

    <!-- 内容弹窗区域 -->
    <div class="toilet">
      <!-- 名称区域 -->
      <div class="title" :title="currentToilet">{{ currentToilet }}</div>

      <!-- 信息盒子区域 -->
      <div class="info">
        <div class="info_box" :title="info?.address">
          地址：{{ info?.address }}
        </div>
        <div class="info_box">建设等级：{{ info?.level }}级</div>
        <div class="info_box">无障碍厕所：{{ info?.barrierFree }}</div>
        <div class="info_box">男厕所：{{ info?.man }}</div>
        <div class="info_box">女厕所：{{ info?.woman }}</div>
        <div class="info_box">男女通用侧位：{{ info?.unisex }}</div>
        <div class="info_box">厕所面积：{{ info?.area }}㎡</div>
        <div class="info_box">第三卫生间：{{ info?.third }}</div>
        <div class="info_box">项目编号：{{ info?.number }}</div>
      </div>

      <!-- 关闭按钮区域 -->
      <div class="close" @click="handleClose"></div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from "vue";
// 引入厕所数据
import { toiletData } from "@/components/map/toiletData";

const $emit = defineEmits(["closeDialog"]);
const props = defineProps(["currentToilet"]);

// 厕所信息
const info = ref();

onMounted(() => {
  // 匹配出当前厕所的信息
  info.value = toiletData.find((ele: any) => ele.title === props.currentToilet);
  // console.log(info.value);
});

// 点击关闭按钮回调
const handleClose = () => {
  $emit("closeDialog", false);
};
</script>

<style lang="scss" scoped>
.container {
  z-index: 9999;
  position: absolute;
  top: -151px;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 7072px;
  height: 1872px;
  background-color: rgba($color: #000000, $alpha: 0.4);

  .mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 7072px;
    height: 1872px;
  }

  .toilet {
    position: relative;
    width: 668px;
    height: 672px;
    background-image: url(@/assets/images/88.png);
    background-size: 100% 100%;

    .title {
      margin-top: 3px;
      margin-left: 230px;
      padding: 0 20px;
      width: 224px;
      height: 46px;
      line-height: 46px;
      text-align: center;
      color: #ff8e3d;
      font-size: 24px;
      font-weight: bold;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    .info {
      margin-top: 28px;
      margin-left: 37px;
      width: 604px;
      height: 565px;

      .info_box {
        margin: 0 auto 15px;
        padding-left: 22px;
        width: 530px;
        height: 47px;
        line-height: 47px;
        font-size: 23px;
        border-left: 2px solid #90cffc;
        border-top: 0.1px dashed rgba(0, 186, 186, 0.3);
        border-bottom: 1px dashed rgba(0, 186, 186, 0.3);
        border-right: 1px dashed rgba(0, 186, 186, 0.3);
        background-color: rgba(109, 161, 189, 0.21);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }

    .close {
      position: absolute;
      top: 10px;
      right: 6px;
      width: 42px;
      height: 42px;
      cursor: pointer;
      background-image: url(@/assets/images/12.png);
      background-size: 100% 100%;
    }
  }
}
</style>
