index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div class="container">
  3. <div class="top-content">
  4. <!-- <YztMap v-if="['satellite2', 'satellite3'].includes(activeMap)" ref="map2Ref" :active-map="activeMap" :point-type="pointType" />-->
  5. <Map ref="mapRef" :active-map="activeMap" :point-type="pointType" :class="showMenu && !!eventId && !fullscreen ? 'containerHeight1' : 'containerHeight2'"/>
  6. <div v-show="!fullscreen" class="top-left-panel">
  7. </div>
  8. <div class="top-right-panel">
  9. <SearchBtn v-show="!fullscreen" />
  10. <div v-show="!fullscreen" class="add-button button1" @click="handleAdd" />
  11. <div v-show="!fullscreen" class="reduce-button button1" @click="handleReduce" />
  12. <div class="fullScreen-button button1" @click="handleFullscreen" />
  13. <div v-show="!fullscreen" class="layer-button button1" />
  14. </div>
  15. <div v-show="!fullscreen" class="bottom-left-panel">
  16. <div class="button2" @click="toIndex">
  17. <i class="back-btn" />
  18. <div>首页</div>
  19. </div>
  20. <div v-show="!eventId" class="button2">
  21. <i class="material-btn" />
  22. <div>指挥作战</div>
  23. </div>
  24. <div class="button2">
  25. <i class="material-btn" />
  26. <div>物资</div>
  27. </div>
  28. <div class="button2">
  29. <i class="event-btn" />
  30. <div>事件</div>
  31. </div>
  32. <div class="button2">
  33. <i class="plot-btn" />
  34. <div>协同标绘</div>
  35. </div>
  36. </div>
  37. <i v-if="!!eventId" v-show="!fullscreen" :class="showMenu ? 'arrow-icon' : 'arrow-icon turn'" @click="showMenu = !showMenu" />
  38. </div>
  39. <div v-if="!!eventId" v-show="showMenu && !fullscreen">
  40. <EventBox :eventId="eventId" />
  41. </div>
  42. </div>
  43. </template>
  44. <script lang="ts" setup>
  45. import {onMounted, ref} from "vue";
  46. import {useRoute, useRouter} from "vue-router";
  47. import EventBox from "./EventBox.vue";
  48. import SearchBtn from "./SearchBtn.vue";
  49. const router = useRouter();
  50. const route = useRoute();
  51. const eventId = ref('');
  52. let fullscreen = ref(false);
  53. let showMenu = ref(true);
  54. let mapRef = ref(null);
  55. let map2Ref = ref(null);
  56. // logical vectorgraph satellite satellite2 satellite3
  57. let activeMap = ref('vectorgraph');
  58. let pointType = ref([]);
  59. const toIndex = () => {
  60. router.push('/leader/index');
  61. };
  62. // 地图增加一级
  63. const handleAdd = () => {
  64. let map = getMap();
  65. if (!!map) {
  66. map.setZoom(map.getZoom() + 1);
  67. }
  68. }
  69. // 地图减小一级
  70. const handleReduce = () => {
  71. let map = getMap();
  72. if (!!map) {
  73. map.setZoom(map.getZoom() - 1);
  74. }
  75. }
  76. // 全屏
  77. const handleFullscreen = () => {
  78. fullscreen.value = !fullscreen.value;
  79. }
  80. const getMap = () => {
  81. let map;
  82. if (['satellite2', 'satellite3'].includes(activeMap.value)) {
  83. } else {
  84. map = mapRef.value.getMap();
  85. }
  86. return map;
  87. }
  88. onMounted(() => {
  89. eventId.value = route.query.event_id as string;
  90. })
  91. </script>
  92. <style lang="scss" scoped>
  93. .container {
  94. .top-content {
  95. width: 100%;
  96. height: 100%;
  97. position: relative;
  98. .arrow-icon {
  99. position: absolute;
  100. bottom: 0;
  101. left: 50%;
  102. transform: translateX(-50%);
  103. width: 24px;
  104. height: 24px;
  105. background: url('@/assets/images/command/arrow.png') no-repeat;
  106. background-size: 100% 100%;
  107. }
  108. .turn {
  109. transform: translateX(-50%) rotateX(180deg);
  110. }
  111. }
  112. }
  113. .top-left-panel {
  114. position: absolute;
  115. top: 16px;
  116. left: 16px;
  117. }
  118. .top-right-panel {
  119. display: flex;
  120. flex-direction: column;
  121. position: absolute;
  122. right: 16px;
  123. top: 16px;
  124. .add-button {
  125. background: url('@/assets/images/command/add.png') no-repeat;
  126. }
  127. .reduce-button {
  128. background: url('@/assets/images/command/reduce.png') no-repeat;
  129. }
  130. .fullScreen-button {
  131. background: url('@/assets/images/command/fullScreen.png') no-repeat;
  132. }
  133. .layer-button {
  134. background: url('@/assets/images/command/layer.png') no-repeat;
  135. }
  136. .button1 {
  137. width: 24px;
  138. height: 24px;
  139. display: flex;
  140. justify-content: center;
  141. align-items: center;
  142. background-size: 100% 100%;
  143. cursor: pointer;
  144. margin-bottom: 10px;
  145. &:last-child {
  146. margin-bottom: 0;
  147. }
  148. }
  149. }
  150. .bottom-left-panel {
  151. display: flex;
  152. flex-direction: column;
  153. position: absolute;
  154. left: 16px;
  155. bottom: 16px;
  156. .button2 {
  157. margin-bottom: 16px;
  158. min-width: 87px;
  159. height: 26px;
  160. background: #2C81FF;
  161. border-radius: 2px;
  162. display: flex;
  163. padding: 0 11px;
  164. align-items: center;
  165. font-size: 12px;
  166. color: #ffffff;
  167. &:last-child {
  168. margin-bottom: 0;
  169. }
  170. }
  171. .back-btn {
  172. width: 12px;
  173. height: 12px;
  174. background: url('@/assets/images/command/back.png') no-repeat;
  175. background-size: 100% 100%;
  176. margin-right: 6px;
  177. }
  178. .material-btn {
  179. width: 13px;
  180. height: 12px;
  181. background: url('@/assets/images/command/material.png') no-repeat;
  182. background-size: 100% 100%;
  183. margin-right: 6px;
  184. }
  185. .event-btn {
  186. width: 13px;
  187. height: 12px;
  188. background: url('@/assets/images/command/event.png') no-repeat;
  189. background-size: 100% 100%;
  190. margin-right: 6px;
  191. }
  192. .plot-btn {
  193. width: 12px;
  194. height: 12px;
  195. background: url('@/assets/images/command/plot.png') no-repeat;
  196. background-size: 100% 100%;
  197. margin-right: 6px;
  198. }
  199. }
  200. .containerHeight1 {
  201. height: calc(100vh - 359px);
  202. }
  203. .containerHeight2 {
  204. height: calc(100vh - 55px);
  205. }
  206. </style>