let appHeader=new Vue({
    data(){
        return {
            time:'',
            getTimeHandle:null,
            ...commonOption
        }
    },
    created(){
        let that=this
        document.addEventListener('fullscreenchange',function(e){
            if (!document.fullscreenElement) {      
                that.exitFullsrn()
            }
        })
    },
    mounted(){
        let that=this
        this.active();
        this.getTime();

    },
    methods:{	          
        getTime(){
            let that=this
            axios.get('module/getTime.php')
                .then((res)=>{
                    if(res.data.code==200){
                        that.time=res.data.time;
                        
                        if(res.data.timeStamp*1000>that.stimeBound.getTime()+86400*1000){
                            that.stimeBound=new Date(that.stimeBound.getTime()+86400*1000);
                            that.etimeBound=new Date(that.etimeBound.getTime()+86400*1000)
                            that.starttime=that.stimeBound;
                            that.endtime=that.etimeBound;
                            that.laststarttime=that.stimeBound;
                            that.lastendtime=that.etimeBound;
                        }
                       that.getTimeHandle=setTimeout(function(){that.getTime()},1000)                                                       
                    }
                }).catch(function(res){

                    that.$message({
                    type:'error',
                    message:'请求失败'
                    })                        
                })
        },

        active(){
            let that=this
            axios.get("module/active.php")
            .then(function(res){
                try{
                    let data=res.data;
                    if(data.code==0){
                        location='auth.php';
                    }
                }catch(e){
                    console.log(e)
                }


                setTimeout(that.active,1000)
            })
        },

        exitFullsrn(){
            if(appStack.length==1){
                return
            }
            let app=appStack.pop()
            app.back()
            appCnc.back()
            appNormalEqu.back()
            let that=appStack[0]
            myChart1 = echarts.init(that.$refs.chart1)
            myChart2 = echarts.init(that.$refs.chart2)
            myChart3 = echarts.init(that.$refs.chart3)
            myChart4 = echarts.init(that.$refs.chart4)
            myChart1.resize()
            myChart2.resize()
            myChart3.resize()
            myChart4.resize()
            if (document.fullscreenElement) {      
                document.exitFullscreen()
            }
        }
        
    }
})

appHeader.$mount('#app-header')