<template>
  <div class="mask" v-show="show">
    <div>
      <div class="dialog">
        <div class="title">
          <span>考试确认窗口</span>
        </div>
        <div class="" style="background: #306ace">
          <div class="mid">
            <div class="mid-line1">操作提示：</div>
            <div class="mid-line2">
              你当前考试答对{{ correctScore }}题，答错{{ errorScore }}题，未答{{
                total - correctScore - errorScore
              }}题
            </div>
            <div class="mid-line3">
              <span>1.点击【确认交卷】,将提交考试成绩,结束考试！</span>
            </div>
            <div class="mid-line4">
              <span>2.点击【继续考试】,将关闭本窗口,继续考试！</span>
            </div>
          </div>
        </div>

        <div class="bottom">
          <button @click="sendPaper">确认交卷</button>
          <button @click="cancelSubmit">继续考试</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { defineProps, reactive, toRefs } from 'vue';

export default {
  setup(props, { emit }) {
    const state = reactive({
      count: 0,
    });
    const sendPaper = () => {
      emit('confirm');
    };
    const cancelSubmit = () => {
      emit('cancel');
    };

    return {
      ...toRefs(state),
      props,
      sendPaper,
      cancelSubmit,
    };
  },
  props: {
    show: {
      type: Boolean,
      required: true,
      default: false,
    },
    correctScore: {
      type: Number,
      required: true,
      default: 0,
    },
    errorScore: {
      type: Number,
      required: true,
      default: 0,
    },
    total: {
      type: Number,
      required: true,
      default: 0,
    },
  },
};
</script>

<style lang="scss" scoped>
button {
  border-radius: 0;
  border: none;
}
.mask {
  position: fixed;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgb(0, 0, 0, 0.65);
  z-index: 10;
  display: flex;
  align-content: center;
  align-items: center;
  justify-content: center;
  .dialog {
    width: 381px;
    height: 210px;
    background: #fff;
    .title {
      width: 100%;
      line-height: 40px;
      height: 40px;
      background: #306ace;
      color: #fff;
      font-size: 14px;
      font-weight: 700;
    }
    .mid {
      width: 350px;
      margin: 0 auto;
      background: #fff;
      height: 115px;
      font-size: 14px;
      padding-left: 18px;
      padding-top: 14px;
      font-size: 13px;
      // padding-right: 10px;
      .mid-line1 {
        line-height: 25px;
        height: 25px;
        text-align: left;
        line-height: 25px;
      }
      .mid-line2 {
        text-align: left;
        line-height: 25px;
      }
      .mid-line3 {
        text-align: left;
        line-height: 25px;
      }
      .mid-line4 {
        text-align: left;
        line-height: 25px;
      }
    }
    .bottom {
      background: #306ace;
      width: 100%;
      height: 59px;
      display: flex;
      justify-content: center;
      align-content: center;
      align-items: center;
      button:nth-child(1) {
        height: 38px;
        margin-right: 27px;
      }
      button:nth-child(2) {
        height: 38px;
      }
    }
  }
}
</style>