<template>
  <div class="wrapper">
    <div class="ui-broadcast" @click="close">
      <div class="ui-con" @click.stop>
        <img class="bg" :src="require('@/assets/images/collect_bg.png')">
        <img class="close"  @click="close" :src="require('@/assets/images/icon/close.png')">
        <div class="img-con img-k" >
          <iframe v-if="item.type == 'model'" :src="$serverName+`/model-page/Model.html?m=${getLastName(item.filePath)}`" frameborder="0"></iframe>
          <img v-else-if="item.type == 'img'" :src="$serverName+item.filePath" alt="">
          <video controlslist="nodownload" disablePictureInPicture controls autoplay v-else :src="$serverName+item.filePath"></video>
        </div>
      </div>
     <div class="full" v-if="isFull" @click.stop>
      <img class="full-btn"  @click="close" :src="`${$cdn}images/close-full.png`" alt="">
    </div>
    </div>
  </div>
</template>
<script>
export default {
  data(){
    return {
      isFull:false
    };
  },
  mounted(){
    console.log(this.item);
  },
  methods:{
    getLastName(data){
      return data.substring(data.lastIndexOf("/")+1)
    },
    close(){
      this.$hideBroadcast()
      this.$bus.$emit('fadeCollect',true)
    }
  }
};
</script>

<style lang="less" scoped>
@import '../../assets/style/globalVars.less';

.ui-broadcast{
  height: 100%;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100%;
 
  .ui-con{
    top: 48%;
    left: 50%;
    transform: translate(-50%,-50%);
    text-align: center;
    width: 80%;
    padding: 80px 140px;
    position: relative;
    font-size: 0;
    border-radius: 10px;
    overflow: hidden;
    box-sizing: border-box;
     .bg{
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: -1;
        min-height: 80vh;
      }
      .close{
        position: absolute;
        bottom: 50px;
        right: 50px;
        width: 20px;
        cursor: pointer;
        z-index: 9999;
      }
    iframe,video{
      width: 100%;
      min-height: 550px;
      max-height: 60vh;
    }
    img{
      width: 100%;
      max-height: 60vh;
      height: auto;
    }
  }
  .full{
    width: 100%;
    height: 100%;
    z-index: 999;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
    iframe{
      width: 100%;
      height: 100%;
    }
    .full-btn{
      width: 50px;
      position: absolute;
      right: 12px;
      top: 30px;
      cursor: pointer;
    }
  }
}

@media screen and (max-width: 500px) {
  .ui-broadcast{
  .close{
    position: absolute;
    bottom: 57px;
    top: unset;
    left: 50%;
    right: unset;
    transform: translateX(-50%);
    width: 22px;
    cursor: pointer;
    z-index: 9999;
  }
  .ui-con{
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    border-radius: 0;
    transform: none;
    .img-con{
      height: 100%;
      iframe,video{
        width: 100%;
        height: 100%;
      }
      img{
        width: 100%;
        height: auto;
      }
    }
  }
}
}
</style>