<template>
    <popup v-if="show">
      <div class="ui-message ui-message-confirm" 
      :style="{width: typeW[item.hotspotType]}"  :class="{'txtui-confirm':item.hotspotType=='textarea'}" >
        <div class="ui-message-header">
          <span>{{item.hotspotTitle}}</span>
          <span @click="$emit('close')">
            <i class="iconfont icon-close"></i>
          </span>
        </div>
        <div class="ui-message-main">
          <template v-if="item.hotspotType=='image'">
            <imgview :image="item.image" />
          </template>
          <template v-else-if="item.hotspotType=='textarea'">
            <div class="v-textarea">
              <span>{{item.textarea}}</span>
            </div>
          </template>
          <template v-else-if="item.hotspotType=='audio'">
            <div class="v-audio">
              <v-audio :vkey="item.id" :showTime=true :name="item.audio.name" :idleft="`_${$randomWord(true,8,8)}`" :idright="`_${$randomWord(true,8,8)}`" :myAudioUrl="item.audio.ossPath"></v-audio>
            </div>
          </template>
          <video :poster="item.video.icon" v-else controls autoplay :src="item.video.ossPath"></video>
        </div>
      </div>
    </popup>
</template>

<script>
import Popup from "@/components/shared/popup";
import imgview from "./imgview";
import vAudio from '@/components/audio'


export default {
  props:['show','item'],
  components:{
    Popup,
    imgview,
    vAudio
  },
  data(){
    let typeStr={
      image:'icon',
      pano:'previewIcon'
      // image:'icon',
      // image:'icon',
    }

    let typeW={
      image:'960px',
      pano:'960px',
      audio:'430px',
      video:'960px',
      
    }
    return {
      typeStr,
      typeW
    }
  },
  methods:{
    
  }
}
</script>

<style lang="less" scoped>
.ui-message-confirm{
  border-radius: 0;
  top: auto;
  left: auto;
  transform: none;
  padding: 0;
  border: none;
  .icon-close{
    color: #909090;
  }
  .ui-message-header{
    border-bottom: 0 solid #EBEBEB;
    padding-bottom: 10px;
    margin-bottom: 10px;
    padding: 14px 20px 6px;
  }
  .ui-message-main{
    width: 100%;
    font-size: 0;
    position: relative;
    >img{
      width: 100%;
      height: 540px;
    }
    >video{
      width: 100%;
      max-height: 600px;
    }
    .v-textarea{
      width: 100%;
      max-height: 540px;
      overflow-y: auto;
      padding: 30px 50px;
      text-align: left;
      >span{
        font-size: 14px;
        word-break: break-all;
        color: #202020;
        display: inline-block;
        line-height: 1.5;
      }
    }

    .v-audio{
      margin: 20px 50px;
      max-height: 540px;
      overflow-y: auto;
      padding: 20px 15px;
      text-align: left;
      border: 1px solid #909090;
      >span{
        font-size: 14px;
        color: #202020;
      }
    }
    
  }
  .ui-message-footer{
    width: 100%;
    .btn{
      width: 80%;
      display: flex;
      justify-content: center;
      margin: 0 auto;
      .ui-button{
        max-width: 104px;
      }
    }

  }
}

.txtui-confirm{
  width: 430px;
   .ui-message-header{
    border-bottom: 1px solid #EBEBEB;
    padding: 12px 20px 12px 30px;
    >span{
      margin: 0;
    }
  }
  .ui-message-main{
    width: 330px;
    margin: 20px auto;
    padding: 0;
    background: #fff;
    .v-textarea{
      padding: 0;
    }
  }
}
</style>

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