<template>
  <div style="width: 100%; height: 100%">
    <div class="commontitle">
      <div class="left">
        <span>学员课堂预警情况</span>
        <img src="/static/screen/img/titleIcon.png" alt="" />
      </div>
      <div class="right">
        <img src="/static/screen/img/redLight.png" alt="" />
        <span>预警数量（{{ alarmList.length }}）</span>
      </div>
    </div>
    <div style="height: 568px; margin-top: 4px; overflow: auto">
      <ul>
        <li v-for="item in alarmList" :key="item.id">
          <div class="name">{{ item.personName || "未知" }}</div>
          <div class="imgbox">
            <el-image :src="item.snapshotUrl" fit="cover" :preview-src-list="[item.snapshotUrl]"></el-image>
          </div>
          <div class="title">{{ item.alarmTypeDesc }}</div>
        </li>
      </ul>
      <div v-if="alarmList.length == 0" style="margin-top: 160px; font-size: 14px; color: #78dfff; text-align: center">暂无预警</div>
    </div>
  </div>
</template>
<script setup>
const props = defineProps({
  screenData: {}
});
const alarmList = ref([]);
onMounted(() => {
  init();
});
const init = () => {
  alarmList.value = props.screenData.alarmList || [];
};
defineExpose({
  init
});
</script>
<style scoped lang="scss">
.commontitle {
  .right {
    font-size: 14px;
    color: #ffa1a1;
    img {
      position: relative;
      top: 4px;
      right: 6px;
      width: 18px;
    }
  }
}
ul {
  display: flex;
  flex-wrap: wrap;
  li {
    box-sizing: border-box;
    width: 129.366px;
    height: 173.506px;
    padding: 0 10px;
    padding-top: 6px;
    margin-top: 7.8px;
    margin-right: 16px;
    margin-bottom: 7.8px;
    background: #182665;
    &:nth-child(7n) {
      margin-right: 0;
    }
    .name {
      font-size: 14px;
      color: #ffffff;
      text-align: center;
    }
    .imgbox {
      width: 109.702px;
      height: 112.44px;
      margin-top: 5px;
      text-align: center;
      object-fit: cover;
      .el-image {
        width: 100%;
        height: 100%;
      }
    }
    .title {
      width: 109.702px;
      height: 23px;
      font-size: 14px;
      line-height: 23px;
      color: #ffffff;
      text-align: center;
      background: #0c4dcf;
    }
  }
}
</style>
