<template>
  <div id="app">
    <el-container class="outContainerWrap">
      <el-header style="height: 62px;" v-if="showHeader">
        <Header :showRight="showHeaderRight"></Header>
        <video class="top_viedo" width="100%" src="./assets/headerBg1.mp4" autoplay loop muted
        ></video>
        <div class="bg"></div>
      </el-header>
      <el-container :class="(showHeader ? 'short-container' : '')">
        <!-- 侧边栏 -->
        <SliderMenu v-if="showSidebar" :menuData="slidermenu" :customize="customize"></SliderMenu>
        <SliderScond v-if="showSecondSide" :menuData="secondMenu" ></SliderScond>
        <!-- :renderKey="{}"  覆盖内部取值 可存储至store 修改、获取-->
        <el-container class="main-right-content">
          <!-- 面包屑导航 -->
          <Breadcrumb />
          <el-main class="app-content">
            <!-- loading -->
              <global-loading>
                <!-- 页面内容 -->
                <router-view />
              </global-loading>
            </el-main>
        </el-container>
      </el-container>
    </el-container>
  </div>
</template>
<script>
import SliderMenu from '@/components/SliderMenu.vue';
import { mapState } from 'vuex';
import Header from './components/Header.vue';
import Breadcrumb from './components/Breadcrumb.vue';
// import loadingAnimation from '@/assets/loadingAni.json' // 导入JSON文件
import GlobalLoading from '@/components/GlobalLoading1.vue'
import SliderScond from '@/components/SliderScond.vue'
// import ContentWithLoading from '@/components/ContentWithLoading'
export default {
  data() {
    return {
      isCollapse: true,
    };
  },
  components: {
    GlobalLoading,
    SliderScond,
    // ContentWithLoading,
    SliderMenu,
    // Footer,
    Header,
    Breadcrumb
  },
  computed: {
    ...mapState(['showSidebar','showSecondSide','secondMenu','showHeader','showHeaderRight','slidermenu','customize']) // 从Vuex映射showSidebar状态到组件的计算属性中
  },
  mounted() {
    window.addEventListener('beforeunload', this.clearStorage);
  },
  beforeUnmount() {
    window.removeEventListener('beforeunload', this.clearStorage);
  },
  methods: {
    clearStorage() {
      // 或按需清除特定项：
      localStorage.removeItem('date');
    },
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    }
  }
}
</script>
<style lang="scss" scoped>
.outContainerWrap{
  flex-direction: column;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  font-family: Microsoft YaHei UI;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  height: 100%;
  background: #F5F7FA;
  min-width: 1200px;
}
.app-content {
  position: relative;
  isolation: isolate;
}
.short-container {
  height: calc(100vh - 62px);
}
.main-right-content{
  display: flex;
  flex-direction: column;
  min-width: 1042px;
}


::v-deep .el-container .el-main {
  // padding: 12px;
}

.bg {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  background: rgba(255, 255, 255, 0.61);
  z-index: 2;
}

::v-deep .el-header {
  height: 62px;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
  background: linear-gradient(270deg, #4EA4F3 0%, #3D85EA 100%);
}

.top_viedo {
  width: 100%;
  height: 100%;
  position: absolute;
  object-fit: cover;
  left: 0;
  top: 0;
}

nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
