提交 21a225c2 作者: vben

chore: abnormal page adjustment

上级 0c28ffa8
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
- 删除菜单背景图 - 删除菜单背景图
- 更新`ant-design-vue`版本为`beta13` - 更新`ant-design-vue`版本为`beta13`
- 更新`vite`版本为`rc.9` - 更新`vite`版本为`rc.9`
- 异常页调整
### 🐛 Bug Fixes ### 🐛 Bug Fixes
......
...@@ -17,8 +17,8 @@ const modifyVars = { ...@@ -17,8 +17,8 @@ const modifyVars = {
'background-color-base': '#F0F2F5', // background color 'background-color-base': '#F0F2F5', // background color
'font-size-base': '14px', // Main font size 'font-size-base': '14px', // Main font size
'box-shadow-base': '0 2px 8px rgba(0, 0, 0, 0.15)', // Floating shadow 'box-shadow-base': '0 2px 8px rgba(0, 0, 0, 0.15)', // Floating shadow
'border-color-base': '#cececd', // Border color, 'border-color-base': '#F0F0F0', // Border color,
'border-color-split': '#cececd', // Border color, 'border-color-split': '#F0F0F0', // Border color,
'border-radius-base': '2px', // Component/float fillet 'border-radius-base': '2px', // Component/float fillet
}; };
//} //}
......
...@@ -193,18 +193,6 @@ export default defineComponent({ ...@@ -193,18 +193,6 @@ export default defineComponent({
const bindValue = { const bindValue = {
[isCheck ? 'checked' : 'value']: (props.formModel as any)[field], [isCheck ? 'checked' : 'value']: (props.formModel as any)[field],
}; };
// TODO先兼容antd的警告,后面官方修复后删除
if (component === 'Select') {
if (Reflect.has(propsData, 'options')) {
propsData.options = propsData.options.map((item: any) => {
return {
key: item.value,
...item,
};
});
}
}
if (!renderComponentContent) { if (!renderComponentContent) {
return <Comp {...propsData} {...on} {...bindValue} />; return <Comp {...propsData} {...on} {...bindValue} />;
} }
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
* @description: Exception related enumeration * @description: Exception related enumeration
*/ */
export enum ExceptionEnum { export enum ExceptionEnum {
// page not access
PAGE_NOT_ACCESS = 403,
// page not found // page not found
PAGE_NOT_FOUND = 404, PAGE_NOT_FOUND = 404,
...@@ -11,17 +14,8 @@ export enum ExceptionEnum { ...@@ -11,17 +14,8 @@ export enum ExceptionEnum {
// net work error // net work error
NET_WORK_ERROR = 10000, NET_WORK_ERROR = 10000,
// net work timeout
NET_WORK_TIMEOUT = 10100,
// not data
NOT_DATA = 10200,
// The page loads too long and timeout
PAGE_TIMEOUT = 10300,
// No data on the page. In fact, it is not an exception page // No data on the page. In fact, it is not an exception page
PAGE_NOT_DATA = 10400, PAGE_NOT_DATA = 10100,
} }
export enum ErrorTypeEnum { export enum ErrorTypeEnum {
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
.logo-title { .logo-title {
font-size: 18px; font-size: 18px;
font-weight: 400; font-weight: 700;
opacity: 0; opacity: 0;
transition: all 0.5s; transition: all 0.5s;
.respond-to(medium,{ .respond-to(medium,{
......
...@@ -6,6 +6,10 @@ const menu: MenuModule = { ...@@ -6,6 +6,10 @@ const menu: MenuModule = {
path: '/exception', path: '/exception',
children: [ children: [
{ {
path: '403',
name: '403',
},
{
path: '404', path: '404',
name: '404', name: '404',
}, },
......
...@@ -19,6 +19,18 @@ export default { ...@@ -19,6 +19,18 @@ export default {
routes: [ routes: [
{ {
path: '/403',
name: 'PageNotAccess',
component: ExceptionPage,
props: {
status: ExceptionEnum.PAGE_NOT_ACCESS,
},
meta: {
title: '403',
afterCloseLoading: true,
},
},
{
path: '/404', path: '/404',
name: 'PageNotFound', name: 'PageNotFound',
component: ExceptionPage, component: ExceptionPage,
...@@ -55,18 +67,6 @@ export default { ...@@ -55,18 +67,6 @@ export default {
}, },
}, },
{ {
path: '/page-time-out',
name: 'PageTimeOut',
component: ExceptionPage,
props: {
status: ExceptionEnum.PAGE_TIMEOUT,
},
meta: {
title: '页面超时',
afterCloseLoading: true,
},
},
{
path: '/not-data', path: '/not-data',
name: 'NotData', name: 'NotData',
component: ExceptionPage, component: ExceptionPage,
......
...@@ -4,7 +4,7 @@ import { MenuTypeEnum, MenuThemeEnum, MenuModeEnum } from '/@/enums/menuEnum'; ...@@ -4,7 +4,7 @@ import { MenuTypeEnum, MenuThemeEnum, MenuModeEnum } from '/@/enums/menuEnum';
import { ContentEnum, PermissionModeEnum, RouterTransitionEnum } from '/@/enums/appEnum'; import { ContentEnum, PermissionModeEnum, RouterTransitionEnum } from '/@/enums/appEnum';
import { primaryColor } from '../../build/config/lessModifyVars'; import { primaryColor } from '../../build/config/lessModifyVars';
import { isProdMode } from '/@/utils/env'; import { isProdMode } from '/@/utils/env';
// ! 改动后需要清空浏览器缓存 // ! You need to clear the browser cache after the change
const setting: ProjectConfig = { const setting: ProjectConfig = {
// Whether to show the configuration button // Whether to show the configuration button
showSettingButton: true, showSettingButton: true,
......
...@@ -6,8 +6,6 @@ import { defineComponent, ref, computed, unref } from 'vue'; ...@@ -6,8 +6,6 @@ import { defineComponent, ref, computed, unref } from 'vue';
import { ExceptionEnum } from '/@/enums/exceptionEnum'; import { ExceptionEnum } from '/@/enums/exceptionEnum';
import netWorkImg from '/@/assets/images/exception/net-work.png'; import netWorkImg from '/@/assets/images/exception/net-work.png';
import error404 from '/@/assets/images/exception/404.png';
import error500 from '/@/assets/images/exception/500.png';
import notDataImg from '/@/assets/images/no-data.png'; import notDataImg from '/@/assets/images/no-data.png';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
...@@ -22,6 +20,7 @@ interface MapValue { ...@@ -22,6 +20,7 @@ interface MapValue {
btnText?: string; btnText?: string;
icon?: string; icon?: string;
handler?: Fn; handler?: Fn;
status?: string;
} }
export default defineComponent({ export default defineComponent({
...@@ -63,50 +62,52 @@ export default defineComponent({ ...@@ -63,50 +62,52 @@ export default defineComponent({
} }
); );
unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_ACCESS, {
title: '403',
status: `${ExceptionEnum.PAGE_NOT_ACCESS}`,
subTitle: `Sorry, you don't have access to this page.!`,
btnText: props.full ? 'Back Login' : 'Back Home',
handler: () => (props.full ? go(PageEnum.BASE_LOGIN) : go()),
});
unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_FOUND, { unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_FOUND, {
title: '404', title: '404',
subTitle: '抱歉,您访问的页面不存在!', status: `${ExceptionEnum.PAGE_NOT_FOUND}`,
btnText: props.full ? '返回登录' : '返回首页', subTitle: `Sorry, the page you visited does not exist.`,
btnText: props.full ? 'Back Login' : 'Back Home',
handler: () => (props.full ? go(PageEnum.BASE_LOGIN) : go()), handler: () => (props.full ? go(PageEnum.BASE_LOGIN) : go()),
icon: error404,
}); });
unref(statusMapRef).set(ExceptionEnum.ERROR, { unref(statusMapRef).set(ExceptionEnum.ERROR, {
title: '500', title: '500',
subTitle: '抱歉,服务器出现异常!', status: `${ExceptionEnum.ERROR}`,
btnText: '返回首页', subTitle: `Sorry, the server is reporting an error.`,
btnText: 'Back Home',
handler: () => go(), handler: () => go(),
icon: error500,
}); });
unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_DATA, { unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_DATA, {
title: '当前页面无数据', title: 'No data on the current page',
subTitle: '', subTitle: '',
btnText: '刷新', btnText: 'Refresh',
handler: () => redo(), handler: () => redo(),
icon: notDataImg, icon: notDataImg,
}); });
unref(statusMapRef).set(ExceptionEnum.NET_WORK_ERROR, { unref(statusMapRef).set(ExceptionEnum.NET_WORK_ERROR, {
title: '网络错误', title: 'Network Error',
subTitle: '抱歉,您的网络连接已断开,请检查您的网络!', subTitle: 'Sorry,Your network connection has been disconnected, please check your network!',
btnText: '刷新', btnText: 'Refresh',
handler: () => redo(), handler: () => redo(),
icon: netWorkImg, icon: netWorkImg,
}); });
unref(statusMapRef).set(ExceptionEnum.PAGE_TIMEOUT, {
title: '页面加载失败',
subTitle: '抱歉,您的页面加载出错或者过久未响应,请检查您的网络!',
btnText: '刷新',
handler: () => redo(),
icon: netWorkImg,
});
return () => { return () => {
const { title, subTitle, btnText, icon, handler } = unref(getMapValue) || {}; const { title, subTitle, btnText, icon, handler, status } = unref(getMapValue) || {};
return ( return (
<Result <Result
class="exception " class="exception "
status={status as any}
title={props.title || title} title={props.title || title}
sub-title={props.subTitle || subTitle} sub-title={props.subTitle || subTitle}
> >
...@@ -117,7 +118,7 @@ export default defineComponent({ ...@@ -117,7 +118,7 @@ export default defineComponent({
{() => btnText} {() => btnText}
</Button> </Button>
), ),
icon: () => icon && <img src={icon} />, icon: () => (icon ? <img src={icon} /> : null),
}} }}
</Result> </Result>
); );
......
<template>
<Exception :status="ExceptionEnum.PAGE_TIMEOUT" />
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { Exception } from '/@/views/sys/exception';
import { ExceptionEnum } from '/@/enums/exceptionEnum';
export default defineComponent({
name: 'LoadTimeout',
components: { Exception },
setup() {
return { ExceptionEnum };
},
});
</script>
export { default as Exception } from './Exception'; export { default as Exception } from './Exception';
export { default as LoadTimeOut } from './LoadTimeOut.vue';
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论