<template>
  <div class="content-wrapper">
    <div class="monitor-cctv video-windowcctv">
      <HikPlayerComponent ref="HikCCTV" v-if="visible" :cameraIndexCode="data.videoCode" id="cctv"/>
    </div>
  </div>
</template>

<script setup>
import { computed, nextTick, ref, watch } from 'vue'
import useMapStore from '@/store/modules/map'
import HikPlayerComponent from '@/components/Player/HikPlayer.vue'

const mapStore = useMapStore()
const visible = ref(false)
const data = computed(() => mapStore.windowInfo.data)
const HikCCTV = ref(null)

watch(() => data.value.videoCode, () => {
  visible.value = false
  nextTick(() => {
    visible.value = true
  })
}, { immediate: true })
defineExpose({
  HikCCTV
})
</script>

<style lang="scss" scoped>
.content-wrapper {
  width: 100%;
  height: 100%;
  overflow: auto;

  .list-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;

    .list-item {
      width: 100%;
      display: flex;
      height: 18px;
      align-items: center;

      .label {
        width: 100px;
        font-size: 14px;
        color: #00C0FFFF;
        text-align: left;
      }

      .value {
        color: #FFFFFFFF;
        font-size: 14px;
      }
    }
    .subtitle {
      width: 100%;
      height: 28px;
      background-color: #00C0FF33;
      color: #00C0FFFF;
      font-size: 14px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 4px;
      box-sizing: border-box;

      &::after {
        content: '';
        display: block;
        width: 14px;
        height: 14px;
        background-image: url('@/assets/images/common/icon-triangle.png');
        background-size: 100% 100%;
        background-repeat: no-repeat;
      }
    }
    .title{
      position: relative;
      .button{
        position: absolute;
        right: 0;
        top: -32px;
        cursor: pointer;
        color: #00c0ff;
        padding: 6px 10px;
        background: rgba(22, 119, 255, 0.21);
        border-radius: 2px 2px 2px 2px;
        border: 1px solid #236ACE;
        color: rgba(255, 255, 255, 0.9);
      }
    }
  }
  .list-wrapper {
    width: 100%;
    height: calc(100% - 50px);
    margin-top: 10px;
    overflow: auto;
    .header{
      width: 100%;
      height: 40px;
      background: linear-gradient( 0deg, rgba(10,167,255,0) 0%, rgba(22,115,255,0.5) 100%);
      border-radius: 3px 3px 0px 0px;
      display: flex;

      .header-label{
        font-size: 12px;
        color: #F4F9FECC;
        flex-shrink:0;
        display: flex;
        justify-content: center;
        align-items: center;
      }
    }

   .list {
    width: 100%;
    height: calc(100% - 50px);
    overflow: auto;
    .header{
      width: 100%;
      height: 40px;
      background: linear-gradient( 0deg, rgba(10,167,255,0) 0%, rgba(22,115,255,0.5) 100%);
      border-radius: 3px 3px 0px 0px;
      display: flex;

      .header-label{
        font-size: 12px;
        color: #F4F9FECC;
        flex-shrink:0;
        display: flex;
        justify-content: center;
        align-items: center;
      }
    }

    .item{
      width: 100%;
      height: 36px;
      display: flex;

      .row{
        position: relative;
        font-size: 12px;
        color: #fff;
        flex-shrink:0;
        display: flex;
        justify-content: center;
        align-items: center;
      }

      &:nth-of-type(odd){
        background: #2a64bb2b;
      }

      &:hover{
        background-image: url('@/assets/images/common/row-background-active.png');
        background-size: 100% 100%;
        background-repeat: no-repeat;
        .row.index::before{
          background: linear-gradient( 89deg, #00F0FF 0%, rgba(4,114,217,0) 100%);
        }
      }
    }
  }
  }
}
.monitor-cctv{
    min-height: 289px;
    width: 100%;
    height: -webkit-fill-available;
}
</style>=>