2022-01-06 02:00:42 +08:00
|
|
|
<script lang="ts" setup>
|
2023-11-17 08:45:00 +08:00
|
|
|
import { computed } from 'vue';
|
|
|
|
import { $t } from '@/locales';
|
2022-01-06 02:00:42 +08:00
|
|
|
|
2022-07-10 14:02:00 +08:00
|
|
|
defineOptions({ name: 'ExceptionBase' });
|
|
|
|
|
2023-12-14 21:45:29 +08:00
|
|
|
const props = defineProps<Props>();
|
|
|
|
|
2022-01-06 02:00:42 +08:00
|
|
|
type ExceptionType = '403' | '404' | '500';
|
|
|
|
|
|
|
|
interface Props {
|
2023-11-17 08:45:00 +08:00
|
|
|
/**
|
2023-12-14 21:45:29 +08:00
|
|
|
* Exception type
|
|
|
|
*
|
2023-11-17 08:45:00 +08:00
|
|
|
* - 403: no permission
|
|
|
|
* - 404: not found
|
|
|
|
* - 500: service error
|
|
|
|
*/
|
2022-01-06 02:00:42 +08:00
|
|
|
type: ExceptionType;
|
|
|
|
}
|
|
|
|
|
2023-11-17 08:45:00 +08:00
|
|
|
const iconMap: Record<ExceptionType, string> = {
|
|
|
|
'403': 'no-permission',
|
|
|
|
'404': 'not-found',
|
|
|
|
'500': 'service-error'
|
|
|
|
};
|
2022-01-06 02:00:42 +08:00
|
|
|
|
2023-11-17 08:45:00 +08:00
|
|
|
const icon = computed(() => iconMap[props.type]);
|
2022-01-06 02:00:42 +08:00
|
|
|
</script>
|
2022-05-28 12:30:17 +08:00
|
|
|
|
2023-11-17 08:45:00 +08:00
|
|
|
<template>
|
|
|
|
<div class="flex-vertical-center gap-24px min-h-520px wh-full overflow-hidden">
|
|
|
|
<div class="flex text-400px text-primary">
|
|
|
|
<SvgIcon :local-icon="icon" />
|
|
|
|
</div>
|
|
|
|
<RouterLink to="/">
|
|
|
|
<NButton type="primary">{{ $t('common.backToHome') }}</NButton>
|
|
|
|
</RouterLink>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-01-06 02:00:42 +08:00
|
|
|
<style scoped></style>
|