123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- <template>
- <div class="layer">
- <ly-top class="top" />
- <div class="content">
- <router-view v-slot="{ Component }" v-if="isSystem">
- <component :is="Component" />
- </router-view>
- <template v-else>
- <ly-slide class="slide" :names="menuRouteNames" v-if="!hiddenSlide" />
- <div class="view" :class="{ full: hiddenSlide }">
- <div class="app-wrap m-4" v-if="!hiddenSlide">
- <div
- class="app-scene"
- ref="sceneRef"
- :style="{
- width: '100%',
- height: 'calc(100% - 24px)',
- // display: showScene ? 'none' : 'block'
- }"
- >
- <div class="poprs sceneList" v-if="sceneList.length">
- <el-dropdown placement="bottom-start" trigger="click" @command="handleCommand">
- <span class="el-dropdown-link" style="color: #fff">
- {{sceneListName}}
- <el-icon class="el-icon--right">
- <arrow-down />
- </el-icon>
- </span>
- <template #dropdown>
- <el-dropdown-menu>
- <el-dropdown-item v-for="item,index in sceneList" :key="index" :command="item.id">{{ item.name || '多元融合' }}</el-dropdown-item>
- </el-dropdown-menu>
- </template>
- </el-dropdown>
- <!-- <div v-for="item,index in sceneList" :key="index">
- {{ item.name }}
- </div> -->
- </div>
- <!-- @load="setupSDK($event.target)" -->
- <iframe
- v-if="caseId"
- :src="sceneURL"
- frameborder="0"
- :style="{ width: '100%', height: '100%' }"
- ></iframe>
- </div>
- </div>
- <div class="main p-4" :class="{ fullmain: hiddenSlide }">
- <router-view v-slot="{ Component }">
- <component :is="Component" />
- </router-view>
- </div>
- </div>
- </template>
- </div>
- </div>
- </template>
- <script lang="ts" setup>
- import lyTop from "./top/index.vue";
- import lySlide from "./slide/index.vue";
- import { routeIsSystem, router } from "@/router";
- import { computed, ref, onMounted, watch } from "vue";
- import { menuRouteNames } from "@/app";
- import { updateByTreeFileLists, getCaseSceneListData, getUrlSrc, getcaseLists, getCaseSceneList } from "@/store/case";
- import { json } from "stream/consumers";
- console.log(menuRouteNames, 'menuRouteNames', router.currentRoute.value.name);
- const isSystem = computed(() => routeIsSystem());
- const caseId = computed(() => {
- const caseId = router.currentRoute.value.params.caseId;
- if (caseId) {
- return Number(caseId);
- }
- });
- // const qpisceneList = ref(getCaseSceneListData() as any[]);
- const sceneList = ref([]);
- const sceneURL = ref(``)
- const sceneListName = ref('')
- const modeList = ref([])
- const init = async () => {
- modeList.value = modeList.value.length == 0 ? await getcaseLists(caseId.value as number) : modeList.value;
- sceneList.value = await getCaseSceneList(caseId.value as number);
- if(modeList.value.length){
- sceneList.value.unshift({ id: -1, type: 99, name: '多元融合' });
- }
- handleCommand()
- // let url = getUrlSrc({ id: 0 }, caseId.value)
- // sceneURL.value = url;
- }
- init()
- const qpisceneList = computed(() => getCaseSceneListData(caseId.value as number));
- watch(() => qpisceneList.value, () => {
- let newqpisceneList = JSON.parse(JSON.stringify(qpisceneList.value))
- if(modeList.value.length){
- newqpisceneList.unshift({ id: -1, type: 99, name: '多元融合' });
- }
- sceneList.value = [...newqpisceneList]
- })
- console.log(sceneList, 'sceneList');
- onMounted(() => {
- // setupSDK(document.querySelector('iframe') as HTMLIFrameElement)
- })
- updateByTreeFileLists()
- const hiddenSlide = computed(
- () => !menuRouteNames.includes(router.currentRoute.value.name as string)
- );
- const handleCommand = (command) => {
- let newid = command || sceneList.value[0].id;
- let item = sceneList.value.find(item => item.id == newid);
- sceneListName.value = item.name;
- let url = getUrlSrc(item, caseId.value)
- sceneURL.value = url;
- console.log('handleCommand', command, item, url);
- }
- const handleClick = (command: string) => {
- console.log('handleClick', command);
- }
- </script>
- <style lang="scss" scoped>
- .layer {
- position: absolute;
- z-index: 1;
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
- .top {
- flex: 0 0 auto;
- }
- .content {
- flex: 1 0;
- display: flex;
- overflow: hidden;
- .slide {
- width: 16.66rem;
- flex: 0 0 auto;
- }
- .view {
- flex: 0 0 auto;
- width: calc(100% - 16.66rem);
- background-color: var(--bgColor);
- // flex-direction: column;
- display: flex;
- &.full {
- width: 100%;
- }
- .app-wrap, .app-view {
- width: calc(100% - 320px);
- height: 100%;
- }
- .player {
- flex: 0 0 auto;
- height: 32px;
- }
- .main {
- margin: 0 0px 10px 0;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- flex: 1;
- background: #fff;
- }
- .fullmain{
- background-color: var(--bgColor);
- overflow-y: scroll;
- }
- .app-scene{
- position: relative;
- }
- .sceneList{
- position: absolute;
- left: 21px;
- top: 42px;
- color: #fff;
- font-weight: bold;
- }
- // .sceneList{
- // width: 48px;
- // height: 38px;
- // position: absolute;
- // left: 10px;
- // top: 10px;
- // padding: 6px 0;
- // line-height: 42px;
- // background: rgba(27, 27, 28, 0.80);
- // text-align: center;
- // cursor: pointer;
- // }
- }
- }
- }
- </style>
|