<!-- 企业视频 -->
<template>
  <div class="box">
    <div class="box-item" v-for="(val, i) in props.info.enterprise?.albumList" :key="val">
      <v-img v-if="checkIsImage(val)" width="205" height="115" :src="val" cover rounded @click="handleClick(i)"></v-img>
      <video v-else class="videos-radius" :src="val" controls height="118" width="200" preload="preload" @click="handleClick(i)"></video>
    </div>
  </div>
  <PreviewImg v-if="showPreview" :current="current" :list="props.info.enterprise?.albumList" @close="showPreview = !showPreview"></PreviewImg>
</template>

<script setup>
import { checkIsImage } from '@/utils'
import { ref } from 'vue'
defineOptions({name: 'enterprise-enterpriseCenter-video'})

const props = defineProps({
  info: {
    type: Object,
    default: () => {}
  }
})

// 预览
const showPreview = ref(false)
const current = ref(0)
const handleClick = (index) => {
  showPreview.value = !showPreview.value
  current.value = index
}
</script>
<style lang="scss" scoped>
.box {
  display: flex;
  flex-wrap: wrap;
  .box-item {
    margin: 0 12px 12px 0;
  }
}
</style>
