404.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <div class="error-container">
  3. <div class="error-content">
  4. <el-row :gutter="20">
  5. <el-col :lg="12" :md="12" :sm="24" :xl="12" :xs="24">
  6. <div class="pic-error">
  7. <el-image
  8. class="pic-error-parent"
  9. :src="require('@/assets/error_images/404.png')" />
  10. <el-image
  11. class="pic-error-child left"
  12. :src="require('@/assets/error_images/cloud.png')" />
  13. </div>
  14. </el-col>
  15. <el-col :lg="12" :md="12" :sm="24" :xl="12" :xs="24">
  16. <div class="bullshit">
  17. <div class="bullshit-oops">{{ oops }}</div>
  18. <div class="bullshit-headline">{{ headline }}</div>
  19. <div class="bullshit-info">{{ info }}</div>
  20. <router-link class="bullshit-return-home" to="/">
  21. {{ jumpTime }}s&nbsp;{{ btn }}
  22. </router-link>
  23. </div>
  24. </el-col>
  25. </el-row>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. import { mapActions, mapGetters } from 'vuex'
  31. export default {
  32. name: 'Page404',
  33. beforeRouteLeave(to, from, next) {
  34. this.delVisitedRoute(this.$route.path)
  35. clearInterval(this.timer)
  36. next()
  37. },
  38. data() {
  39. return {
  40. jumpTime: 5,
  41. oops: '抱歉!',
  42. headline: '当前页面不存在...',
  43. info: '请检查您输入的网址是否正确,或点击下面的按钮返回首页。',
  44. btn: '返回首页',
  45. timer: 0,
  46. }
  47. },
  48. computed: {
  49. ...mapGetters({
  50. visitedRoutes: 'tabs/visitedRoutes',
  51. }),
  52. },
  53. mounted() {
  54. this.timeChange()
  55. },
  56. methods: {
  57. ...mapActions({
  58. delVisitedRoute: 'tabs/delVisitedRoute',
  59. }),
  60. timeChange() {
  61. this.timer = setInterval(() => {
  62. if (this.jumpTime) {
  63. this.jumpTime--
  64. } else {
  65. this.delVisitedRoute(this.$route.path)
  66. this.$router.push('/')
  67. clearInterval(this.timer)
  68. }
  69. }, 1000)
  70. },
  71. },
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. .error-container {
  76. position: relative;
  77. min-height: 100vh;
  78. .error-content {
  79. position: absolute;
  80. top: 55%;
  81. left: 50%;
  82. width: 40vw;
  83. height: 400px;
  84. transform: translate(-50%, -50%);
  85. .pic-error {
  86. position: relative;
  87. float: left;
  88. width: 100%;
  89. overflow: hidden;
  90. &-parent {
  91. width: 100%;
  92. }
  93. &-child {
  94. position: absolute;
  95. &.left {
  96. top: 17px;
  97. left: 220px;
  98. width: 80px;
  99. opacity: 0;
  100. animation-name: cloudLeft;
  101. animation-duration: 2s;
  102. animation-timing-function: linear;
  103. animation-delay: 1s;
  104. animation-fill-mode: forwards;
  105. }
  106. @keyframes cloudLeft {
  107. 0% {
  108. top: 17px;
  109. left: 220px;
  110. opacity: 0;
  111. }
  112. 20% {
  113. top: 33px;
  114. left: 188px;
  115. opacity: 1;
  116. }
  117. 80% {
  118. top: 81px;
  119. left: 92px;
  120. opacity: 1;
  121. }
  122. 100% {
  123. top: 97px;
  124. left: 60px;
  125. opacity: 0;
  126. }
  127. }
  128. }
  129. }
  130. .bullshit {
  131. position: relative;
  132. float: left;
  133. width: 300px;
  134. padding: 30px 0;
  135. overflow: hidden;
  136. &-oops {
  137. margin-bottom: 20px;
  138. font-size: 32px;
  139. font-weight: bold;
  140. line-height: 40px;
  141. color: $base-color-blue;
  142. opacity: 0;
  143. animation-name: slideUp;
  144. animation-duration: 0.5s;
  145. animation-fill-mode: forwards;
  146. }
  147. &-headline {
  148. margin-bottom: 10px;
  149. font-size: 20px;
  150. font-weight: bold;
  151. line-height: 24px;
  152. color: #222;
  153. opacity: 0;
  154. animation-name: slideUp;
  155. animation-duration: 0.5s;
  156. animation-delay: 0.1s;
  157. animation-fill-mode: forwards;
  158. }
  159. &-info {
  160. margin-bottom: 30px;
  161. font-size: 13px;
  162. line-height: 21px;
  163. color: $base-color-grey;
  164. opacity: 0;
  165. animation-name: slideUp;
  166. animation-duration: 0.5s;
  167. animation-delay: 0.2s;
  168. animation-fill-mode: forwards;
  169. }
  170. &-return-home {
  171. display: block;
  172. float: left;
  173. width: 110px;
  174. height: 36px;
  175. font-size: 14px;
  176. line-height: 36px;
  177. color: #fff;
  178. text-align: center;
  179. cursor: pointer;
  180. background: $base-color-blue;
  181. border-radius: 100px;
  182. opacity: 0;
  183. animation-name: slideUp;
  184. animation-duration: 0.5s;
  185. animation-delay: 0.3s;
  186. animation-fill-mode: forwards;
  187. }
  188. @keyframes slideUp {
  189. 0% {
  190. opacity: 0;
  191. transform: translateY(60px);
  192. }
  193. 100% {
  194. opacity: 1;
  195. transform: translateY(0);
  196. }
  197. }
  198. }
  199. }
  200. }
  201. </style>