From be48cf914cadd469c680708aed14941caac997e2 Mon Sep 17 00:00:00 2001 From: chuan_wuhao <443547225@qq.com> Date: Wed, 23 Nov 2022 15:26:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E9=94=99=E8=AF=AF=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E9=87=8D=E5=AE=9A=E5=90=91=E9=94=99=E8=AF=AF=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/RayGlobalProvider/index.tsx | 6 ++-- src/router/routes.ts | 5 ++++ src/views/error/index.scss | 5 ++++ src/views/error/index.tsx | 32 ++++++++++++++++++++++ src/views/login/index.scss | 5 ---- src/views/login/index.tsx | 5 +--- 6 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 src/views/error/index.scss create mode 100644 src/views/error/index.tsx diff --git a/src/components/RayGlobalProvider/index.tsx b/src/components/RayGlobalProvider/index.tsx index 0b87b6ff..7931ea8c 100644 --- a/src/components/RayGlobalProvider/index.tsx +++ b/src/components/RayGlobalProvider/index.tsx @@ -6,6 +6,7 @@ import { NConfigProvider, createDiscreteApi, darkTheme, + NGlobalStyle, } from 'naive-ui' import { useSetting } from '@/store' @@ -24,9 +25,9 @@ const GlobalProvider = defineComponent({ const { message, notification, dialog, loadingBar } = createDiscreteApi( ['message', 'dialog', 'notification', 'loadingBar'], { - configProviderProps: { + configProviderProps: computed(() => ({ theme: modelThemeValue.value, - }, + })), }, ) @@ -50,6 +51,7 @@ const GlobalProvider = defineComponent({ + {this.$slots.default?.()} diff --git a/src/router/routes.ts b/src/router/routes.ts index fa63d235..44d5bb3d 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -14,6 +14,11 @@ export const constantRoutes = [ component: Layout, children: childrenRoutes, }, + { + path: '/:catchAll(.*)', + name: 'error-page', + component: () => import('@/views/error/index'), + }, ] /** diff --git a/src/views/error/index.scss b/src/views/error/index.scss new file mode 100644 index 00000000..4f125e3a --- /dev/null +++ b/src/views/error/index.scss @@ -0,0 +1,5 @@ +.error-page { + width: 100%; + height: 100vh; + @include flexCenter; +} diff --git a/src/views/error/index.tsx b/src/views/error/index.tsx new file mode 100644 index 00000000..ce60eef3 --- /dev/null +++ b/src/views/error/index.tsx @@ -0,0 +1,32 @@ +import './index.scss' +import { NResult, NButton } from 'naive-ui' + +const ErrorPage = defineComponent({ + name: 'ErrorPage', + setup() { + const router = useRouter() + + const handleBack = () => { + router.push('/dashboard') + } + + return { + handleBack, + } + }, + render() { + return ( +
+ + {{ + footer: () => ( + 返回首页 + ), + }} + +
+ ) + }, +}) + +export default ErrorPage diff --git a/src/views/login/index.scss b/src/views/login/index.scss index 0e85e726..e0ae1b21 100644 --- a/src/views/login/index.scss +++ b/src/views/login/index.scss @@ -3,11 +3,6 @@ flex-direction: column; font-size: 36px; - &.login--dark { - background-color: #101014; - color: #ffffff; - } - & .login-title { padding: 18px 0; } diff --git a/src/views/login/index.tsx b/src/views/login/index.tsx index 51ce0587..98357ee8 100644 --- a/src/views/login/index.tsx +++ b/src/views/login/index.tsx @@ -35,10 +35,7 @@ const Login = defineComponent({ }, render() { return ( -
+