index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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">
  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 || `/code/index.html?caseId=${caseId}&single#/show`"
  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(() => getCaseSceneListData());
  70. console.log(sceneList, 'sceneList');
  71. updateByTreeFileLists()
  72. const hiddenSlide = computed(
  73. () => !menuRouteNames.includes(router.currentRoute.value.name as string)
  74. );
  75. const handleCommand = (command) => {
  76. let item = sceneList.value.find(item => item.id == command);
  77. let url = getUrlSrc(item, caseId.value)
  78. sceneURL.value = url;
  79. console.log('handleCommand', command, item, url);
  80. }
  81. const handleClick = (command: string) => {
  82. console.log('handleClick', command);
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .layer {
  87. position: absolute;
  88. z-index: 1;
  89. width: 100%;
  90. height: 100%;
  91. display: flex;
  92. flex-direction: column;
  93. .top {
  94. flex: 0 0 auto;
  95. }
  96. .content {
  97. flex: 1 0;
  98. display: flex;
  99. overflow: hidden;
  100. .slide {
  101. width: 16.66rem;
  102. flex: 0 0 auto;
  103. }
  104. .view {
  105. flex: 0 0 auto;
  106. width: calc(100% - 16.66rem);
  107. background-color: var(--bgColor);
  108. // flex-direction: column;
  109. display: flex;
  110. &.full {
  111. width: 100%;
  112. }
  113. .app-wrap, .app-view {
  114. width: calc(100% - 320px);
  115. height: 100%;
  116. }
  117. .player {
  118. flex: 0 0 auto;
  119. height: 32px;
  120. }
  121. .main {
  122. margin: 0 0px 10px 0;
  123. display: flex;
  124. flex-direction: column;
  125. overflow: hidden;
  126. flex: 1;
  127. background: #fff;
  128. }
  129. .fullmain{
  130. background-color: var(--bgColor);
  131. overflow-y: scroll;
  132. }
  133. .sceneList{
  134. width: 48px;
  135. height: 38px;
  136. padding: 6px 0;
  137. line-height: 42px;
  138. background: rgba(27, 27, 28, 0.80);
  139. text-align: center;
  140. cursor: pointer;
  141. }
  142. }
  143. }
  144. }
  145. </style>