<template>
    <div class="out-box">
        <template v-if="!$route.meta.full">
            <myHeader />
            <div class="w1320" style="height:calc(100% - 120px);">
                <myNav />
                <a-config-provider :locale="zh_CN">
                    <router-view style="background-color: #fff;flex:1" />
                </a-config-provider>
            </div>
        </template>
        <template v-if="$route.meta.full">
            <a-config-provider :locale="zh_CN">
                <router-view style="background-color: #fff;flex:1" />
            </a-config-provider>
        </template>
    </div>
</template>
<script>
    import zh_CN from 'ant-design-vue/lib/locale-provider/zh_CN';
    import myHeader from './components/myHeader.vue'
    import myNav from './components/myNav.vue'
    export default {
        components: {
            myHeader,
            myNav
        },
        data() {
            return {
                zh_CN,
            }
        },
        watch: {
            $route(nval) {
                //清空编辑状态
                if (this.$store.state.questionEdit) {
                    this.$store.commit('changeQuestionEdit', false)
                }
            }
        },
        created() {
            let testBox = this.$storage.get('testBox');
            if (!testBox || testBox == null) {
                this.$storage.set('testBox', []);
            } else {
                this.$store.commit('setTestBox', testBox)
            }
        },
        mounted() {
            let token = localStorage.getItem("Token");
            if (!token || this.$route.name === 'login') { return; }
            this.$store.dispatch('EducationCategoryGetList')
            this.$store.dispatch('GradeGetList')
            this.$store.dispatch('DisciplineGetList')
            this.$store.dispatch('GetQuestionTypeList')
            this.$store.dispatch('GetDifficulty')
        }
    }
</script>
<style lang="less">
    html {
        background-color: #f2f2f2;
    }

    #app {
        font-family: Avenir, Helvetica, Arial, sans-serif;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        color: #2c3e50;
        background-color: #f2f2f2;
    }

    .out-box {
        width: 100%;
        height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        background-color: #f2f2f2;
    }
</style>