<template>
  <div class="finish-container">
    <h1 class="title">{{ examInfo.name }}</h1>
    <p class="text">感谢您完成考试</p>
    <img src="../assets/images/end-bg.png" />
    <div class="pop" v-if="popVisible">
      <div class="pop-inner">
        <h3 class="pop-title">提示</h3>
        <div class="pop-content">
          <div class="pop-progress"></div>
        </div>
        <div class="pop-text">系统交卷中，请不要关闭页面…</div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      popVisible: false
    }
  },
  computed: {
    examInfo() {
      return this.$store.state.examInfo || {}
    },
    examId() {
      return this.examInfo.exam_id
    }
  },
  mounted() {
    setTimeout(() => {
      this.$router.replace({ name: 'login', params: { examId: this.examId }, query: this.$route.query })
    }, 5000)
  }
}
</script>
<style lang="scss" scoped>
.pop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  .pop-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 342px;
    height: 220px;
    background: #ffffff;
    border-radius: 5px;
  }
  .pop-content {
    width: 250px;
    height: 10px;
    background: #eeeeee;
    border-radius: 5px;
    margin: 50px auto;
    overflow: hidden;
  }
  .pop-progress {
    animation: 4s widthFull;
    height: 10px;
    background: #428aff;
    border-radius: 5px;
  }
  .pop-text {
    font-size: 14px;
    color: #262626;
    line-height: 20px;
    text-align: center;
  }
  .pop-title {
    text-align: center;
    padding-top: 20px;
    font-size: 18px;
    font-weight: bold;
    color: #222222;
    line-height: 18px;
  }
}

@keyframes widthFull {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}
.finish-container {
  width: 100%;
  height: 100%;
  background: linear-gradient(360deg, #fcffff 0%, #e2f6ff 100%);
  .title {
    padding-top: 80px;
    text-align: center;
    font-size: 46px;
    font-weight: bold;
    color: #333333;
    line-height: 65px;
    letter-spacing: 2px;
  }
  .text {
    text-align: center;
    margin-top: 10px;
    font-size: 24px;
    color: #666666;
    line-height: 33px;
    letter-spacing: 2px;
    margin-bottom: 40px;
  }
  img {
    display: block;
    margin: 0 auto;
    height: 60%;
  }
}
</style>
