<template>
  <div :class="classes">
    <div class="student-video">
      <flv-media
        ref="ThirdViewVideo"
        :live-url="data.liveUrl"
        v-if="data.liveUrl"
      ></flv-media>
    </div>
    <div class="student-info">
      <h6>
        <span>{{ data.name }}</span
        ><i class="icon icon-net-break"></i>
      </h6>
      <p>
        <span>证件号：</span><span>{{ data.identity }}</span>
      </p>
      <p>
        <span>答题进度：</span><span>{{ data.progress || 0 }}%</span>
      </p>
      <div class="student-time">
        <i class="icon icon-alarm-clock"></i>
        <span>{{ data.remainTime }}</span>
      </div>
    </div>
  </div>
</template>

<script>
import FlvMedia from "./FlvMedia";

export default {
  name: "invigilation-student",
  components: { FlvMedia },
  props: {
    data: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  data() {
    return {};
  },
  computed: {
    classes() {
      return [
        "invigilation-student",
        {
          "invigilation-student-breach": !this.data.breachStatus,
          "invigilation-student-netbreak": this.data.statusCode === "BREAK_OFF",
        },
      ];
    },
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
.invigilation-student {
  padding: 10px;
  position: relative;
  margin-bottom: 20px;
  border: 1px solid #f0f4f9;
  border-radius: 10px;

  &-breach {
    &::before {
      content: "";
      display: block;
      position: absolute;
      top: 0;
      left: 0;
      width: 50px;
      height: 50px;
      background-image: url(../../../assets/bg-discipline.png);
      background-size: 100% 100%;
      z-index: 99;
    }
    &::after {
      content: "";
      display: block;
      position: absolute;
      top: 4px;
      right: 4px;
      width: 12px;
      height: 12px;

      border: 2px solid #fff;
      border-radius: 50%;
      background: #fe5863;
      z-index: 99;
    }
  }

  &-netbreak {
    .icon-net-break {
      display: inline-block !important;
    }
    .student-time {
      background-color: #fe5863 !important;
    }
  }

  &-none {
    height: 100%;
    background: #606060;
    border-radius: 6px;
    font-size: 50px;
    text-align: center;
    padding-top: 90px;
    color: #202b4b;
  }
}
.student-video {
  height: 150px;
  border-radius: 6px;
  background: #626a82;
  margin-bottom: 20px;
  position: relative;

  &::before {
    content: "";
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 20px;
    margin-left: -16px;
    margin-top: -10px;
    background-image: url(../../../assets/icon-video.png);
    background-size: 100% 100%;
  }

  > video {
    width: 100%;
    height: 100%;
  }
}
.student-info {
  position: relative;
  padding: 0 10px 10px;
  .student-time {
    position: absolute;
    height: 24px;
    top: 0;
    right: 10px;
    padding: 4px 12px;
    border-radius: 12px;
    background: #abb8c9;
    color: #fff;
    line-height: 16px;
    font-size: 12px;
    > i {
      margin-right: 5px;
      width: 12px;
      height: 12px;
    }
    > span {
      display: inline-block;
      vertical-align: middle;
    }
  }

  > h6 {
    font-size: 18px;
    line-height: 25px;
    margin-bottom: 8;
    > .icon {
      margin-top: -4px;
      margin-left: 8px;
      display: none;
    }
  }
  > p {
    font-size: 14px;
    font-weight: 400;
    color: #626a82;
    line-height: 20px;
    margin: 0;
  }
}
</style>
