<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"></div>
    </div>
    <div style="margin-top: 12px; overflow: auto; height: 448px">
      <ul>
        <li v-for="(item, index) in studentList" :key="index">
          <div class="left">
            <el-image :src="item.faceUrl" fit="cover" :preview-src-list="[item.faceUrl]"></el-image>
            <!-- <img :src="item.faceUrl" alt="" /> -->
          </div>
          <div class="right">
            <div class="name">{{ item.name }}</div>
            <div class="stucode">学号：{{ item.personId }}</div>
            <div class="enterTime">进班时间：{{ item.insTime }}</div>
            <div class="statusBox">
              <div class="status" :style="{ backgroundColor: item.state != '正常' ? '#9a112c' : '#123CA0' }">
                <div class="circle"></div>
                <div>{{ item.state }}</div>
              </div>
              <img v-if="item.state != '正常'" src="/static/screen/img/redLight.png" alt="" />
            </div>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>
<script setup>
const props = defineProps({
  screenData: {}
});
const studentList = ref([]);
onMounted(() => {
  init();
});
const init = () => {
  studentList.value = props.screenData.studentList;
  studentList.value = studentList.value.map(e => {
    e.faceUrl = e.faces.length ? e.faces[0].faceUrl : "";
    return e;
  });
};
defineExpose({
  init
});
</script>
<style scoped lang="scss">
ul {
  display: flex;
  flex-wrap: wrap;
  li {
    display: flex;
    width: 398.372px;
    height: 121px;
    background: #182665;
    margin-right: 26px;
    margin-bottom: 28px;
    margin-top: 14px;
    margin-bottom: 14px;
    &:nth-child(3n) {
      margin-right: 0px;
    }
    .left {
      width: 131px;
      height: 100%;
      box-sizing: border-box;
      position: relative;
      padding-top: 14px;
      text-align: center;
      &::after {
        content: "";
        display: block;
        position: absolute;
        width: 1px;
        height: 93px;
        right: 0;
        top: 12px;
        background: #1848bc;
      }
      .el-image {
        height: 93px;
        width: 73px;
      }
    }
    .right {
      flex: 1;
      padding-left: 29px;
      padding-top: 15px;
      padding-right: 16px;
      .name {
        color: #fff;
        font-size: 14px;
        line-height: 1.5;
      }
      .stucode {
        color: #78dfff;
        font-size: 12px;
        line-height: 1.5;
        margin-top: 2px;
      }
      .enterTime {
        color: #78dfff;
        font-size: 12px;
        line-height: 1.5;
      }
      .statusBox {
        display: flex;
        justify-content: space-between;
        margin-top: 10px;
        .status {
          width: 82px;
          height: 22px;
          color: #fff;
          font-size: 12px;
          display: flex;
          justify-content: space-between;
          line-height: 20px;
          align-content: center;
          padding-left: 9px;
          padding-right: 16px;
          box-sizing: border-box;
        }
        img {
          width: 15px;
        }
      }
    }
  }
}
</style>