<template>
  <div class="basicMaskDiv" @click='clickEmpty()'>
    <div class="basicPopDiv" @click='stopClickEmpty'>
      <div class="titleDiv" :style="{ backgroundImage: titleImg }">
        <div class="titleDiv1">
          <div class="leftLineDiv" v-if="isShow"></div>
          <span>{{ title }}</span>
          <div class="RightLineDiv" v-if="isShow"></div>
        </div>
        <img class="closeDiv" @click="closeClick()" src="//img10.360buyimg.com/imgzone/jfs/t1/133343/17/19838/1158/5fd5c798E72ccdde6/51194de08ba1e3dc.png" />
      </div>
      <div class="content-body"><slot></slot></div>
    </div>
  </div>
</template>

<script>
export default {
  props: ['title', 'taskType', 'styleData'],
  data() {
    return {
     titleImg: "url(//img10.360buyimg.com/imgzone/jfs/t1/141588/29/18217/44025/5fd571b9Ef55329ec/42dba91b188b9dce.png)",
      isShow: true
    };
  },
  computed: {
    baseClassName() {
      const at = sessionStorage.getItem('activityType');
      const taskShare = sessionStorage.getItem('taskShare');
      const snapdragon = ['10011', '10012', '10013', '10014'];
      if (taskShare != '' && taskShare) {
        return 'basicMaskTaskDiv';
      }
      return snapdragon.some(o => at === o) ? 'snapdragonDiv' : 'basicMaskDiv';
    }
  },
  mounted() {
    console.log(this.styleData, 'zmyqqqqq');
    this.titleImg = this.styleData.titlepop ? this.styleData.titlepop.backgroundImage : this.titleImg;

     console.log(this.titleImg, 'zmyqqqqqaatitleImg');
    var templateId = sessionStorage.getItem('templateId');
  },
  methods: {
    closeClick() {
      this.$emit('closeClick');
    },
    //点击空白处关闭弹框
    clickEmpty(){
      this.$emit("closeClick");
    },
    //阻止冒泡
    stopClickEmpty(event){
      event.stopPropagation();
    },
  }
};
</script>

<style lang="scss" scoped="scoped">
.basicMaskDiv {
  position: fixed;
  width: 100%;
  height: 100%;
  background: rgba($color: #000000, $alpha: 0.7);
  top: 0;
  bottom: 0;
  z-index: 200;

  .basicPopDiv {
    position: fixed;
    bottom: 0;
    // max-height: 10.57rem;
    background: #f2f2f2;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    width: 100%;
    z-index: 201;

    .titleDiv {
      // background: url(//img10.360buyimg.com/imgzone/jfs/t1/141588/29/18217/44025/5fd571b9Ef55329ec/42dba91b188b9dce.png) no-repeat;
      background-repeat: no-repeat;
      background-size: 100% 100%;
      width: 100%;
      height: 1.14rem;
      position: relative;
      margin-top: -2px;

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

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

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

      .closeDiv {
        position: absolute;
        top: 0.26rem;
        right: 0.26rem;
        width: 0.22rem;
        height: 0.22rem;
      }
    }
  }
}
.basicMaskTaskDiv {
  width: 100%;
  height: 100%;
  background: rgba($color: #000000, $alpha: 0.7);
  top: 0;
  bottom: 0;
  z-index: 200;
  overflow-y: scroll;
  position: fixed;
  .basicPopDiv {
    bottom: 0;

    background: #f2f2f2;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    width: 100%;
    z-index: 201;

    .titleDiv {
      // background: url(//img10.360buyimg.com/imgzone/jfs/t1/141588/29/18217/44025/5fd571b9Ef55329ec/42dba91b188b9dce.png) no-repeat;
      background-repeat: no-repeat;
      background-size: 100% 100%;
      width: 100%;
      height: 1.14rem;
      position: relative;
      display: none;
      .titleDiv1 {
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        color: #ffffff;
        font-size: 0.34rem;
      }

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

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

      .closeDiv {
        position: absolute;
        top: -0.24rem;
        right: 0.26rem;

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

  .basicPopDiv {
    position: absolute;
    width: 6.48rem;
    min-height: 7.77rem;
    max-height: 9.3rem;
    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 {
      flex-grow: 1;
      flex-shrink: 1;
      margin: 0.25rem;
      background-color: white;
      padding: 0.34rem;
      overflow: auto;
      -webkit-overflow-scrolling: touch;
      box-shadow: 0rem 0.05rem 0.16rem 0rem rgba(177, 177, 177, 0.18);
      border-radius: 0.1rem;
      font-size: 0.28rem;
      font-weight: normal;
      font-stretch: normal;
      line-height: 0.47rem;
      letter-spacing: 0rem;
      color: #495975;

      .inputAllDiv {
        padding: 0 !important;
        margin: 0 !important;

        .van-cell {
          padding-left: 0 !important;
        }
      }
      .context1 {
        position: unset;
        height: auto;
        padding: 0;
        margin: 0;
        font-size: inherit !important;

        .context {
          position: unset;
          height: auto;
          padding: 0;
          margin: 0;
          font-size: inherit !important;
        }
      }
    }
  }
}
</style>
