mayf
2024-09-02 d3e09bace1db01d68a9a7a434c07b4331e1b15b7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<template>
  <div class="error-page">
    <img class="error-page__img" src="~static/images/error.png" />
    <template v-if="error.statusCode === 404">
      <div class="error-page__title">404</div>
      <div class="error-page__desc">页面不存在</div>
      <el-button plain @click="goHome">返回首页</el-button>
    </template>
    <template v-if="error.statusCode === 401">
      <div class="error-page__title">401</div>
      <div class="error-page__desc">对不起,您没有权限访问</div>
      <el-button plain @click="goHome">返回首页</el-button>
    </template>
    <template v-if="error.statusCode === 500">
      <div class="error-page__title">500</div>
      <div class="error-page__desc">服务器内部错误,请稍后访问</div>
      <el-button plain @click="reloadPage">刷新页面</el-button>
    </template>
  </div>
</template>
 
<script>
export default {
  layout: 'empty',
  // eslint-disable-next-line
  props: ['error'],
  methods: {
    goHome() {
      this.$router.replace('/')
    },
    reloadPage() {
      window.location.reload()
    },
  },
}
</script>
 
<style scoped lang="scss">
.error-page {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  &__img {
    width: 300px;
  }
  &__title {
    font-size: 50px;
    color: $main-title-color;
    font-weight: bold;
    margin-top: 20px;
  }
  &__desc {
    font-size: 14px;
    color: #666;
  }
  .el-button {
    margin-top: 30px;
    width: 100px;
  }
}
</style>