<template>
  <view>
    <view>
      <view class="relative" v-if="video?.videoUrl">
        <video
          :src="video.videoUrl"
          play-btn-position="center"
          class="w-full h-650"
          object-fit="contain"
          :poster="video.imagesUrl"
          :enable-play-gesture="true"
        ></video>
        <view
          class="absolute top-3 left-3 text-white bg-black bg-opacity-50 px-2 py-1 rounded z-10"
        >
          {{ timeFormat(video.operateDate, 'yyyy-mm-dd hh:MM') }}
        </view>
      </view>
    </view>
    <view class="mx-2.5 pb-10">
      <VideoList type="detail" />
    </view>
  </view>
</template>

<script setup>
  import { onLoad } from '@dcloudio/uni-app'
  import { ref } from 'vue'
  import { timeFormat } from 'uview-plus'
  import VideoList from './VideoList.vue'

  const video = ref(null)

  onLoad(options => {
    video.value = JSON.parse(options.video)
    console.log(video.value)
  })
</script>
