<template>
    <popup v-if="show">
      <div class="ui-message ui-message-confirm" 
      :style="{width:`${item.hotspotType=='audio'?'960px':'1200px'}`}">
        <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',
    }
    return {
      typeStr
    }
  },
  methods:{
    
  }
}
</script>

<style lang="less" scoped>
.ui-message-confirm{
  border-radius: 0;
  top: auto;
  left: auto;
  transform: none;
  .icon_close{
    color: #909090;
  }
  .ui-message-header{
    border-bottom: 1px solid #EBEBEB;
    padding-bottom: 10px;
    margin-bottom: 10px;
  }
  .ui-message-main{
    width: 100%;
    font-size: 0;
    position: relative;
    >img,>video{
      width: 100%;
      height: 540px;
    }
    .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;
      }
    }

  }
}
</style>

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