<template>
  <div class="app-container">
    <div class="headTitle">现场直播</div>
    <div class="time" id="time">{{ time }}</div>
    <div class="date" id="date">{{ date }}</div>
    <div class="logo"></div>
    <div class="videoItem" style="top: 14.8%;left: 3.5%;">
      <div>
        <div class="time1">{{ time1 }}</div>
        <video autoplay="" muted="" loop="loop">
          <source src="@/assets/model/live/v1.mp4" type="video/mp4">
          您的浏览器不支持 video 标签。
        </video>
      </div>
    </div>
    <div class="videoItem" style="top: 14.8%;left:35%">
      <div>
        <div class="time1">{{ time1 }}</div>
        <video autoplay="" muted="" loop="loop">
          <source src="@/assets/model/live/v1.mp4" type="video/mp4">
          您的浏览器不支持 video 标签。
        </video>
      </div>
    </div>
    <div class="videoItem" style="top: 14.8%;left:66.4%">
      <div>
        <div class="time1">{{ time1 }}</div>
        <video autoplay="" muted="" loop="loop">
          <source src="@/assets/model/live/v1.mp4" type="video/mp4">
          您的浏览器不支持 video 标签。
        </video>
      </div>
    </div>
    <div class="videoItem" style="top: 59%;left:3.5%">
      <div>
        <div class="time1">{{ time1 }}</div>
        <video autoplay="" muted="" loop="loop">
          <source src="@/assets/model/live/v1.mp4" type="video/mp4">
          您的浏览器不支持 video 标签。
        </video>
      </div>
    </div>
    <div class="videoItem" style="top: 59%;left:35%">
      <div>
        <div class="time1">{{ time1 }}</div>
        <video autoplay="" muted="" loop="loop">
          <source src="@/assets/model/live/v1.mp4" type="video/mp4">
          您的浏览器不支持 video 标签。
        </video>
      </div>
    </div>
    <div class="videoItem" style="top: 59%;left:66.4%">
      <div>
        <div class="time1">{{ time1 }}</div>
        <video autoplay="" muted="" loop="loop">
          <source src="@/assets/model/live/v1.mp4" type="video/mp4">
          您的浏览器不支持 video 标签。
        </video>
      </div>
    </div>
    <div class="exit" @click="exitFun"></div>
  </div>
</template>

<script>

let getDateIntervalFun = null
export default {
  name: "Liner",
  props: {
    exit: {
      type: Function,
      default: null
    }
  },
  data() {
    return {
      time: '',
      time1: '',
      date: ''
    }
  },
  created() {
    const getDate = () => {
      let date = new Date()
      let YYYY = date.getFullYear()
      let MM = (date.getMonth() + 1).toString().length === 1 ? ('0' + (date.getMonth() + 1)) : (date.getMonth() + 1)
      let dd = date.getDate().toString().length === 1 ? ('0' + date.getDate()) : date.getDate()
      let HH = date.getHours().toString().length === 1 ? ('0' + date.getHours()) : date.getHours()
      let mm = date.getMinutes().toString().length === 1 ? ('0' + date.getMinutes()) : date.getMinutes()
      let ss = date.getSeconds().toString().length === 1 ? ('0' + date.getSeconds()) : date.getSeconds()
      this.date = `${YYYY} - ${MM} - ${dd}`
      this.time = `${HH} : ${mm} : ${ss}`
      this.time1 = `${YYYY} - ${MM} - ${dd} ${HH} : ${mm} : ${ss}`
    }
    getDate()
    getDateIntervalFun = setInterval(getDate, 1000)
  },
  mounted() {
  },
  methods: {
    exitFun() {
      this.exit()
    }
  }
}
</script>
<style scoped lang="less">
.app-container {
  background-image: url("~@/assets/model/live/bg.jpg");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.logo {
  background-image: url("../../assets/board/logo.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  width: 6vw;
  height: 2.3vw;
  position: absolute;
  top: 1%;
  left: 1%;
}

.exit {
  background-image: url("~@/assets/model/factoryIntroduction/exit.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  position: absolute;
  top: 1%;
  right: 1%;
  font-weight: bold;
  width: 2vw;
  height: 2vw;
  color: #e7b219;
}

.time, .date {
  position: absolute;
  font-size: 0.8vw;
  color: #fcfcfc;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.time {
  top: 3.2%;
  left: 85.8%;
}

.date {
  top: 3.2%;
  left: 94.1%;
}

.headTitle {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translate(-50%, -100%);
  font-size: 1.5vw;
  color: #d6eaed;
  letter-spacing: 10px;
  font-family: "微软雅黑", serif;
}

.videoItem {
  position: absolute;
  width: 30%;
  height: 35.4%;
  div{
    position: absolute;
    top: 50%;
    transform: translateY(-50%);

    video {
      width: 100%;
    }

    .time1 {
      position: absolute;
      top: 0;
      right: 0;
      font-size: 0.6vw;
      color: #fff;
      transform: translateY(0);
    }
  }
}
</style>
