<template>
  <div class="modal">
    <div class="title">
      <div class="title-1">{{ props.nowPreviewRecord.name }}</div>
      <div class="title-2">
        {{
          props.nowPreviewRecord.createTime +
          ' ' +
          props.nowPreviewRecord.size +
          ' ' +
          props.nowPreviewRecord.id
        }}
      </div>
    </div>
    <div class="closeButton">
      <CloseOutlined @click="closeModal" style="font-size: 25px; color: white" />
    </div>
    <div class="mainBody">
      <div class="imgOrVideo">
        <!-- 图片 -->
        <div class="image" v-if="props.nowPreviewRecord.type == 'img'">
          <!-- <PreviewCanvas
            :nowPreviewRecord="props.nowPreviewRecord"
            :previewRecordList="props.previewRecordList"
            @chooseNowPreviewRecord="chooseNowPreviewRecord"
            @reloadTable="reloadTable"
          /> -->
          <PreviewImage
            :nowPreviewRecord="props.nowPreviewRecord"
            :previewRecordList="props.previewRecordList"
            @chooseNowPreviewRecord="chooseNowPreviewRecord"
            @reloadTable="reloadTable"
          />
        </div>
        <!-- VR全景 -->
        <!-- <div v-if="props.nowPreviewRecord.type == 'vr'">
          <PanoViewer />
        </div> -->
        <!-- 视频 -->
        <div class="video" v-if="props.nowPreviewRecord.type == 'video'">
          <PreviewVideo :nowPreviewRecord="props.nowPreviewRecord" />
        </div>
      </div>
      <div class="information">
        <PreviewInformation :nowPreviewRecord="props.nowPreviewRecord" @reloadTable="reloadTable" />
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
  import { ref } from 'vue';
  import { CloseOutlined } from '@ant-design/icons-vue';
  import { PreviewImage } from './preview';
  import { PreviewCanvas } from './preview';
  import { PreviewVideo } from './preview';
  import { PreviewInformation } from './preview';
  import { PanoViewer } from './preview';

  const props = defineProps(['nowPreviewRecord', 'previewRecordList']);
  const emit = defineEmits(['closeModal', 'chooseNowPreviewRecord', 'reloadTable']);

  console.log(props.nowPreviewRecord);

  // 选择
  function chooseNowPreviewRecord(value) {
    emit('chooseNowPreviewRecord', value);
  }
  // 刷新表格
  function reloadTable() {
    emit('reloadTable');
  }
  // 关闭弹窗
  function closeModal() {
    emit('closeModal');
  }
</script>
<style lang="less">
  .modal {
    width: 100%;
    height: 1020px;

    // 页面不能被选中
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE/Edge */
    user-select: none;
  }
  .title {
    pointer-events: none;
    position: absolute;
    top: 10px;
    left: 15px;
    z-index: 100;

    .title-1 {
      font-size: 20px;
      color: #ffffff;
    }
    .title-2 {
      font-size: 16px;
      color: #f0f3f3;
    }
  }
  .closeButton {
    position: absolute;
    top: 10px;
    right: 15px;
    z-index: 50;
  }
  .mainBody {
    width: 100%;
    height: 1020px;
    display: flex;
    position: absolute;
    top: 0px;
    left: 0px;

    .imgOrVideo {
      width: 80%;
      height: 1020px;
      background: #101010;

      .image {
        // display: flex;
        // align-items: center;
        position: relative;
        justify-content: center;
        width: 100%;
        height: 100%;
      }
    }

    .information {
      position: relative;
      width: 20%;
      height: 100%;
      background: #1c1c1c;
    }
  }
</style>
