<template>
  <AdaptiveContainer :options="{ width: width, height: height }" style="overflow-y: hidden">
    <ConfigProvider :locale="getAntdLocale" prefixCls="zxm">
      <AppProvider>
        <RouterView v-if="!isReload"/>
      </AppProvider>
    </ConfigProvider>
  </AdaptiveContainer>
</template>

<script lang="ts" setup>
  import { ref, watch, onUnmounted, nextTick, provide } from 'vue';
  import { ConfigProvider } from 'ant-design-vue';
  import { AppProvider } from '/@/components/Application';
  import { useTitle } from '/@/hooks/web/useTitle';
  import { useLocale } from '/@/locales/useLocale';
  import AdaptiveContainer from '/@/components/Container/src/Adaptive.vue';
  import { useAppStore } from '/@/store/modules/app';

  // 解决日期时间国际化问题
  import 'dayjs/locale/zh-cn';
  const isReload = ref(false)
  const appStore = useAppStore();
  // support Multi-language
  const { getAntdLocale } = useLocale();
  const width = ref(1920);
  const height = ref(928);

  const body = document.body.getBoundingClientRect();
  if (screen.height === body.height && screen.width === body.width) {
    height.value = 1080;
  }

  const reloadRouter = () => {
    debugger
    isReload.value = true
    nextTick(() => {
      isReload.value = false
    })
  }

  watch([()=> appStore.getWidthScale, () => appStore.getHeightScale], () => {
    const popoverDomList = document.getElementsByClassName('zxm-popover')
    Array.prototype.map.call(popoverDomList, dom => {
      console.log('弹窗节点------>',dom,);  
      
    })
  })

  useTitle();

  provide('reloadRouter', reloadRouter)
  onUnmounted(() => {
    window['renderer']?.dispose()
    window['renderer']?.forceContextLoss()
    if(window['renderer'])window['renderer'].content = null
    const gl = window['renderer']?.domElement.getContext('webgl')
    gl && gl.getExtension('WEBGL_lose_context').loseContext()
  })
</script>

<style lang="less">
// update-begin--author:liaozhiyang---date:20230803---for：【QQYUN-5839】windi会影响到html2canvas绘制的图片样式
img{display:inline-block;}
// update-end--author:liaozhiyang---date:20230803---for：【QQYUN-5839】windi会影响到html2canvas绘制的图片样式
</style>
<style lang="less" scoped>
  #app {
    overflow: hidden;
  }
  @font-face {
    font-family: 'douyuFont';
    src: url('/@/assets/font/douyuFont.otf');
    font-weight: normal;
    font-style: normal;
  }
  @font-face {
    font-family: 'numberFont';
    src: url('/@/assets/font/yjsz.TTF');
    font-weight: normal;
    font-style: normal;
  }
  @font-face {
    font-family: 'electronicFont';
    src: url('/@/assets/font/DS-DIGIT.TTF');
    font-weight: normal;
    font-style: normal;
  }
  @font-face {
    font-family: 'ysbtFont';
    src: url('/@/assets/font/ysbtFont.ttf');
    font-weight: normal;
    font-style: normal;
  }
</style>
