<template>
  <div class="app-container">
    <img
      :src="tempImage"
      class="error-img"
    >
    <div class="error-text">
      哎呀...您访问的页面不存在
    </div>
    <div class="countdown">
      将在
      <span id="countdown-number">
        {{ num }}
      </span>
      秒钟后返回首页，若未跳转，请
      <a href="/">
        点击跳转
      </a>
    </div>
  </div>
</template>

<script>
import image1 from '@/assets/404.png'

export default {
  name: 'Page404',
  data() {
    return {
      tempImage: image1,
      num: 3
    }
  },
  mounted() {
    let time = 3
    const interval = setInterval(() => {
      if (time === 0) {
        window.location.replace('/order')
        clearInterval(interval)
      }
      this.num = time
      console.log('jajajja', this.num)
      time--
    }, 1000)
  }
}
</script>

<style
  lang="scss"
  scoped
>
.app-container {
  text-align: center;
  padding-top: 20vh;
  box-sizing: border-box;
}

.error-img {
  max-width: 100vw !important;
  height: auto;
}

.error-text {
  font-size: 30px;
  margin-top: 20px;
  color: #9c9c9c;
}

.countdown {
  margin-top: 20px;
  color: #9c9c9c;
}

@media (max-width: 768px) {
  .error-text {
    font-size: 20px;
  }
}

</style>
