jinx il y a 8 mois
Parent
commit
1e9646cfc8

+ 5 - 3
packages/qjkankan-editor/src/components/dragTree/index.vue

@@ -144,10 +144,12 @@ export default {
       currentRootId: "navigation/currentRootId",
     }),
     rootTabIndex() {
-      return this.info.navigationTrees.findIndex((item) => item.id == this.currentRootId);
+      return this.info.navigationTrees.findIndex((item) => item.id == this.currentRootId) == -1 ? 0 : this.info.navigationTrees.findIndex((item) => item.id == this.currentRootId);
     },
     secondTabIndex() {
-      return this.info.navigationTrees[this.rootTabIndex].children.findIndex((item) => item.id == this.currentSecondId);
+      return this.info.navigationTrees[this.rootTabIndex].children.findIndex((item) => item.id == this.currentSecondId) == -1
+        ? 0
+        : this.info.navigationTrees[this.rootTabIndex].children.findIndex((item) => item.id == this.currentSecondId);
     },
   },
   watch: {
@@ -216,7 +218,7 @@ export default {
                   this.$store.commit("scene/setCurrentScenesList", this.info.navigationTrees[this.rootTabIndex].children[this.secondTabIndex].children);
                 }
               } else if (this.currentRootId && !this.currentSecondId) {
-                if (this.info.navigationTrees[this.rootTabIndex].children[0].type == "group") {
+                if (this.info.navigationTrees[this.rootTabIndex]?.children.length && this.info.navigationTrees[this.rootTabIndex]?.children[0].type == "group") {
                   this.$store.commit("navigation/setData", { currentSecondId: this.info.navigationTrees[this.rootTabIndex].children[0].id });
                   this.$store.commit("scene/setCurrentScenesList", this.info.navigationTrees[this.rootTabIndex].children[this.secondTabIndex].children);
                 } else {

+ 16 - 15
packages/qjkankan-editor/src/framework/play/pano/components/new-list.vue

@@ -128,15 +128,15 @@ export default {
 
   watch: {
     currentScenesList(val) {
-   
       if (!val.length && this.info.navigationTrees[this.rootTabIndex]?.children.length > 1 && this.info.navigationTrees[this.rootTabIndex]?.children[0].type == "group") {
-        let index = this.info.navigationTrees[this.rootTabIndex]?.children.findIndex((item) => item.children.length);
+        let index =
+          this.info.navigationTrees[this.rootTabIndex]?.children.findIndex((item) => item.children.length) == -1
+            ? 0
+            : this.info.navigationTrees[this.rootTabIndex]?.children.findIndex((item) => item.children.length);
         let id = this.info.navigationTrees[this.rootTabIndex]?.children[index]?.id;
         this.$store.commit("navigation/setData", { currentSecondId: id });
         this.tabSecond(this.info.navigationTrees[this.rootTabIndex]?.children[index]);
       }
-   
-
 
       this.$nextTick(() => {
         this.initSceneSwiper();
@@ -193,20 +193,22 @@ export default {
       return this.info.navigationTrees.length * (this.swidth["swcatalogRoot"] + 10);
     },
     rootTabIndex() {
-      return this.info.navigationTrees.findIndex((item) => item.id == this.currentRootId);
+      return this.info.navigationTrees.findIndex((item) => item.id == this.currentRootId) == -1 ? 0 : this.info.navigationTrees.findIndex((item) => item.id == this.currentRootId);
     },
     secondTabIndex() {
-      console.error(
-        "secondTabIndex",
-        this.info.navigationTrees[this.rootTabIndex].children.findIndex((item) => item.id == this.currentSecondId)
-      );
-      return this.info.navigationTrees[this.rootTabIndex].children.findIndex((item) => item.id == this.currentSecondId);
+      return this.info.navigationTrees[this.rootTabIndex].children.findIndex((item) => item.id == this.currentSecondId) == -1
+        ? 0
+        : this.info.navigationTrees[this.rootTabIndex].children.findIndex((item) => item.id == this.currentSecondId);
     },
     showSecondTab() {
       return this.info.navigationTrees[this.rootTabIndex].children.some((item) => item.id != this.currentSecondId);
     },
     secondGroups() {
-      return this.info.navigationTrees[this.rootTabIndex].children.filter((item) => item.children.length);
+      if (this.rootTabIndex >= 0) {
+        return this.info.navigationTrees[this.rootTabIndex].children.filter((item) => item.children.length);
+      } else {
+        return [];
+      }
     },
   },
   methods: {
@@ -232,8 +234,7 @@ export default {
     },
     tabSecond(item, index) {
       this.$store.commit("navigation/setData", { currentSecondId: item.id });
-      let sceneList = this.info.navigationTrees[this.rootTabIndex].children[this.secondTabIndex].children;
-      // console.error(sceneList.length)
+      let sceneList = this.info.navigationTrees[this.rootTabIndex].children.length ? this.info.navigationTrees[this.rootTabIndex].children[this.secondTabIndex].children : [];
       this.$store.commit("scene/setCurrentScenesList", sceneList);
       this.$nextTick(() => {
         // this.rootGroupSwiper.slideTo(index);
@@ -260,7 +261,8 @@ export default {
         this.$store.commit("scene/setCurrentScenesList", currentList);
       }
 
-      if (this.secondTabIndex == -1) {
+      // if (this.secondTabIndex == -1) {
+      if (!this.currentSecondId) {
         console.error("没有二级目录");
         let rootList = this.info.navigationTrees.find((item) => item.id == this.currentRootId);
         this.$store.commit("scene/setCurrentScenesList", rootList.children);
@@ -315,7 +317,6 @@ export default {
         this.SecondGroupSwiper.destroy();
         this.SecondGroupSwiper = null;
       }
-      console.error("initSecondGroupSwiper");
       this.SecondGroupSwiper = new Swiper(".second-group-list", this.swiperOptions);
       this.$nextTick(() => {
         if (this.secondTabIndex >= 0) {

+ 63 - 65
packages/qjkankan-view/src/components/UIGather/index.vue

@@ -1,21 +1,24 @@
 <template>
-      <Logo />
-      <Tips />
-      <div v-show="showUI && !hideNav">
-            <Control />
-            <Menu v-if="fdkkCurrentVersion == 'V4'" />
-            <div @click="onIsShowList" v-else
-                  v-show="!((metadata.catalogRoot && metadata.catalogRoot.length == 1) && scenes.length == 1 && secondaryList.length == 1)"
-                  class="v3daolan" :class="{ active: isShowScenesList }">
-                  <img :src="require(`@/assets/images/icon/${isShowScenesList ? 'function_off@2x.png' : 'function_on@2x.png'}`)"
-                        alt="" />
-            </div>
+  <Logo />
+  <Tips />
+  <div v-show="showUI && !hideNav">
+    <Control />
+    <Menu v-if="fdkkCurrentVersion == 'V4'" />
+    <div
+      @click="onIsShowList"
+      v-else
+      v-show="!(metadata.catalogRoot && metadata.catalogRoot.length == 1 && scenes.length == 1 && secondaryList.length == 1)"
+      class="v3daolan"
+      :class="{ active: isShowScenesList }"
+    >
+      <img :src="require(`@/assets/images/icon/${isShowScenesList ? 'function_off@2x.png' : 'function_on@2x.png'}`)" alt="" />
+    </div>
 
-            <sceneList />
-            <div class="btnmask"></div>
-      </div>
+    <sceneList />
+    <div class="btnmask"></div>
+  </div>
 </template>
-  
+
 <script setup>
 import Logo from "./logo";
 import Tips from "./tips";
@@ -27,7 +30,6 @@ import { useStore } from "vuex";
 import { useApp, getApp } from "@/app";
 import browser from "@/utils/browser";
 
-
 const store = useStore();
 
 const fdkkCurrentVersion = computed(() => store.getters["scene/fdkkCurrentVersion"]);
@@ -37,66 +39,62 @@ const metadata = computed(() => store.getters["scene/metadata"]);
 const scenes = computed(() => store.getters["scene/list"]);
 const secondaryList = computed(() => store.getters["scene/secondaryList"]);
 
-const showUI = ref(false)
-
+const showUI = ref(false);
 
 const onIsShowList = (data) => {
-      store.commit("functions/setShowScenesList", !isShowScenesList.value);
+  store.commit("functions/setShowScenesList", !isShowScenesList.value);
 };
 
-
 useApp().then((app) => {
-      app.Scene.on("ready", () => {
-            if (currentScene && currentScene.value.type == '4dkk' && !showUI.value) {
-                  showUI.value = true
-            }
-      })
-      app.Scene.on("sceneReady", () => {
-            showUI.value = true
-      })
-})
-
-
+  app.Scene.on("ready", () => {
+    if (currentScene && currentScene.value.type == "4dkk" && !showUI.value) {
+      showUI.value = true;
+    }
+  });
+  app.Scene.on("sceneReady", () => {
+    showUI.value = true;
+  });
+});
 </script>
-  
+
 <style lang="scss" scoped>
 .v3daolan {
-      background: rgba(0, 0, 0, .3);
-      border: 1px solid hsla(0, 0%, 100%, .2);
-      position: fixed;
-      bottom: 20px;
-      left: 50%;
-      transform: translateX(-50%);
-      border-radius: 50%;
-      pointer-events: auto;
-      width: 36px;
-      height: 36px;
-      line-height: 36px;
-      color: #fff;
-      display: flex;
-      align-items: center;
-      justify-content: center;
-      cursor: pointer;
+  background: rgba(0, 0, 0, 0.3);
+  border: 1px solid hsla(0, 0%, 100%, 0.2);
+  position: fixed;
+  bottom: 20px;
+  left: 50%;
+  transform: translateX(-50%);
+  border-radius: 50%;
+  pointer-events: auto;
+  width: 36px;
+  height: 36px;
+  line-height: 36px;
+  color: #fff;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  cursor: pointer;
 
-      &.active {
-            background: rgba(0, 0, 0, 0.5);
-      }
+  &.active {
+    background: rgba(0, 0, 0, 0.5);
+  }
 
-      >img {
-            width: 26px;
-            height: 26px;
-      }
+  > img {
+    width: 26px;
+    height: 26px;
+  }
 }
 
 .btnmask {
-      width: 100%;
-      position: fixed;
-      bottom: 0;
-      left: 0;
-      right: 0;
-      pointer-events: none;
-      opacity: 0.3;
-      height: 50px;
-      background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.7) 52%, #000000 100%);
+  width: 100%;
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  pointer-events: none;
+  opacity: 0.3;
+  height: 50px;
+  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.7) 52%, #000000 100%);
 }
-</style>
+</style>

+ 6 - 4
packages/qjkankan-view/src/components/UIGather/list.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="bar-list" v-if="metadata?.navigationTrees?.length" :class="{ barshow: isShowScenesList }">
-    <div class="top-con" v-show="currentScenesList.length > 1">
-      <div v-if="currentScenesList.length > 1" class="scene-list swiper-container" ref="scene-swiper" :style="`width:${scenesListW > 1150 ? '100%' : scenesListW + 'px'}`">
+    <div class="top-con" v-show="currentScenesList.length >= 1">
+      <div v-if="currentScenesList.length >= 1" class="scene-list swiper-container" ref="scene-swiper" :style="`width:${scenesListW > 1150 ? '100%' : scenesListW + 'px'}`">
         <!-- <div class="scene-list swiper-container" ref="scene-swiper"> -->
         <div class="swiper-wrapper scene-wrapper">
           <!-- <div
@@ -326,7 +326,7 @@ const tabCurrentScene = (data, index) => {
 };
 const initSecondGroupSwiper = () => {
   if (SecondGroupSwiper.value) {
-    SecondGroupSwiper.value.destroy();
+    SecondGroupSwiper.value.destroy(false);
     SecondGroupSwiper.value = null;
   }
 
@@ -354,7 +354,9 @@ const initRootGroupSwiper = () => {
     if (rootTabIndex.value >= 0) {
       rootGroupSwiper.value.slideTo(rootTabIndex.value);
     }
-    initSecondGroupSwiper();
+    if (secondGroups.value.length > 1) {
+      initSecondGroupSwiper();
+    }
   }
 };