App.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <AdaptiveContainer :options="{ width: width, height: height }" style="overflow-y: hidden">
  3. <ConfigProvider :locale="getAntdLocale" prefixCls="zxm">
  4. <AppProvider>
  5. <RouterView />
  6. </AppProvider>
  7. </ConfigProvider>
  8. </AdaptiveContainer>
  9. </template>
  10. <script lang="ts" setup>
  11. import { ref, watch, onUnmounted, nextTick, provide } from 'vue';
  12. import { ConfigProvider } from 'ant-design-vue';
  13. import { AppProvider } from '/@/components/Application';
  14. import { useTitle } from '/@/hooks/web/useTitle';
  15. import { useLocale } from '/@/locales/useLocale';
  16. import AdaptiveContainer from '/@/components/Container/src/Adaptive.vue';
  17. import { useAppStore } from '/@/store/modules/app';
  18. // 解决日期时间国际化问题
  19. import 'dayjs/locale/zh-cn';
  20. const isReload = ref(false);
  21. const appStore = useAppStore();
  22. // support Multi-language
  23. const { getAntdLocale } = useLocale();
  24. const width = ref(1920);
  25. const height = ref(928);
  26. const body = document.body.getBoundingClientRect();
  27. if (screen.height === body.height && screen.width === body.width) {
  28. height.value = 1080;
  29. }
  30. const reloadRouter = () => {
  31. isReload.value = true;
  32. nextTick(() => {
  33. isReload.value = false;
  34. });
  35. };
  36. watch([() => appStore.getWidthScale, () => appStore.getHeightScale], () => {
  37. const popoverDomList = document.getElementsByClassName('zxm-popover');
  38. // Array.prototype.map.call(popoverDomList, (dom) => {
  39. // console.log('弹窗节点------>', dom);
  40. // });
  41. });
  42. useTitle();
  43. provide('reloadRouter', reloadRouter);
  44. onUnmounted(() => {
  45. window['renderer']?.dispose();
  46. window['renderer']?.forceContextLoss();
  47. if (window['renderer']) {
  48. window['renderer'].content = null;
  49. }
  50. const gl = window['renderer']?.domElement.getContext('webgl');
  51. gl && gl.getExtension('WEBGL_lose_context').loseContext();
  52. });
  53. </script>
  54. <style lang="less">
  55. // update-begin--author:liaozhiyang---date:20230803---for:【QQYUN-5839】windi会影响到html2canvas绘制的图片样式
  56. img {
  57. display: inline-block;
  58. }
  59. // update-end--author:liaozhiyang---date:20230803---for:【QQYUN-5839】windi会影响到html2canvas绘制的图片样式
  60. </style>
  61. <style lang="less" scoped>
  62. #app {
  63. overflow: hidden;
  64. }
  65. @font-face {
  66. font-family: 'douyuFont';
  67. src: url('/@/assets/font/douyuFont.otf');
  68. font-weight: normal;
  69. font-style: normal;
  70. font-display: swap; // [perf-base-v1] 字体加载期间先用系统字体渲染,避免不可见文本阻塞
  71. }
  72. @font-face {
  73. font-family: 'numberFont';
  74. src: url('/@/assets/font/yjsz.TTF');
  75. font-weight: normal;
  76. font-style: normal;
  77. font-display: swap; // [perf-base-v1] 字体加载期间先用系统字体渲染,避免不可见文本阻塞
  78. }
  79. @font-face {
  80. font-family: 'electronicFont';
  81. src: url('/@/assets/font/DS-DIGIT.TTF');
  82. font-weight: normal;
  83. font-style: normal;
  84. font-display: swap; // [perf-base-v1] 字体加载期间先用系统字体渲染,避免不可见文本阻塞
  85. }
  86. @font-face {
  87. font-family: 'ysbtFont';
  88. src: url('/@/assets/font/ysbtFont.ttf');
  89. font-weight: normal;
  90. font-style: normal;
  91. font-display: swap; // [perf-base-v1] 字体加载期间先用系统字体渲染,避免不可见文本阻塞
  92. }
  93. </style>