index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div class="error-page">
  3. <h1 class="code">{{ code }}</h1>
  4. <p class="desc">{{ desc }}</p>
  5. <div class="router">
  6. <el-select filterable prefix-icon="el-icon-search" v-model="url">
  7. <el-option v-for="(item, index) in routes" :key="index" :value="item.path">
  8. <span style="float: left">{{ item.name }}</span>
  9. <span style="float: right">{{ item.path }}</span>
  10. </el-option>
  11. </el-select>
  12. <el-button size="medium" round @click="navTo">跳转</el-button>
  13. </div>
  14. <div class="link">
  15. <el-link class="to-home" @click="home">
  16. 回到首页
  17. </el-link>
  18. <el-link class="to-back" @click="back">返回上一页</el-link>
  19. <el-link class="to-login" @click="login">重新登录</el-link>
  20. </div>
  21. <p class="copyright">Copyright © x-admin 2020</p>
  22. </div>
  23. </template>
  24. <script>
  25. import { mapGetters } from 'vuex';
  26. export default {
  27. props: {
  28. code: Number,
  29. desc: String
  30. },
  31. data() {
  32. return {
  33. url: ''
  34. };
  35. },
  36. computed: {
  37. ...mapGetters(['routes'])
  38. },
  39. methods: {
  40. navTo() {
  41. this.$router.push(this.url);
  42. },
  43. back() {
  44. history.back();
  45. },
  46. home() {
  47. this.$router.push('/');
  48. },
  49. login() {
  50. this.$store.dispatch('userLogout');
  51. setTimeout(() => {
  52. this.$router.push('/login');
  53. }, 30);
  54. }
  55. }
  56. };
  57. </script>
  58. <style lang="stylus" scoped>
  59. .error-page {
  60. display: flex;
  61. flex-direction: column;
  62. justify-content: center;
  63. align-items: center;
  64. overflow-y: auto;
  65. height: 100%;
  66. .code {
  67. font-size: 120px;
  68. font-weight: normal;
  69. color: #6C757D;
  70. font-family: 'Segoe UI';
  71. }
  72. .desc {
  73. font-size: 16px;
  74. font-weight: 400;
  75. color: #34395e;
  76. margin-top: 30px;
  77. }
  78. .router {
  79. margin-top: 50px;
  80. display: flex;
  81. .el-select {
  82. font-size: 14px;
  83. width: 300px;
  84. }
  85. .el-button {
  86. margin-left: 15px;
  87. box-shadow: 0 1px 6px $color2;
  88. background-color: $color2;
  89. border-color: $color2;
  90. color: #fff;
  91. padding: 0 25px;
  92. letter-spacing: 1px;
  93. }
  94. }
  95. .link {
  96. margin-top: 40px;
  97. a {
  98. color: $color;
  99. font-weight: 500;
  100. transition: all 0.5s;
  101. -webkit-transition: all 0.5s;
  102. cursor: pointer;
  103. font-size: 14px;
  104. margin: 0 15px;
  105. &:hover {
  106. color: $color2;
  107. }
  108. }
  109. }
  110. .copyright {
  111. color: #6c757d;
  112. margin-top: 90px;
  113. font-size: 14px;
  114. }
  115. }
  116. </style>