<template>
  <div>
    <div class="info">
      <div class="shape">
        <img :src="info.id_photo" alt="">
      </div>
      <div class="right">
        <div class="name">{{ info.name }}</div>
        <div class="code">{{ info.examinee_number }}</div>
      </div>
    </div>
    <div class="order-num">
      <template v-for="(item, index) in questionParams.question.question_items">
        <div :key="index" v-if="item.question_item_type != 5">
          <div class="tit">{{ item.question_item_title }}</div>
          <ul>
            <template v-for="(cItem, cIndex) in item.question_list">
              <!-- stu1已答  stu2当前  stu3标记 -->
              <li
                :key="cItem.q_order + '-' + cIndex"
                @click="goQuestion(cItem.q_order)"
                :class="questionParams.questionIndex + 1 === cItem.q_order
                  ? questionParams.answerRecord[item.question_item_id]
                    ? questionParams.answerRecord[item.question_item_id][cItem.id]
                      ? questionParams.answerRecord[item.question_item_id][cItem.id].answer.length !== 0
                        ? questionParams.answerRecord[item.question_item_id][cItem.id].sign
                          ? 'stu1 stu2 stu3'
                          : 'stu1 stu2'
                        : questionParams.answerRecord[item.question_item_id][cItem.id].sign
                          ? 'stu2 stu3'
                          : 'stu2'
                      : 'stu2'
                    : 'stu2'
                  : questionParams.answerRecord[item.question_item_id]
                    ? questionParams.answerRecord[item.question_item_id][cItem.id]
                      ? questionParams.answerRecord[item.question_item_id][cItem.id].answer.length !== 0
                        ? questionParams.answerRecord[item.question_item_id][cItem.id].sign
                          ? 'stu1 stu3'
                          : 'stu1'
                        : questionParams.answerRecord[item.question_item_id][cItem.id].sign
                          ? 'stu3'
                          : ''
                      : ''
                    : ''
                "
                >{{ cItem.q_order }}</li>
            </template>
          </ul>
        </div>
        <div :key="index" v-else>
          <div class="tit">{{ item.question_item_title }}</div>
          <ul>
            <template v-for="cItem in item.question_list">
              <template v-for="(lItem, lIndex) in cItem.list">
                <li
                  :key="lItem.q_order +'-'+ lIndex"
                  @click="goQuestion(lItem.q_order)"
                  :class="questionParams.questionIndex + 1 === lItem.q_order
                    ? questionParams.answerRecord[item.question_item_id]
                      ? questionParams.answerRecord[item.question_item_id][lItem.id]
                        ? questionParams.answerRecord[item.question_item_id][lItem.id].answer.length !== 0
                          ? questionParams.answerRecord[item.question_item_id][lItem.id].sign
                            ? 'stu1 stu2 stu3'
                            : 'stu1 stu2'
                          : questionParams.answerRecord[item.question_item_id][lItem.id].sign
                            ? 'stu2 stu3'
                            : 'stu2'
                        : 'stu2'
                      : 'stu2'
                    : questionParams.answerRecord[item.question_item_id]
                      ? questionParams.answerRecord[item.question_item_id][lItem.id]
                        ? questionParams.answerRecord[item.question_item_id][lItem.id].answer.length !== 0
                          ? questionParams.answerRecord[item.question_item_id][lItem.id].sign
                            ? 'stu1 stu3'
                            : 'stu1'
                          : questionParams.answerRecord[item.question_item_id][lItem.id].sign
                            ? 'stu3'
                            : ''
                        : ''
                      : ''
                    "
                  >{{ lItem.q_order }}</li>
              </template>
            </template>
          </ul>
        </div>
      </template>
    </div>
  </div>
</template>
<script>
import Bus from '../../components/common/bus.js'
export default {
  props: {
    questionParams: { type: Object, default: () => {} },
    info: { type: Object, default: () => {} }
  },
  mounted() {
    Bus.$on('monitoringChanges', target => {
      this.$forceUpdate()
    })
  },
  methods: {
    goQuestion(n) {
      this.questionParams.questionIndex = n - 1
    }
  }
}
</script>
<style lang="scss" scoped>
.info{
  display: flex;
  align-items: center;
  height: 100px;
  .shape{
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
  }
  img{
    width: 75px;
    // transform: scale(1);
    display: block;
  }
  .right{
    margin-left: 22px;
    .name{
      font-size: 18px;
      color: #222222;
      line-height: 25px;
    }
    .code{
      font-size: 14px;
      color: #222222;
      line-height: 20px;
      margin-top: 5px;
    }
  }
}
.order-num{
  padding-bottom: 90px;
  .tit{
    font-size: 12px;
    color: #999999;
    line-height: 17px;
    margin-bottom: 10px;
  }
  ul{
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
    li{
      cursor: pointer;
      position: relative;
      border-radius: 50px;
      width: 24px;
      height: 24px;
      border: 1px solid #CCCCCC;
      font-size: 14px;
      color: #666666;
      line-height: 24px;
      margin-right: 20px;
      margin-bottom: 10px;
      text-align: center;
      &:nth-child(5n+5){
        margin-right: 0;
      }
      &.stu1{
        background: #EEEEEE;
        border: 1px solid #CCCCCC;
      }
      &.stu2{
        border: 2px solid #0FC118;
      }
      &.stu3{
        &::after{
          content: '';
          position: absolute;
          top: -1px;
          right: -1px;
          width: 4px;
          height: 4px;
          background: #C01540;
          border-radius: 50%;
        }
      }
    }
  }
}
.flag-tips{
  width: 260px;
  position: fixed;
  bottom: 60px;
  right:0;
  display: flex;
  justify-content: space-around;
  padding: 15px 0 10px;
  background: #fff;
  margin: 0;
  list-style: none;
  li{
    .circle1{
      width: 24px;
      height: 24px;
      background: #EEEEEE;
      border: 1px solid #CCCCCC;
      border-radius: 50%;
    }
    .circle1{
      width: 24px;
      height: 24px;
      border: 1px solid #CCCCCC;
      border-radius: 50%;
    }
    .circle2{
      width: 24px;
      height: 24px;
      border: 1px solid #CCCCCC;
      border-radius: 50%;
    }
    .circle3{
      width: 24px;
      height: 24px;
      border: 2px solid #0FC118;
      border-radius: 50%;
    }
    .circle4{
      position: relative;
      width: 24px;
      height: 24px;
      border: 1px solid #CCCCCC;
      border-radius: 50%;
      &::after{
        content: '';
        position: absolute;
        top: -1px;
        right: -1px;
        width: 4px;
        height: 4px;
        background: #C01540;
        border-radius: 50%;
      }
    }
    .txt{
      margin-top: 5px;
      font-size: 12px;
      color: #CCCCCC;
      line-height: 17px;
    }
  }
}
</style>
