Skip to content

Commit 7cd7d2b

Browse files
vanoneanggongjs
authored andcommitted
feat(404): 新增404页面 (#124)
1 parent 262ea0a commit 7cd7d2b

5 files changed

Lines changed: 49 additions & 0 deletions

File tree

src/assets/img/error-page/404.png

31.5 KB
Loading

src/assets/img/error-page/logo.png

16.5 KB
Loading

src/config/stage/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ let homeRouter = [
2626
order: 1,
2727
right: ['查询所有日志'],
2828
},
29+
{
30+
title: '404',
31+
type: 'view',
32+
name: Symbol('404'),
33+
route: '/404',
34+
filePath: 'views/error-page/404.vue',
35+
inNav: false,
36+
icon: 'iconfont icon-rizhiguanli',
37+
},
2938
bookConfig,
3039
adminConfig,
3140
]

src/router/routes.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ const routes = [
1616
name: 'login',
1717
component: () => import('@/views/login/Login'),
1818
},
19+
{
20+
redirect: '/404',
21+
path: '*',
22+
},
1923
]
2024

2125
export default routes

src/views/error-page/404.vue

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<template>
2+
<div class="container" ref="container">
3+
<img class="page-404" src="../../assets/img/error-page/404.png" alt="">
4+
<img class="page-logo" src="../../assets/img/error-page/logo.png" alt="">
5+
</div>
6+
</template>
7+
8+
<script type="text/ecmascript-6">
9+
export default {
10+
mounted() {
11+
const headerHeight = 72
12+
const { clientHeight } = document.body
13+
this.$refs.container.style.height = `${clientHeight - headerHeight}px`
14+
},
15+
}
16+
</script>
17+
18+
<style scoped lang="scss">
19+
.container {
20+
display: flex;
21+
justify-content: center;
22+
align-items: center;
23+
position: relative;
24+
.page-404 {
25+
width: 349px;
26+
height: 190px;
27+
}
28+
.page-logo {
29+
position: absolute;
30+
right: 40px;
31+
bottom: 40px;
32+
width: 60px;
33+
height: 98px;
34+
}
35+
}
36+
</style>

0 commit comments

Comments
 (0)