<template>
  <div class="body-content">
    <home-slice v-if="showSlice && slice_type === 1"/>
    <home-slice-online v-if="showSlice && slice_type === 0"/>
    <header-container/>
    <div class="container-wrapper">
      <slot>
        <div class="main-container">
          <router-view/>
        </div>
      </slot>
    </div>
    <footer-container/>
  </div>
</template>

<script>
import Http from '@/js/http.js'
import HeaderContainer from '@/components/commons/Header2.0'
import FooterContainer from '@/components/commons/Footer2.0'
import HomeSlice from '@/components/commons/HomeSlice'
import HomeSliceOnline from '@/components/commons/HomeSliceOnline'
import {getCurrentUser, storageGet, storageSave} from '@/js/index'
import {setConfig} from '../src/config/index'
import {slice_type} from "../tool4deploy/slider-type";

export default {
  name: 'App',
  components: {HeaderContainer, FooterContainer, HomeSlice ,HomeSliceOnline},
  data(){
    return {
      // showSlice:false
      slice_type
    }
  },
  methods: {
    setUserInfo () {
      // storageGet('user').then((res)=>{
      //   if (res == null){
      //     this.setCurrUserByHttp()
      //   }else{
      //     this.fullScreenLoading = false
      //     this.isLogin = true
      //   }
      // }).catch((error)=>{
      //   this.setCurrUserByHttp()
      // })


      // if (storageGet('user') == null) {
      //   storageSave('rolesPermissions', {
      //     'isRegionManager': false,
      //     'isIndividualUser': false,
      //     'isEnterpriseUser': false,
      //     'isAgency': false,
      //     'isSystemAdministrator': false
      //   })
      //   console.log('本地没有用户信息,开始加载用户信息')
      //   getCurrentUser().then((res) => {
      //     console.log(res)
      //     storageSave('user', res)
      //     storageSave('rolesPermissions', getRolesPermissions(res.roleList))
      //     console.log('用户信息加载成功')
      //   }).catch(error => {
      //     console.log('用户信息加载失败')
      //     if (error.status == 401) {
      //       notify('warning', error.data)
      //     } else {
      //       notify('error', error.data)
      //     }
      //   })
      // } else {
      //   this.fullScreenLoading = false
      //   this.isLogin = true
      // }
    },
  },
  computed:{
    showSlice(){
      if(this.$route.path==='/home' || this.$route.path==='/')
        return  true;
    }
  },
}
</script>

<style>
  .body-content{
    width:100%;
    min-width: 1300px;
    height: 100%;
  }
  .container-wrapper {
    min-height: calc(100% - 70px - 180px);
  }
  .main-container {
    width: 100%;
    min-height: calc(100% - 70px - 180px);
    margin: 0 auto;
    padding-bottom: 30px;
  }
  .home-slice {
    width: 100%;
    height: 170px;
    background-image: url("./assets/img/homeSlice.png");
    background-size: 100% 100%
  }
</style>