<template>
    <div style="display: flex; flex-direction: column;" id="app">
        <div style="flex:1;overflow:auto">
            <router-view></router-view>
        </div>
        
        <div>
            <Footer v-if="footerShow"/>
        </div>
    </div>
</template>

<script>
import Footer from './common/Footer'
export default {
    name: 'app',
    components: {
        Footer
    },
    data() {
        return {
            status: 0,
            // footerPaths:['/Mine','/guide3','/Home','/guide1','/Choose'],
            footerPaths:['/Mine','/guide3','/Home','/guide1','/Contract/index'],
            footerShow:false,
        }
    },
    methods: {
        getBaseInfo() {
            this.$http({
                method: 'get',
                url: 'base_info'
            }).then((res) => {
                // if (!localStorage.getItem('token')) {
                //     this.$router.push({ path: '/Login' })
                //  }
                this.$store.commit('setBaseInfoValue', res.data)
            })
        },
        getRouter(){
            if (this.footerPaths.includes(this.$route.path)) {
                this.footerShow = true
            } else {
                this.footerShow = false
            }
        },


        lockDesktopVW () { 
            // const isDesktop = window.matchMedia('(hover:hover) and (pointer:fine)').matches 
            // const app = document.getElementById('app-wrapper') 
            // if (!app) return 
            // if (!isDesktop) {  
            //     app.style.transform = '' 
            //     app.style.width = '' 
            //     app.style.height = '' 
            //     app.style.left = '' 
            //     app.style.top = '' 
            //     return 
            // } 
            // const TARGET = 414  
            // app.style.width = TARGET + 'px' 
            // app.style.height = 1334 + 'px'
        }, 
        

    },
    created() {
        // document.title = ''
        this.getBaseInfo()

        this.getRouter();
    },
    mounted () {
        this.lockDesktopVW()
        window.addEventListener('resize', this.lockDesktopVW)
    },
    beforeDestroy () {
        window.removeEventListener('resize', this.lockDesktopVW)
    },
    watch:{
        '$route' (to, from) {
            this.getRouter();
        }
    }
}
</script>




<style>

/* #app {
  top: 0;
  right: 0;
  left: 0;
  margin: auto;
  max-width: var(--ex-max-width);
  container-type: inline-size;
} */






body .van-toast {
    font-size: 1rem;
    padding: 4vw;
    line-height: 1.3rem;
    width: 70%;
}
body .van-toast .van-toast__icon {
    font-size: 6.667vw;
}
*,
:after,
:before {
    box-sizing: border-box;
}
</style>
