Skip to content

Commit

Permalink
feat(views): ✨ error
Browse files Browse the repository at this point in the history
- 添加403、404、500异常页面
  • Loading branch information
jsxiaosi committed Aug 5, 2023
1 parent 319bdeb commit 430fc45
Show file tree
Hide file tree
Showing 14 changed files with 284 additions and 232 deletions.
Binary file removed src/assets/404_images/404.png
Binary file not shown.
Binary file removed src/assets/404_images/404_cloud.png
Binary file not shown.
29 changes: 29 additions & 0 deletions src/assets/icons/error/403.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/assets/icons/error/404.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions src/assets/icons/error/500.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/SvgIcon/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
}
.svg-icon {
display: block;
height: 1em;
line-height: 1em;
font-size: 1em;
Expand Down
17 changes: 17 additions & 0 deletions src/locales/en/modules/errorPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const errorPage = {
error403: {
title: 'No Access',
description: 'Sorry, access to this resource on the server is denied.',
},
error404: {
title: 'Page Not Found',
description: "Sorry, the page you're looking for cannot be accessed.",
},
error500: {
title: 'the server is reporting an error.',
description: 'An unexpected error occurred and your request could not be completed.',
},
back: 'Back Home',
};

export default errorPage;
2 changes: 2 additions & 0 deletions src/locales/en/modules/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ const route = {
testPermissionsPage2: 'Test Permissions',
detailsPage: 'DetailsPage',
error: 'error',
error403: '403',
error404: '404',
error500: '500',
thirdParty: 'Third party',
nested: 'Nested Route',
nested1: 'Route1',
Expand Down
17 changes: 17 additions & 0 deletions src/locales/zh-ch/modules/errorPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const errorPage = {
error403: {
title: '禁止访问',
description: '抱歉,访问服务器上的此资源被拒绝。',
},
error404: {
title: '找不到网页',
description: '抱歉,您要查找的页面无法访问。',
},
error500: {
title: '服务器报告错误。',
description: '抱歉,发生意外错误,无法完成您的请求。',
},
back: '返回首页',
};

export default errorPage;
4 changes: 3 additions & 1 deletion src/locales/zh-ch/modules/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ const route = {
testPermissionsPage1: 'Admin权限测试页面',
testPermissionsPage2: 'Test权限测试页面',
detailsPage: '详情页',
error: 'error',
error: '异常页面',
error403: '403',
error404: '404',
error500: '500',
thirdParty: '第三方',
nested: '嵌套路由',
nested1: '路由1',
Expand Down
12 changes: 12 additions & 0 deletions src/router/modules/error/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,24 @@ const error: AppRouteRecordRaw[] = [
whiteList: true,
},
children: [
{
path: '403',
name: '403',
component: () => import('@/views/error/403.vue'),
meta: { title: t('route.pathName.error403') },
},
{
path: '404',
name: '404',
component: () => import('@/views/error/404.vue'),
meta: { title: t('route.pathName.error404') },
},
{
path: '500',
name: '500',
component: () => import('@/views/error/500.vue'),
meta: { title: t('route.pathName.error500') },
},
],
},
];
Expand Down
Loading

0 comments on commit 430fc45

Please sign in to comment.