index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <div id="dashboard-container" ref="containerRef" class="dashboard-container">
  3. <div class="bg">
  4. <HeaderSection />
  5. <div class="dashboard-content">
  6. <LeftSection v-show="showLeftSection" />
  7. <MiddleSection>
  8. <i :class="showLeftSection ? 'arrow-icon left-icon' : 'arrow-icon right-icon'" @click="handleTelescoping('left')" />
  9. <i :class="showRightSection ? 'arrow-icon2 right-icon' : 'arrow-icon2 left-icon'" @click="handleTelescoping('right')" />
  10. </MiddleSection>
  11. <RightSection v-show="showRightSection" />
  12. </div>
  13. <FooterSection style="position: absolute; bottom: 0; left: 0" />
  14. </div>
  15. </div>
  16. </template>
  17. <script lang="ts" setup name="routineCommandMap">
  18. import LeftSection from './LeftSection/index.vue';
  19. import RightSection from './RightSection/index.vue';
  20. import MiddleSection from './MiddleSection.vue';
  21. import autofit from 'autofit.js';
  22. import { getTransformScale } from '@/utils';
  23. import useAppStore from '@/store/modules/app';
  24. const appStore = useAppStore();
  25. const containerRef = ref();
  26. let scale = ref({ scaleX: 1, scaleY: 1 });
  27. let showLeftSection = computed(() => {
  28. return appStore.showLeftSection;
  29. });
  30. let showRightSection = computed(() => {
  31. return appStore.showRightSection;
  32. });
  33. const handleTelescoping = (type: string) => {
  34. if (type === 'left') {
  35. appStore.toggleLeftSection();
  36. } else if (type === 'right') {
  37. appStore.toggleRightSection();
  38. }
  39. };
  40. provide('containerScale', () => scale.value);
  41. onMounted(() => {
  42. autofit.init(
  43. {
  44. dw: 1920,
  45. dh: 1080,
  46. el: '#dashboard-container',
  47. // resize: process.env.NODE_ENV === 'production',
  48. resize: true,
  49. ignore: ['#aMap', '#YztMap', '#positionMap']
  50. },
  51. false
  52. );
  53. scale.value = getTransformScale(containerRef.value);
  54. });
  55. onUnmounted(() => {
  56. if (location.hostname != 'localhost___') {
  57. autofit.off();
  58. }
  59. });
  60. </script>
  61. <style lang="scss" scoped>
  62. .dashboard-container {
  63. width: 1920px;
  64. height: 1080px;
  65. font-size: 14px;
  66. display: flex;
  67. justify-content: center;
  68. align-items: center;
  69. overflow: hidden;
  70. .bg {
  71. width: 100%;
  72. background: url('@/assets/images/bg.png') no-repeat;
  73. background-size: 100% 100%;
  74. position: relative;
  75. }
  76. .dashboard-content {
  77. padding: 0 15px;
  78. display: flex;
  79. width: 100%;
  80. height: calc(1080px - 70px);
  81. overflow: hidden;
  82. }
  83. }
  84. .left-icon {
  85. background: url('@/assets/images/left.png') no-repeat;
  86. background-size: 100% 100%;
  87. }
  88. .right-icon {
  89. background: url('@/assets/images/right.png') no-repeat;
  90. background-size: 100% 100%;
  91. }
  92. .arrow-icon {
  93. position: absolute;
  94. bottom: 228px;
  95. left: 0;
  96. z-index: 9;
  97. width: 55px;
  98. height: 57px;
  99. cursor: pointer;
  100. }
  101. .arrow-icon2 {
  102. position: absolute;
  103. bottom: 228px;
  104. right: 0;
  105. z-index: 9;
  106. width: 55px;
  107. height: 57px;
  108. cursor: pointer;
  109. }
  110. ::-webkit-scrollbar-thumb {
  111. background-color: #227dfe !important;
  112. }
  113. ::-webkit-scrollbar-track {
  114. background-color: transparent !important;
  115. }
  116. </style>