<template>
  <div class="end-box">
    <div class="title">{{ examInfo.name }}</div>
    <div class="text">感谢您完成考试</div>
    <img src="../../assets/images/end-bg.png" alt="">
    <div class="pop-progress" v-if="ispop">
      <div class="pop-con">
        <div class="tit">提示</div>
        <div class="count-box">
          <div class="anmi" :style="{width:width}"></div>
        </div>
        <div class="txt">系统交卷中，请不要关闭页面…</div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  metaInfo() {
    return {
      title: JSON.parse(window.localStorage.getItem('examInfo')).name || ''
    }
  },
  data() {
    return {
      width: '',
      ispop: '',
      examInfo: JSON.parse(window.localStorage.getItem('examInfo'))
    }
  },
  created() {
    this.getsess()
  },
  methods: {
    getsess() {
      this.ispop = Boolean(window.localStorage.getItem('showflag'))
    }
  },
  mounted() {
    setTimeout(() => {
      this.width = '100%'
    }, 1000)
    setTimeout(() => {
      this.ispop = false
      window.localStorage.removeItem('showflag')
      setTimeout(() => {
        this.$router.replace({
          path: `/login/${JSON.parse(window.localStorage.getItem('examInfo')).exam_id}`
        })
      }, 5000)
    }, 4000)
  }
}
</script>
<style lang="scss" scoped>
.end-box{
  .pop-progress{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:rgba(0,0,0,0.3);
    .pop-con{
      position: absolute;
      top: 50%;
      left: 50%;
      -webkit-transform: translate(-50%, -50%);
      width: 342px;
      height: 220px;
      background: #FFFFFF;
      border-radius: 5px;
      .count-box{
        width: 250px;
        height: 10px;
        background: #EEEEEE;
        border-radius: 5px;
        margin: 50px auto;
        overflow: hidden;
        .anmi{
          transition: all 3s;
          width: 0;
          height: 10px;
          background: #428AFF;
          border-radius: 5px;
        }
      }
      .txt{
        font-size: 14px;
        color: #262626;
        line-height: 20px;
        text-align: center;
      }
      .tit{
        text-align: center;
        padding-top: 20px;
        font-size: 18px;
        font-weight: bold;
        color: #222222;
        line-height: 18px;
      }
    }
  }
  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>
