index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <div class="layer">
  3. <ly-top class="top" />
  4. <div class="content">
  5. <router-view v-slot="{ Component }" v-if="isSystem">
  6. <component :is="Component" />
  7. </router-view>
  8. <template v-else>
  9. <ly-slide class="slide" :names="menuRouteNames" v-if="!hiddenSlide" />
  10. <div class="view" :class="{ full: hiddenSlide }">
  11. <div class="app-wrap m-4" v-if="!hiddenSlide">
  12. <div
  13. class="app-scene"
  14. ref="sceneRef"
  15. :style="{
  16. width: '100%',
  17. height: 'calc(100% - 24px)',
  18. // display: showScene ? 'none' : 'block'
  19. }"
  20. >
  21. <div class="poprs sceneList" v-if="sceneList.length">
  22. <el-dropdown placement="bottom-start" trigger="click" @command="handleCommand">
  23. <el-icon size="24"><Expand /></el-icon>
  24. <template #dropdown>
  25. <el-dropdown-menu>
  26. <el-dropdown-item v-for="item,index in sceneList" :key="index" :command="item.id">{{ item.name || '多元融合' }}</el-dropdown-item>
  27. </el-dropdown-menu>
  28. </template>
  29. </el-dropdown>
  30. <!-- <div v-for="item,index in sceneList" :key="index">
  31. {{ item.name }}
  32. </div> -->
  33. </div>
  34. <!-- @load="setupSDK($event.target)" -->
  35. <iframe
  36. v-if="caseId"
  37. :src="sceneURL"
  38. frameborder="0"
  39. :style="{ width: '100%', height: '100%' }"
  40. ></iframe>
  41. </div>
  42. </div>
  43. <div class="main p-4" :class="{ fullmain: hiddenSlide }">
  44. <router-view v-slot="{ Component }">
  45. <component :is="Component" />
  46. </router-view>
  47. </div>
  48. </div>
  49. </template>
  50. </div>
  51. </div>
  52. </template>
  53. <script lang="ts" setup>
  54. import lyTop from "./top/index.vue";
  55. import lySlide from "./slide/index.vue";
  56. import { routeIsSystem, router } from "@/router";
  57. import { computed, ref } from "vue";
  58. import { menuRouteNames } from "@/app";
  59. import { updateByTreeFileLists, getCaseSceneListData, getUrlSrc } from "@/store/case";
  60. console.log(menuRouteNames, 'menuRouteNames', router.currentRoute.value.name);
  61. const isSystem = computed(() => routeIsSystem());
  62. const caseId = computed(() => {
  63. const caseId = router.currentRoute.value.params.caseId;
  64. if (caseId) {
  65. return Number(caseId);
  66. }
  67. });
  68. const sceneURL = ref(null)
  69. const sceneList = computed(() => {
  70. let mylist = getCaseSceneListData()
  71. return [{ id: -1, type: 99, name: '多元融合' }, ...mylist];
  72. });
  73. console.log(sceneList, 'sceneList');
  74. updateByTreeFileLists()
  75. const hiddenSlide = computed(
  76. () => !menuRouteNames.includes(router.currentRoute.value.name as string)
  77. );
  78. const handleCommand = (command) => {
  79. let item = sceneList.value.find(item => item.id == command);
  80. let url = getUrlSrc(item, caseId.value)
  81. sceneURL.value = url;
  82. console.log('handleCommand', command, item, url);
  83. }
  84. const handleClick = (command: string) => {
  85. console.log('handleClick', command);
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .layer {
  90. position: absolute;
  91. z-index: 1;
  92. width: 100%;
  93. height: 100%;
  94. display: flex;
  95. flex-direction: column;
  96. .top {
  97. flex: 0 0 auto;
  98. }
  99. .content {
  100. flex: 1 0;
  101. display: flex;
  102. overflow: hidden;
  103. .slide {
  104. width: 16.66rem;
  105. flex: 0 0 auto;
  106. }
  107. .view {
  108. flex: 0 0 auto;
  109. width: calc(100% - 16.66rem);
  110. background-color: var(--bgColor);
  111. // flex-direction: column;
  112. display: flex;
  113. &.full {
  114. width: 100%;
  115. }
  116. .app-wrap, .app-view {
  117. width: calc(100% - 320px);
  118. height: 100%;
  119. }
  120. .player {
  121. flex: 0 0 auto;
  122. height: 32px;
  123. }
  124. .main {
  125. margin: 0 0px 10px 0;
  126. display: flex;
  127. flex-direction: column;
  128. overflow: hidden;
  129. flex: 1;
  130. background: #fff;
  131. }
  132. .fullmain{
  133. background-color: var(--bgColor);
  134. overflow-y: scroll;
  135. }
  136. .app-scene{
  137. position: relative;
  138. }
  139. .sceneList{
  140. width: 48px;
  141. height: 38px;
  142. position: absolute;
  143. left: 10px;
  144. top: 10px;
  145. padding: 6px 0;
  146. line-height: 42px;
  147. background: rgba(27, 27, 28, 0.80);
  148. text-align: center;
  149. cursor: pointer;
  150. }
  151. }
  152. }
  153. }
  154. </style>