<template>
  <div class="mask" v-show="show">
    <div>
      <div class="dialog">
        <div class="title">
          <span>考试确认窗口</span>
        </div>
        <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>1.点击【继续考试】,将关闭本窗口,继续考试！</span>
          </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>
.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: 400px;
    height: 210px;
    background: #fff;
    .title {
      width: 100%;
      line-height: 40px;
      height: 40px;
      background: #498ef5;
      color: #fff;
      font-size: 14px;
    }
    .mid {
      width: 100%;
      background: #fff;
      height: 120px;
      padding-left: 10px;
      padding-right: 10px;
      .mid-line1 {
        line-height: 25px;
        height: 25px;
        text-align: left;
      }
      .mid-line2 {
        text-align: left;
        line-height: 30px;
      }
      .mid-line3 {
        text-align: left;
        line-height: 30px;
      }
      .mid-line4 {
        text-align: left;
        line-height: 30px;
      }
    }
    .bottom {
      background: #498ef5;
      width: 100%;
      height: 50px;
      display: flex;
      justify-content: center;
      align-content: center;
      align-items: center;
      button:nth-child(1) {
        height: 30px;
        margin-right: 30px;
      }
      button:nth-child(2) {
        height: 30px;
      }
    }
  }
}
</style>