<template>
  <div class="layout-content">
    <div class="layout-aside">
      <Aside />
    </div>
    <div class="layout-body">
      <div class="layout-head">
        <Head />
      </div>
      <div class="layout-nav">
        <Nav />
      </div>
      <div class="layout-page">
        <RouterView v-if="!loading" />
        <div v-else class="loading" v-loading="loading" />
      </div>
    </div>
    <UploadList />
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue';
import Aside from '@/components/layout/aside.vue';
import Head from '@/components/layout/head.vue';
import Nav from '@/components/layout/nav.vue';
import UploadList from '@/components/common/uploadList/index.vue';
import { getAllDictDataFun, getUserPermissionsFun } from '@/utils/common';

const loading = ref(true);

onMounted(async () => {
  await getAllDictDataFun();
  getUserPermissionsFun();
  loading.value = false;
});
</script>

<style lang="scss" scoped>
.layout-content {
  width: 100%;
  height: 100%;
  display: flex;
  .layout-aside {
    width: auto;
    height: 100%;
  }
  .layout-body {
    flex: 1;
    width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    .layout-head {
      width: 100%;
      height: 60px;
    }
    .layout-nav {
      width: 100%;
      height: 44px;
    }
    .layout-page {
      flex: 1;
      width: 100%;
      height: 100%;
      overflow-y: auto;
      background-color: var(--el-bg-color-page);
      padding: 16px;
    }
  }
}
.loading {
  width: 100%;
  height: 100%;
}
</style>
