<template>
  <el-config-provider :locale="zhCn">
    <div class="app-shell">
      <main class="app-stage">
        <AppHeader v-if="!hideLayout" />
        <section class="app-content" :class="{ 'no-tabbar': hideLayout }">
          <RouterView />
        </section>
        <TabBar v-if="!hideLayout" />
      </main>
    </div>
  </el-config-provider>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import AppHeader from '@/components/layout/AppHeader.vue'
import TabBar from '@/components/layout/TabBar.vue'

const route = useRoute()
const hideLayout = computed(() => !!route.meta.hideLayout)
</script>

<style scoped lang="scss">
.app-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 100vw;
}

.app-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 1px solid #dce5f5;
  background: #cdd7ec;
  box-shadow: 0 4px 12px rgba(51, 83, 145, 0.08);
}

.app-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  padding-bottom: 140px;

  &.no-tabbar {
    padding-bottom: 0;
  }
}
</style>
