<template>
  <div class="tab_exam__header">
    <div class="title">{{ examInfo.examName }}</div>
    <div class="tab_box">
      <div class="text">
        已完成 <span>{{ num }}</span>/{{ allNum || examInfo.questionNum }} 道题
      </div>
      <div class="header_btns">
        <div class="btn" @click="$emit('prevQuestion')">上一题</div>
        <div class="btn" @click="$emit('nextQuestion')">下一题</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    examId: { type: String },
    num: {
      type: Number,
    },
    allNum: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      examInfo: {},
    };
  },
  mounted() {
    if (this.examId || this.$route.query.examId * 1) {
      this.$request
        .bankExam(this.examId || this.$route.query.examId)
        .then((res) => {
          console.log(res,666)
          this.examInfo = res.data;
        });
    }
  },
};
</script>

<style lang="scss" scoped>
.tab_exam__header {
  height: 60px;
  padding: 0 22px;
  border-bottom: 1px solid #eeeeee;
  display: flex;
  align-items: center;
  justify-content: space-between;

  .title {
    font-weight: 500;
    color: #222222;
    font-size: 16px;
  }

  .tab_box {
    display: flex;
    align-items: center;
  }

  .header_btns {
    display: flex;
    justify-content: space-around;
    align-items: center;
    border: 1px solid #3f8dfd;
    border-radius: 4px;

    .btn {
      cursor: pointer;
      width: 66px;
      height: 28px;
      background: #ffffff;
      line-height: 28px;
      text-align: center;
      color: #3f8dfd;
      border-radius: 4px;

      &:nth-of-type(2) {
        background: #3f8dfd;
        color: #ffffff;
        border-radius: 0;
      }
    }
  }

  .text {
    margin-right: 20px;
    font-size: 14px;

    span {
      font-family: Microsoft YaHei;
      font-weight: bold;
      color: #3f8dfd;
      line-height: 24px;
    }
  }
}
</style>
