Skip to content

Commit

Permalink
feat: add 404、500、403 page
Browse files Browse the repository at this point in the history
  • Loading branch information
pumelotea committed Mar 10, 2022
1 parent e4f8094 commit 1c568a1
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 298 deletions.
316 changes: 18 additions & 298 deletions src/mock/routerData.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,64 +9,6 @@ const routerData = [
type: 'menu',
children: []
},
{
name: '数据',
path: '/data',
view: '',
isRouter: false,
isKeepalive: true,
icon:'ri-medal-line',
type: 'menu',
children: [
{
name: '原始数据',
path: '/raw',
view: '/data-raw/index.vue',
isRouter: true,
isKeepalive: true,
icon:'ri-cloud-fill',
type: 'menu',
children: []
},
{
name: '菜单数据',
path: '/menu',
view: '/data-menu/index.vue',
isRouter: true,
isKeepalive: true,
icon:'ri-bar-chart-2-fill',
type: 'menu',
children: []
},
{
name: '导航数据',
path: '/nav',
view: '/data-nav/index.vue',
isRouter: true,
isKeepalive: true,
type: 'menu',
children: []
},
{
name: '面包屑数据',
path: '/breadcrumb',
view: '/data-breadcrumb/index.vue',
isRouter: true,
isKeepalive: true,
type: 'menu',
children: []
},
]
},
{
name: '指纹',
path: '/fingerprint',
view: '/fingerprint/index.vue',
isRouter: true,
isKeepalive: true,
type: 'menu',
children: []
},
{
name: '权限',
path: '/permission',
Expand All @@ -77,264 +19,42 @@ const routerData = [
children: []
},
{
name: 'Security',
path: '/security',
name: '错误页面',
path: '/error',
view: '/security/index.vue',
isRouter: true,
isKeepalive: true,
type: 'menu',
children: []
},
{
name: '多层菜单',
path: '/demo',
view: '',
isRouter: false,
isKeepalive: false,
type: 'menu',
icon:'ri-error-warning-line',
children: [
{
name: '1-1',
path: '/links',
view: '',
isRouter: false,
isKeepalive: false,
type: 'menu',
children: [
{
name: '1-1-1',
path: '',
view: '',
isRouter: true,
isKeepalive: true,
externalLink: true, //外链
linkTarget: '_self', //刷新自己
externalLinkAddress: 'http://www.squirrelzoo.com',
type: 'menu',
children: []
},
{
name: '1-1-2',
path: '',
view: '',
isRouter: true,
isKeepalive: true,
externalLink: true, //外链
externalLinkAddress: 'http://www.squirrelzoo.com',
linkTarget: '_blank', //浏览器标签
type: 'menu',
children: []
},
{
name: '1-1-3',
path: '/squirrelzoo',
view: '/iframe',
isRouter: true,
isKeepalive: true,
externalLink: true, //外链
externalLinkAddress: 'http://www.squirrelzoo.com',
linkTarget: '_tab', //页内标签
type: 'menu',
children: []
},
{
name: '1-1-4',
path: '/baidu',
view: '/iframe',
isRouter: true,
isKeepalive: true,
externalLink: true, //外链
externalLinkAddress: 'http://www.baidu.com',
linkTarget: '_tab', //页内标签
type: 'menu',
children: []
}
]
},
{
name: '1-2',
path: '/user-mgt',
view: '',
isRouter: false,
isKeepalive: false,
type: 'menu',
children: [
{
name: '2-1',
path: '/adv',
view: '',
isRouter: false,
isKeepalive: false,
type: 'menu',
children: [
{
name: '2-1-1',
path: '/xxxxxx111',
view: '/role',
isRouter: true,
isKeepalive: false,
type: 'menu',
children: []
}
]
}
]
},
{
name: '1-3',
path: '',
view: '',
isRouter: false,
isKeepalive: false,
type: 'menu',
children: [
{
name: '3-1',
path: '/test/aaa',
view: '/role',
isRouter: true,
isKeepalive: false,
type: 'menu',
children: []
}
]
}
]
},
{
name: '两层菜单',
path: '/system',
view: '',
isRouter: false,
isKeepalive: false,
type: 'menu',
children: [
{
name: '1-1',
path: '/user',
view: '/user',
name: '404',
path: '/404',
view: '/error404/index.vue',
isRouter: true,
isKeepalive: false,
isKeepalive: true,
type: 'menu',
icon: 'ri-window-line',
children: []
},
{
name: '1-2',
path: '/role',
view: '/role',
name: '500',
path: '/500',
view: '/error500/index.vue',
isRouter: true,
isKeepalive: true,
type: 'menu',
children: [
{
name: '新增',
permissionKey: 'add',
path: '',
view: '',
isRouter: false,
isKeepalive: false,
type: 'point',
children: []
},
{
name: '编辑弹出框取消',
permissionKey: 'cancel',
path: '',
view: '',
isRouter: false,
isKeepalive: false,
type: 'point',
children: []
}
]
},
{
name: '1-3',
path: '/department',
view: '/department',
isRouter: true,
isKeepalive: false,
type: 'menu',
children: [
{
name: '新增',
permissionKey: 'add',
path: '',
view: '',
isRouter: false,
isKeepalive: false,
type: 'point',
children: []
}
]
},
{
name: '1-4',
path: '/region',
view: '/region',
isRouter: true,
isKeepalive: false,
type: 'menu',
children: [
{
name: '新增',
permissionKey: 'add',
path: '',
view: '',
isRouter: false,
isKeepalive: false,
type: 'point',
children: []
}
]
},
{
name: '1-5',
path: '/menu',
view: '/menu',
isRouter: true,
isKeepalive: false,
type: 'menu',
children: [
{
name: '新增',
permissionKey: 'add',
path: '',
view: '',
isRouter: false,
isKeepalive: false,
type: 'point',
children: []
}
]
},
{
name: '1-6',
path: '/log-report',
view: '/log-report',
isRouter: true,
isKeepalive: false,
type: 'menu',
icon: 'ri-window-line',
children: []
}
]
},
{
name: '隐藏路由1级',
path: '/hide',
view: '',
isRouter: false,
isKeepalive: false,
type: 'menu',
hide: true, //隐藏路由
children: [
},
{
name: '隐藏路由2级',
path: '/test',
view: '/hide',
name: '403',
path: '/403',
view: '/error403/index.vue',
isRouter: true,
isKeepalive: false,
isKeepalive: true,
type: 'menu',
icon: 'ri-window-line',
children: []
}
]
Expand Down
21 changes: 21 additions & 0 deletions src/views/error403/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script setup>
import {NResult,NSpace,NButton} from "naive-ui";
</script>
<template>
<n-space style="height: 100%" justify="center" align="center">
<n-result
size="huge"
status="403"
title="403 禁止访问"
description="总有些门是对你关闭的"
>
<template #footer>
<n-button>返回首页</n-button>
</template>
</n-result>
</n-space>
</template>

<style scoped>
</style>
16 changes: 16 additions & 0 deletions src/views/error404/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script setup>
import {NResult,NSpace,NButton} from "naive-ui";
</script>
<template>
<n-space style="height: 100%" justify="center" align="center">
<n-result size="huge" status="404" title="404 资源不存在" description="生活总归带点荒谬">
<template #footer>
<n-button>返回首页</n-button>
</template>
</n-result>
</n-space>
</template>

<style scoped>
</style>
Loading

0 comments on commit 1c568a1

Please sign in to comment.