404.vue 4.6 KB

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