let jessibucaPlayer = {};
    //var host = location.protocol + '//' + window.location.host;
    var token = Cookies.get('ELADMIN-TOEKN');
    var Axiosx = axios.create({
        headers: { 'Authorization': token }
    });
    Axiosx.interceptors.response.use(
        response => {
            return response
        }, error => {
            console.error(error)
            let code = 0
            try {
                code = error.response.data.status
            } catch (e) {
                if (error.toString().indexOf('Error: timeout') !== -1) {
                    console.error('当前网络不佳')
                    return
                }
            }
            if (!code) {
                console.error('当前网络不佳')
                return
            }
            if (code === 401) {
                alert('登录信息失效，请重新登录')
                window.open(host + '/#/login', '_self')
                return
            }
            if (code === 400) {
                alert('您没有权限使用此功能，请联系管理员开通')
                return
            }
        }
    );

    var host = location.protocol + '//' + (location.hostname === '192.168.3.38' ? '192.168.3.37' : '192.168.13.200') + ':8013';

    var selfHost = location.hostname === '192.168.3.38' ? 'http://192.168.3.38:8057' : location.protocol + '//' + window.location.host;


    // 请求 token 用
    var request = axios.create({});
    request.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';

var gemhoUtil = {
    // goToPage: function(url){
    //     // window.open(url)
    //     // location.href = '/datav/index.html'
    //     // window.open('/datav/index.html')
    // },

    detailPageMixin: {
        data: function() {
            // 获取今天的日期
            const today = new Date();

            // 获取前七天的日期
            const sevenDaysAgo = new Date();
            sevenDaysAgo.setDate(today.getDate() - 7);

            // 格式化日期为 YYYY-MM-DD HH:mm:ss
            const formatDate = (date) => {
                const pad = (num) => String(num).padStart(2, '0');
                return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
            };

            // 生成数组
            const dateArray = [formatDate(sevenDaysAgo), formatDate(today)];
            return {
                // 公共信息 
                selectedMine: {},
                menuObj: menuObj,
                bigScreenDetailMenu: '',
                bigScreenDetailMenuModel: '',
                createTime: dateArray,
                isReady: false,  // 页面是否准备好  请求完接口变为true

            };
        },
        mounted() {
            window.onresize = () => {
                location.reload()
            }

            this.bigScreenDetailMenu = window.location.pathname
            localStorage.setItem('bigScreenDetailMenu', this.bigScreenDetailMenu)

            if (!token) {
                window.open(host + '/#/login', '_self')
                return
            }
            this.bigScreenDetailMenu = window.localStorage.getItem('bigScreenDetailMenu')
            this.bigScreenDetailMenuModel = window.localStorage.getItem('bigScreenDetailMenuModel')
            // 当前矿山
            const selectedMineJson = window.localStorage.getItem('kd.selected.mine')
            let noMine = false
            if (!selectedMineJson) {
                noMine = true
            } else {
                const selectedMine = JSON.parse(selectedMineJson)
                this.selectedMine = selectedMine
            }
        },
        methods: {
            goPrePage() {
                // history.back()
                const type = localStorage.getItem('bigScreenDetailMenuModel')
                
                if(type === 'emergency'){
                    //window.open('/datav/index.html')
					window.location.href = '/datav/index.html';
                }else if(type === 'natural'){
                    //window.open('/datav/natural.html')
					window.location.href = '/datav/natural.html';
                }else if(type === 'watersystem'){
                    //window.open('/datav/watersource.html')
					window.location.href = '/datav/watersource.html';
                }else if(type === 'ecosystem'){
                    //window.open('/datav/index.html')
					window.location.href = '/datav/index.html';
                }
            },
            changeMenu(item) {
                localStorage.setItem('bigScreenDetailMenu', item.url)
                localStorage.setItem('bigScreenDetailMenuModel', item.model)

                this.bigScreenDetailMenu = item.name
                // 跳转页面
                // window.open(item.url)
                location.href = item.url
            },
        }
    }
}
var menuObj = {
    emergency: {
        menuList: [{
            name: '视频监控',
            model: 'emergency',
            url: '/datav/detail/video-monitor.html'
        },{
            name: '变形监测',
            model: 'emergency',
            url: '/datav/detail/shape-monitor.html'
            
        },{
            name: '温度监测',
            model: 'emergency',
            url: '/datav/detail/temperature-monitor.html'
        },{
            name: '湿度监测',
            model: 'emergency',
            url: '/datav/detail/humidity-monitor.html'
        },{
            name: '风速监测',
            model: 'emergency',
            url: '/datav/detail/wind-monitor.html'
        },{
            name: '降水监测',
            model: 'emergency',
            url: '/datav/detail/water-monitor.html'
        },{
            name: '人员定位',
            model: 'emergency',
            url: '/datav/detail/people-monitor.html',
            subMenu: [{
                name: '人员数据统计',
                url: '/datav/detail/people-monitor.html'
            },{
                name: '人员定位图',
                url: '/datav/detail/people-monitor.html'
            }]
        }],
    },
    natural: {
        menuList: [{
            name: '视频监控',
            model: 'natural',
            url: '/datav/detail/video-monitor.html'
        },{
            name: '矿山全景',
            model: 'natural',
            url: '/datav/detail/mine-global.html'
        },{
            name: '资源储备',
            model: 'natural',
            url: '/datav/detail/resource-storage.html'
        },{
            name: '水监测',
            model: 'natural',
            url: '/datav/detail/shui-monitor.html'
        },{
            name: '土监测',
            model: 'natural',
            url: '/datav/detail/tu-monitor.html'
        },{
            name: '地质环境',
            model: 'natural',
            url: '/datav/detail/dizhi-huanjing.html'
        },{
            name: '绿色矿山',
            model: 'natural',
            url: '/datav/detail/green-mine.html',
        },{
            name: '开发利用',
            model: 'natural',
            url: '/datav/detail/dev-use.html',
        },{
            name: '变形监测',
            model: 'natural',
            url: '/datav/detail/shape-monitor.html',
        }],
    },
    watersystem: {
        menuList: [{
            name: '视频监控',
            model: 'watersystem',
            url: '/datav/detail/video-monitor.html'
        },{
            name: '水土流失',
            model: 'watersystem',
            url: '/datav/detail/shuitu-monitor.html'
        },{
            name: '降水监测',
            model: 'watersystem',
            url: '/datav/detail/water-monitor.html'
        },{
            name: '温度监测',
            model: 'watersystem',
            url: '/datav/detail/temperature-monitor.html'
        },{
            name: '湿度监测',
            model: 'watersystem',
            url: '/datav/detail/humidity-monitor.html'
        },{
            name: '风速监测',
            model: 'watersystem',
            url: '/datav/detail/wind-monitor.html'
        }],
    },
    ecosystem: {
        menuList: [{
            name: '视频监控',
            model: 'ecosystem',
            url: '/datav/detail/video-monitor.html'
        },{
            name: '水土流失',
            model: 'ecosystem',
            url: '/datav/detail/shuitu-monitor.html'
        },{
            name: '土壤监测',
            model: 'ecosystem',
            url: '/datav/detail/turang-monitor.html'
        },{
            name: '噪声监测',
            model: 'ecosystem',
            url: '/datav/detail/zaosheng-monitor.html'
        },{
            name: '大气监测',
            model: 'ecosystem',
            url: '/datav/detail/daqi-monitor.html'
        },{
            name: '烟道监测',
            model: 'ecosystem',
            url: '/datav/detail/yandao-monitor.html'
        }],
    },
}

