<template>
  <div class="exception-page">
    <div class="exception-image">
      <img :src="type === '403' ? permission : notFound" />
      <slot name="description"></slot>
    </div>
    <div class="exception-btns">
      <el-button
        class="exception-button"
        type="primary"
        @click="
          () => {
            router.push('/file/document')
          }
        "
        >返回首页</el-button
      >
      <el-button
        class="exception-button"
        type="primary"
        @click="
          () => {
            router.back()
          }
        "
        >返回上一页</el-button
      >
    </div>
  </div>
</template>
<script lang="ts" setup>
import { useRouter } from 'vue-router'

import permission from '@/assets/image/dashboard/exception/no-permission.svg'
import notFound from '@/assets/image/dashboard/exception/not-found.svg'

defineOptions({ name: 'Exception' })
const router = useRouter()

interface Props {
  type: '403' | '404'
}
defineProps<Props>()
</script>

<style scoped lang="scss">
.exception-page {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;

  .exception-image {
    width: 100%;
    height: calc(100vh - 300px);

    img {
      width: 100%;
      height: 92%;
    }
  }
  .exception-btns {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;

    .exception-button {
      width: 100px;
      margin: 0 10px;
    }
  }

  // .exception-button {
  //   width: 100px;
  //   position: absolute;
  //   top: 2%;
  //   left: 2%;
  // }
}
</style>
