-
Notifications
You must be signed in to change notification settings - Fork 693
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1492f91
commit 7411dbc
Showing
14 changed files
with
16,154 additions
and
17 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Error from './src/Error.vue' | ||
|
||
export { Error } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<script setup lang="ts"> | ||
import pageError from '@/assets/svgs/404.svg' | ||
import networkError from '@/assets/svgs/500.svg' | ||
import noPermission from '@/assets/svgs/403.svg' | ||
import { propTypes } from '@/utils/propTypes' | ||
import { useI18n } from '@/hooks/web/useI18n' | ||
import { ElButton } from 'element-plus' | ||
interface ErrorMap { | ||
url: string | ||
message: string | ||
buttonText: string | ||
} | ||
const { t } = useI18n() | ||
const errorMap: { | ||
[key: string]: ErrorMap | ||
} = { | ||
'404': { | ||
url: pageError, | ||
message: t('error.pageError'), | ||
buttonText: t('error.returnToHome') | ||
}, | ||
'500': { | ||
url: networkError, | ||
message: t('error.networkError'), | ||
buttonText: t('error.returnToHome') | ||
}, | ||
'403': { | ||
url: noPermission, | ||
message: t('error.noPermission'), | ||
buttonText: t('error.returnToHome') | ||
} | ||
} | ||
const props = defineProps({ | ||
type: propTypes.string.validate((v: string) => ['404', '500', '403'].includes(v)).def('404') | ||
}) | ||
const emit = defineEmits(['errorClick']) | ||
const btnClick = () => { | ||
emit('errorClick', props.type) | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="flex justify-center"> | ||
<div class="text-center"> | ||
<img width="350" :src="errorMap[type].url" alt="" /> | ||
<div class="text-14px text-[var(--el-color-info)]">{{ errorMap[type].message }}</div> | ||
<div class="mt-20px"> | ||
<ElButton type="primary" @click="btnClick">{{ errorMap[type].buttonText }}</ElButton> | ||
</div> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script setup lang="ts"> | ||
import { Error } from '@/components/Error' | ||
import { usePermissionStore } from '@/store/modules/permission' | ||
import { useRouter } from 'vue-router' | ||
const { push } = useRouter() | ||
const permissionStore = usePermissionStore() | ||
const errorClick = () => { | ||
push(permissionStore.addRouters[0]?.path as string) | ||
} | ||
</script> | ||
|
||
<template> | ||
<Error type="403" @errorClick="errorClick" /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script setup lang="ts"> | ||
import { Error } from '@/components/Error' | ||
import { usePermissionStore } from '@/store/modules/permission' | ||
import { useRouter } from 'vue-router' | ||
const { push } = useRouter() | ||
const permissionStore = usePermissionStore() | ||
const errorClick = () => { | ||
push(permissionStore.addRouters[0]?.path as string) | ||
} | ||
</script> | ||
|
||
<template> | ||
<Error @errorClick="errorClick" /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script setup lang="ts"> | ||
import { Error } from '@/components/Error' | ||
import { usePermissionStore } from '@/store/modules/permission' | ||
import { useRouter } from 'vue-router' | ||
const { push } = useRouter() | ||
const permissionStore = usePermissionStore() | ||
const errorClick = () => { | ||
push(permissionStore.addRouters[0]?.path as string) | ||
} | ||
</script> | ||
|
||
<template> | ||
<Error type="500" @errorClick="errorClick" /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters