mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-08-22 00:43:25 +08:00
补充错误路由重定向错误页
This commit is contained in:
parent
54d025282b
commit
be48cf914c
@ -6,6 +6,7 @@ import {
|
|||||||
NConfigProvider,
|
NConfigProvider,
|
||||||
createDiscreteApi,
|
createDiscreteApi,
|
||||||
darkTheme,
|
darkTheme,
|
||||||
|
NGlobalStyle,
|
||||||
} from 'naive-ui'
|
} from 'naive-ui'
|
||||||
import { useSetting } from '@/store'
|
import { useSetting } from '@/store'
|
||||||
|
|
||||||
@ -24,9 +25,9 @@ const GlobalProvider = defineComponent({
|
|||||||
const { message, notification, dialog, loadingBar } = createDiscreteApi(
|
const { message, notification, dialog, loadingBar } = createDiscreteApi(
|
||||||
['message', 'dialog', 'notification', 'loadingBar'],
|
['message', 'dialog', 'notification', 'loadingBar'],
|
||||||
{
|
{
|
||||||
configProviderProps: {
|
configProviderProps: computed(() => ({
|
||||||
theme: modelThemeValue.value,
|
theme: modelThemeValue.value,
|
||||||
},
|
})),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -50,6 +51,7 @@ const GlobalProvider = defineComponent({
|
|||||||
<NMessageProvider>
|
<NMessageProvider>
|
||||||
<NDialogProvider>
|
<NDialogProvider>
|
||||||
<NNotificationProvider>
|
<NNotificationProvider>
|
||||||
|
<NGlobalStyle />
|
||||||
{this.$slots.default?.()}
|
{this.$slots.default?.()}
|
||||||
</NNotificationProvider>
|
</NNotificationProvider>
|
||||||
</NDialogProvider>
|
</NDialogProvider>
|
||||||
|
@ -14,6 +14,11 @@ export const constantRoutes = [
|
|||||||
component: Layout,
|
component: Layout,
|
||||||
children: childrenRoutes,
|
children: childrenRoutes,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/:catchAll(.*)',
|
||||||
|
name: 'error-page',
|
||||||
|
component: () => import('@/views/error/index'),
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
5
src/views/error/index.scss
Normal file
5
src/views/error/index.scss
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
.error-page {
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
@include flexCenter;
|
||||||
|
}
|
32
src/views/error/index.tsx
Normal file
32
src/views/error/index.tsx
Normal file
@ -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 (
|
||||||
|
<div class="error-page">
|
||||||
|
<NResult status="500" title="小调皮你走错地方了">
|
||||||
|
{{
|
||||||
|
footer: () => (
|
||||||
|
<NButton onClick={this.handleBack.bind(this)}>返回首页</NButton>
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
</NResult>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export default ErrorPage
|
@ -3,11 +3,6 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
font-size: 36px;
|
font-size: 36px;
|
||||||
|
|
||||||
&.login--dark {
|
|
||||||
background-color: #101014;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
& .login-title {
|
& .login-title {
|
||||||
padding: 18px 0;
|
padding: 18px 0;
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,7 @@ const Login = defineComponent({
|
|||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div
|
<div class={['login']} style={[`height: ${this.windowHeight}px`]}>
|
||||||
class={['login', this.themeValue ? 'login--dark' : '']}
|
|
||||||
style={[`height: ${this.windowHeight}px`]}
|
|
||||||
>
|
|
||||||
<NSpace>
|
<NSpace>
|
||||||
<NGradientText class="login-title" type="info">
|
<NGradientText class="login-title" type="info">
|
||||||
Ray Template
|
Ray Template
|
||||||
|
Loading…
x
Reference in New Issue
Block a user