Commit 21a225c2b2423259cebce00ea8ccdf8750ae3b3a

Authored by vben
1 parent 0c28ffa8

chore: abnormal page adjustment

CHANGELOG.zh_CN.md
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 - 删除菜单背景图 10 - 删除菜单背景图
11 - 更新`ant-design-vue`版本为`beta13` 11 - 更新`ant-design-vue`版本为`beta13`
12 - 更新`vite`版本为`rc.9` 12 - 更新`vite`版本为`rc.9`
  13 +- 异常页调整
13 14
14 ### 🐛 Bug Fixes 15 ### 🐛 Bug Fixes
15 16
build/config/lessModifyVars.ts
@@ -17,8 +17,8 @@ const modifyVars = { @@ -17,8 +17,8 @@ const modifyVars = {
17 'background-color-base': '#F0F2F5', // background color 17 'background-color-base': '#F0F2F5', // background color
18 'font-size-base': '14px', // Main font size 18 'font-size-base': '14px', // Main font size
19 'box-shadow-base': '0 2px 8px rgba(0, 0, 0, 0.15)', // Floating shadow 19 'box-shadow-base': '0 2px 8px rgba(0, 0, 0, 0.15)', // Floating shadow
20 - 'border-color-base': '#cececd', // Border color,  
21 - 'border-color-split': '#cececd', // Border color, 20 + 'border-color-base': '#F0F0F0', // Border color,
  21 + 'border-color-split': '#F0F0F0', // Border color,
22 'border-radius-base': '2px', // Component/float fillet 22 'border-radius-base': '2px', // Component/float fillet
23 }; 23 };
24 //} 24 //}
src/assets/images/exception/404.png deleted 100644 → 0

14.6 KB

src/assets/images/exception/500.png deleted 100644 → 0

15.3 KB

src/components/Form/src/FormItem.tsx
@@ -193,18 +193,6 @@ export default defineComponent({ @@ -193,18 +193,6 @@ export default defineComponent({
193 const bindValue = { 193 const bindValue = {
194 [isCheck ? 'checked' : 'value']: (props.formModel as any)[field], 194 [isCheck ? 'checked' : 'value']: (props.formModel as any)[field],
195 }; 195 };
196 - // TODO先兼容antd的警告,后面官方修复后删除  
197 - if (component === 'Select') {  
198 - if (Reflect.has(propsData, 'options')) {  
199 - propsData.options = propsData.options.map((item: any) => {  
200 - return {  
201 - key: item.value,  
202 - ...item,  
203 - };  
204 - });  
205 - }  
206 - }  
207 -  
208 if (!renderComponentContent) { 196 if (!renderComponentContent) {
209 return <Comp {...propsData} {...on} {...bindValue} />; 197 return <Comp {...propsData} {...on} {...bindValue} />;
210 } 198 }
src/enums/exceptionEnum.ts
@@ -2,6 +2,9 @@ @@ -2,6 +2,9 @@
2 * @description: Exception related enumeration 2 * @description: Exception related enumeration
3 */ 3 */
4 export enum ExceptionEnum { 4 export enum ExceptionEnum {
  5 + // page not access
  6 + PAGE_NOT_ACCESS = 403,
  7 +
5 // page not found 8 // page not found
6 PAGE_NOT_FOUND = 404, 9 PAGE_NOT_FOUND = 404,
7 10
@@ -11,17 +14,8 @@ export enum ExceptionEnum { @@ -11,17 +14,8 @@ export enum ExceptionEnum {
11 // net work error 14 // net work error
12 NET_WORK_ERROR = 10000, 15 NET_WORK_ERROR = 10000,
13 16
14 - // net work timeout  
15 - NET_WORK_TIMEOUT = 10100,  
16 -  
17 - // not data  
18 - NOT_DATA = 10200,  
19 -  
20 - // The page loads too long and timeout  
21 - PAGE_TIMEOUT = 10300,  
22 -  
23 // No data on the page. In fact, it is not an exception page 17 // No data on the page. In fact, it is not an exception page
24 - PAGE_NOT_DATA = 10400, 18 + PAGE_NOT_DATA = 10100,
25 } 19 }
26 20
27 export enum ErrorTypeEnum { 21 export enum ErrorTypeEnum {
src/layouts/Logo.vue
@@ -83,7 +83,7 @@ @@ -83,7 +83,7 @@
83 83
84 .logo-title { 84 .logo-title {
85 font-size: 18px; 85 font-size: 18px;
86 - font-weight: 400; 86 + font-weight: 700;
87 opacity: 0; 87 opacity: 0;
88 transition: all 0.5s; 88 transition: all 0.5s;
89 .respond-to(medium,{ 89 .respond-to(medium,{
src/router/menus/modules/demo/exception.ts
@@ -6,6 +6,10 @@ const menu: MenuModule = { @@ -6,6 +6,10 @@ const menu: MenuModule = {
6 path: '/exception', 6 path: '/exception',
7 children: [ 7 children: [
8 { 8 {
  9 + path: '403',
  10 + name: '403',
  11 + },
  12 + {
9 path: '404', 13 path: '404',
10 name: '404', 14 name: '404',
11 }, 15 },
src/router/routes/modules/demo/exception.ts
@@ -19,6 +19,18 @@ export default { @@ -19,6 +19,18 @@ export default {
19 19
20 routes: [ 20 routes: [
21 { 21 {
  22 + path: '/403',
  23 + name: 'PageNotAccess',
  24 + component: ExceptionPage,
  25 + props: {
  26 + status: ExceptionEnum.PAGE_NOT_ACCESS,
  27 + },
  28 + meta: {
  29 + title: '403',
  30 + afterCloseLoading: true,
  31 + },
  32 + },
  33 + {
22 path: '/404', 34 path: '/404',
23 name: 'PageNotFound', 35 name: 'PageNotFound',
24 component: ExceptionPage, 36 component: ExceptionPage,
@@ -55,18 +67,6 @@ export default { @@ -55,18 +67,6 @@ export default {
55 }, 67 },
56 }, 68 },
57 { 69 {
58 - path: '/page-time-out',  
59 - name: 'PageTimeOut',  
60 - component: ExceptionPage,  
61 - props: {  
62 - status: ExceptionEnum.PAGE_TIMEOUT,  
63 - },  
64 - meta: {  
65 - title: '页面超时',  
66 - afterCloseLoading: true,  
67 - },  
68 - },  
69 - {  
70 path: '/not-data', 70 path: '/not-data',
71 name: 'NotData', 71 name: 'NotData',
72 component: ExceptionPage, 72 component: ExceptionPage,
src/settings/projectSetting.ts
@@ -4,7 +4,7 @@ import { MenuTypeEnum, MenuThemeEnum, MenuModeEnum } from &#39;/@/enums/menuEnum&#39;; @@ -4,7 +4,7 @@ import { MenuTypeEnum, MenuThemeEnum, MenuModeEnum } from &#39;/@/enums/menuEnum&#39;;
4 import { ContentEnum, PermissionModeEnum, RouterTransitionEnum } from '/@/enums/appEnum'; 4 import { ContentEnum, PermissionModeEnum, RouterTransitionEnum } from '/@/enums/appEnum';
5 import { primaryColor } from '../../build/config/lessModifyVars'; 5 import { primaryColor } from '../../build/config/lessModifyVars';
6 import { isProdMode } from '/@/utils/env'; 6 import { isProdMode } from '/@/utils/env';
7 -// ! 改动后需要清空浏览器缓存 7 +// ! You need to clear the browser cache after the change
8 const setting: ProjectConfig = { 8 const setting: ProjectConfig = {
9 // Whether to show the configuration button 9 // Whether to show the configuration button
10 showSettingButton: true, 10 showSettingButton: true,
src/views/sys/exception/Exception.tsx
@@ -6,8 +6,6 @@ import { defineComponent, ref, computed, unref } from &#39;vue&#39;; @@ -6,8 +6,6 @@ import { defineComponent, ref, computed, unref } from &#39;vue&#39;;
6 import { ExceptionEnum } from '/@/enums/exceptionEnum'; 6 import { ExceptionEnum } from '/@/enums/exceptionEnum';
7 7
8 import netWorkImg from '/@/assets/images/exception/net-work.png'; 8 import netWorkImg from '/@/assets/images/exception/net-work.png';
9 -import error404 from '/@/assets/images/exception/404.png';  
10 -import error500 from '/@/assets/images/exception/500.png';  
11 import notDataImg from '/@/assets/images/no-data.png'; 9 import notDataImg from '/@/assets/images/no-data.png';
12 10
13 import { useRoute } from 'vue-router'; 11 import { useRoute } from 'vue-router';
@@ -22,6 +20,7 @@ interface MapValue { @@ -22,6 +20,7 @@ interface MapValue {
22 btnText?: string; 20 btnText?: string;
23 icon?: string; 21 icon?: string;
24 handler?: Fn; 22 handler?: Fn;
  23 + status?: string;
25 } 24 }
26 25
27 export default defineComponent({ 26 export default defineComponent({
@@ -63,50 +62,52 @@ export default defineComponent({ @@ -63,50 +62,52 @@ export default defineComponent({
63 } 62 }
64 ); 63 );
65 64
  65 + unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_ACCESS, {
  66 + title: '403',
  67 + status: `${ExceptionEnum.PAGE_NOT_ACCESS}`,
  68 + subTitle: `Sorry, you don't have access to this page.!`,
  69 + btnText: props.full ? 'Back Login' : 'Back Home',
  70 + handler: () => (props.full ? go(PageEnum.BASE_LOGIN) : go()),
  71 + });
  72 +
66 unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_FOUND, { 73 unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_FOUND, {
67 title: '404', 74 title: '404',
68 - subTitle: '抱歉,您访问的页面不存在!',  
69 - btnText: props.full ? '返回登录' : '返回首页', 75 + status: `${ExceptionEnum.PAGE_NOT_FOUND}`,
  76 + subTitle: `Sorry, the page you visited does not exist.`,
  77 + btnText: props.full ? 'Back Login' : 'Back Home',
70 handler: () => (props.full ? go(PageEnum.BASE_LOGIN) : go()), 78 handler: () => (props.full ? go(PageEnum.BASE_LOGIN) : go()),
71 - icon: error404,  
72 }); 79 });
73 80
74 unref(statusMapRef).set(ExceptionEnum.ERROR, { 81 unref(statusMapRef).set(ExceptionEnum.ERROR, {
75 title: '500', 82 title: '500',
76 - subTitle: '抱歉,服务器出现异常!',  
77 - btnText: '返回首页', 83 + status: `${ExceptionEnum.ERROR}`,
  84 + subTitle: `Sorry, the server is reporting an error.`,
  85 + btnText: 'Back Home',
78 handler: () => go(), 86 handler: () => go(),
79 - icon: error500,  
80 }); 87 });
81 88
82 unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_DATA, { 89 unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_DATA, {
83 - title: '当前页面无数据', 90 + title: 'No data on the current page',
84 subTitle: '', 91 subTitle: '',
85 - btnText: '刷新', 92 + btnText: 'Refresh',
86 handler: () => redo(), 93 handler: () => redo(),
87 icon: notDataImg, 94 icon: notDataImg,
88 }); 95 });
89 96
90 unref(statusMapRef).set(ExceptionEnum.NET_WORK_ERROR, { 97 unref(statusMapRef).set(ExceptionEnum.NET_WORK_ERROR, {
91 - title: '网络错误',  
92 - subTitle: '抱歉,您的网络连接已断开,请检查您的网络!',  
93 - btnText: '刷新', 98 + title: 'Network Error',
  99 + subTitle: 'Sorry,Your network connection has been disconnected, please check your network!',
  100 + btnText: 'Refresh',
94 handler: () => redo(), 101 handler: () => redo(),
95 icon: netWorkImg, 102 icon: netWorkImg,
96 }); 103 });
97 104
98 - unref(statusMapRef).set(ExceptionEnum.PAGE_TIMEOUT, {  
99 - title: '页面加载失败',  
100 - subTitle: '抱歉,您的页面加载出错或者过久未响应,请检查您的网络!',  
101 - btnText: '刷新',  
102 - handler: () => redo(),  
103 - icon: netWorkImg,  
104 - });  
105 return () => { 105 return () => {
106 - const { title, subTitle, btnText, icon, handler } = unref(getMapValue) || {}; 106 + const { title, subTitle, btnText, icon, handler, status } = unref(getMapValue) || {};
107 return ( 107 return (
108 <Result 108 <Result
109 class="exception " 109 class="exception "
  110 + status={status as any}
110 title={props.title || title} 111 title={props.title || title}
111 sub-title={props.subTitle || subTitle} 112 sub-title={props.subTitle || subTitle}
112 > 113 >
@@ -117,7 +118,7 @@ export default defineComponent({ @@ -117,7 +118,7 @@ export default defineComponent({
117 {() => btnText} 118 {() => btnText}
118 </Button> 119 </Button>
119 ), 120 ),
120 - icon: () => icon && <img src={icon} />, 121 + icon: () => (icon ? <img src={icon} /> : null),
121 }} 122 }}
122 </Result> 123 </Result>
123 ); 124 );
src/views/sys/exception/LoadTimeOut.vue deleted 100644 → 0
1 -<template>  
2 - <Exception :status="ExceptionEnum.PAGE_TIMEOUT" />  
3 -</template>  
4 -<script lang="ts">  
5 - import { defineComponent } from 'vue';  
6 - import { Exception } from '/@/views/sys/exception';  
7 -  
8 - import { ExceptionEnum } from '/@/enums/exceptionEnum';  
9 -  
10 - export default defineComponent({  
11 - name: 'LoadTimeout',  
12 - components: { Exception },  
13 - setup() {  
14 - return { ExceptionEnum };  
15 - },  
16 - });  
17 -</script>  
src/views/sys/exception/index.ts
1 export { default as Exception } from './Exception'; 1 export { default as Exception } from './Exception';
2 -export { default as LoadTimeOut } from './LoadTimeOut.vue';