<template>
  <div>
    <div class="basicbackground" @click='clickEmpty()'>
      <div class="backgroundimg" @click='stopClickEmpty' :style="prizeBackground?`background-image:url(${prizeBackground})`:''">
        <!-- <div class="colorbarimg">中奖啦！</div> -->
        <div class="closeimg" @click="closeClick()">×</div>
        <slot></slot>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ["colorTitle", 'SYLbackground'],
  name: "basicbackground",
  data() {
    return {
      prizeBackground: ''
    };
  },
  computed: {
    snapdragon() {
      const at = sessionStorage.getItem("activityType");
      const snapdragon = ["10011", "10012", "10013", "10014"];
      return snapdragon.some((o) => at === o);
    },
  },
  mounted() {
    document
      .querySelector("body")
      .setAttribute(
        "style",
        "position:#fixed;top:0;height:100%;overflow:hidden"
      );

  },
  created() {
    this.$nextTick(() => {
      this.prizeBackground = this.SYLbackground
    }
    )

  },
  methods: {
    closeClick() {
      this.$emit("closeClick");
    },
    //点击空白处关闭弹框
    clickEmpty(){
      this.$emit("closeClick");
    },
    //阻止冒泡
    stopClickEmpty(event){
      event.stopPropagation();
    },
  },
};
</script>
<style lang="scss" scoped>
.basicbackground {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;

  .colorbarimg {
    font-size: 0.42rem;
    color: #fff;
    margin-top: 0.37rem;
    text-align: center;
  }

  .closeimg {
    font-size: 0.6rem;
    height: 0.7rem;
    width: 0.8rem;
    position: absolute;
    right: 0;
    top: 0.1rem;
    color: #ccc;
    // font-size:0.12rem;
    // background-image: url('//img10.360buyimg.com/imgzone/jfs/t1/147497/24/18681/266/5fd996feEeda3d39e/c7382b0b3580717e.png');
    // background-repeat: no-repeat;
    // background-size: 100%;
  }

  .backgroundimg {
    height: 6.9rem;
    width: 6rem;
    background-image: url('https://img10.360buyimg.com/imgzone/jfs/t1/192397/10/43679/6583/66210fb5F7cbdba7c/4f6cd4a6b63298e0.png');
    background-repeat: no-repeat;
    background-size: 100%;
    position: relative;
  }
}

.snapdragonDiv {
  position: fixed;
  width: 100%;
  height: 100%;
  background: rgba($color: #000000, $alpha: 0.7);
  top: 0;
  bottom: 0;
  z-index: 200;

  .basicPopDiv {
    position: fixed;
    width: 6.48rem;
    min-height: 7rem;
    max-height: 100vh;
    background-color: #eaebf0;
    border-radius: 0.2rem;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;

    .titleDiv {
      width: 100%;
      height: 1.14rem;
      position: relative;
      flex-grow: 0;
      flex-shrink: 0;

      .titleDiv1 {
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        color: #333333;
        font-size: 0.46rem;
      }

      .leftLineDiv {
        width: 34px;
        height: 4px;
        background: linear-gradient(to right, #4f5f7a, #e9eaef);
        border-radius: 4px;
        margin-right: 0.1rem;
      }

      .RightLineDiv {
        width: 34px;
        height: 4px;
        background: linear-gradient(to left, #4f5f7a, #e9eaef);
        border-radius: 4px;
        margin-left: 0.1rem;
      }

      .closeDiv {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 48px;
        height: 48px;

        img {
          display: none;
        }

        &:before,
        &:after {
          position: absolute;
          left: 50%;
          top: 50%;
          display: block;
          content: '';
          width: 0.4rem;
          height: 0.04rem;
          border-radius: 1px;
          background-color: #8293ab;
        }

        &:before {
          transform: translate(-50%, -50%) rotate(45deg);
        }

        &:after {
          transform: translate(-50%, -50%) rotate(-45deg);
        }
      }
    }

    .content-body {
      margin: 0.25rem;
      background-color: white;
      padding: 0.34rem;
      box-shadow: 0rem 0.05rem 0.16rem 0rem rgba(177, 177, 177, 0.18);
      border-radius: 0.1rem;
      color: #495975;
      flex-direction: column;
      font-size: 0.44rem;
    }
  }
}
</style>
