<template>
  <div class="home-left">
    <div class="topI">
      <msg-card title="路口监控">
        <div class="videos">
          <local-camera
            ref="videoItem"
            class="videoItem"
            v-for="(item, index) of videos"
            :key="index"
            :video-data="item"
          />
          <span class="top-left"></span>
          <span class="top-right"></span>
          <span class="bottom-left"></span>
          <span class="bottom-right"></span>
        </div>
      </msg-card>
    </div>
    <div class="bottomI">
      <msg-card class="m-b-10" title="相位监测">
        <div class="messages">
          <div class="text-rows">
            <div class="row-item">
              <div class="left-key">检测时间段：</div>
              <div class="right-value">{{ content.timeBetween }}</div>
            </div>
            <div class="row-item">
              <div class="left-key">是否有冲突：</div>
              <div class="right-value">{{
                  content.ifConflict ? "有" : "无"
                }}</div>
            </div>
            <div class="row-item">
              <div class="left-key">冲突时长：</div>
              <div class="right-value">{{ content.duration }}s</div>
            </div>
            <div class="row-item">
              <div class="left-key">冲突成因：</div>
              <div class="right-value">{{ content.reason }}</div>
            </div>
          </div>
          <div class="message-describe">
            <div class="label">冲突方向：</div>
            <div class="value-image"></div>
          </div>
        </div>
      </msg-card>
    </div>
  </div>
</template>

<script>
import MsgCard from "../../../components/Standard/msg-card.vue";
import { getCameraListByType } from "../../../dao/api";
import LocalCamera from "../../../components/Standard/localCamera.vue";

export default {
  name: "homeLeft",
  components: { LocalCamera, MsgCard },
  computed: {
    videos(){
      return situation_straightLeftConflict.videos.slice(0, 1);
    }
  },
  data() {
    return {
      cameras: [],
      content: {
        timeBetween: "",
        ifConflict: '',
        duration: '',
        reason: "",
      },
    };
  },
  mounted() {
    this.content = situation_straightLeftConflict.monitor
  },
  methods: {
    startVideo(time) {
      for (let item of this.$refs.videoItem) {
        item.setTime(time);
      }
    },
  },

  beforeDestroy() {},
};
</script>

<style lang="less" scoped>
.cTable {
  font-size: 16px;
  border-top: 1px solid rgba(62, 108, 150, 1);
  border-left: 1px solid rgba(62, 108, 150, 1);
  margin-bottom: 7px;

  .row1 {
    height: 30px;
    width: 100%;

    .col {
      display: flex;
      align-items: center;
      height: 100%;
      border-bottom: 1px solid rgba(62, 108, 150, 1);
      border-right: 1px solid rgba(62, 108, 150, 1);

      span {
        display: inline-block;
        height: 20px;
        padding: 0 3px;
        line-height: 20px;
        font-size: 14px;
        margin-left: 3px;
        border: 1px solid rgba(5, 122, 255, 0);
        border-radius: 8px;
      }

      .span-check {
        border: 1px solid rgba(5, 122, 255, 1);
      }
    }

    .deep {
      justify-content: center;
      background-color: rgba(46, 119, 255, 0.15);
    }
  }
}

.customTable {
  color: white;
  width: 100%;
  font-size: 16px;
  border-top: 1px solid rgba(62, 108, 150, 1);
  border-left: 1px solid rgba(62, 108, 150, 1);

  .row {
    display: flex;
    width: 100%;

    .col {
      border-bottom: 1px solid rgba(62, 108, 150, 1);
      border-right: 1px solid rgba(62, 108, 150, 1);
      height: 30px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .longT {
      height: 45px;
    }

    .col-label {
      width: 20%;
      background-color: rgba(46, 119, 255, 0.15);
    }

    .col-value {
      width: 80%;
      padding: 0 20px;
      justify-content: flex-start;
      background-color: transparent;
    }
  }
}

.top-left {
  position: absolute;
  left: -1px;
  top: -1px;
  padding: 10px;
  border-style: solid;
  border-color: rgba(24, 144, 255, 1);
  border-width: 2px 0 0 2px;
}

.top-right {
  position: absolute;
  right: -1px;
  top: -1px;
  padding: 10px;
  border-style: solid;
  border-color: rgba(24, 144, 255, 1);
  border-width: 2px 2px 0 0;
}

.bottom-left {
  position: absolute;
  right: -1px;
  bottom: -1px;
  padding: 10px;
  border-style: solid;
  border-color: rgba(24, 144, 255, 1);
  border-width: 0 2px 2px 0;
}

.bottom-right {
  position: absolute;
  left: -1px;
  bottom: -1px;
  padding: 10px;
  border-style: solid;
  border-color: rgba(24, 144, 255, 1);
  border-width: 0 0 2px 2px;
}

.msgTitle {
  font-size: 18px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  margin-bottom: 5px;

  span {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 3px solid #0d7fd7;
    rotate: 45deg;
    margin-right: 8px;
  }
}

.home-left {
  position: absolute;
  left: 0;
  top: 0;
  color: white;
  height: 100%;
  width: 668px;
  background-color: rgba(3, 11, 25, 0.45);
  // background-image: linear-gradient(90deg, rgba(8, 20, 31, 0) 0%, rgba(6, 16, 26, 1) 100%);
  padding: 15px 25px;
  display: flex;
  flex-direction: column;

  .topI {
    height: 35%;
    margin-bottom: 15px;

    .videos {
      display: flex;
      justify-content: center;
      align-content: space-between;
      align-items: stretch;
      position: relative;
      flex-flow: row wrap;
      height: 100%;

      .videoItem {
        height: 100%;
        width: 100%;
        aspect-ratio: 4/3;
        position: relative;
      }
    }
  }

  .bottomI {
    .messages {
      font-size: 18px;
      display: flex;
      height: 100%;
      flex-direction: column;
      padding: 10px 15px;
      justify-content: space-around;
      .text-rows{
        .row-item{
          display: flex;
          align-items: flex-start;
          margin-bottom: 12px;
          .left-key{
            white-space: nowrap;
            color: rgba(217, 229, 255, 1);
            margin-right: 5px;
          }
        }
        .row-item:last-child{
          margin-bottom: 0;
        }
      }

      .message-describe {
        .value-image {
          display: flex;
          justify-content: center;
          margin-top: 12px;
          width: 100%;
          height: 320px;
          background-image: url("../../../assets/images/sc/zz.png");
          background-size: auto 100%;
          background-position: center;
          background-repeat: no-repeat;
          // border: 1px solid #0d7fd7;
        }
      }
    }
  }
}

.m-b-10 {
  margin-bottom: 10px;
}
</style>
