jinx 5 ay önce
ebeveyn
işleme
b790a1e818

+ 1 - 0
packages/qjkankan-editor/src/components/dragTree/index.vue

@@ -11,6 +11,7 @@
       :expand-on-click-node="false"
       node-key="id"
       class="custom-tree"
+      empty-text=" "
       :default-expand-all="false"
       @node-drag-start="handleDragStart"
       @node-drag-enter="handleDragEnter"

+ 75 - 8
packages/qjkankan-view/src/components/UIGather/mobile/list.vue

@@ -66,18 +66,26 @@
       </div>
     </div>
 
-    <div
+    <!-- <div
       class="swiper-container root-group-list"
       ref="root-group"
       id="swcatalogRoot"
       :style="`width:${Math.min(catalogRootW, innerW)}px;
     padding:${catalogRootW > innerW ? '0 15px' : '0'}`"
       v-if="metadata?.navigationTrees?.length > 1"
+    > -->
+    <div
+      class="swiper-container root-group-list"
+      ref="root-group"
+      id="swcatalogRoot"
+      :style="`width:${Math.min(catalogRootW, innerW)}px;
+    padding:${catalogRootW > innerW ? '0 15px' : '0'}`"
+      v-if="rootTabShow"
     >
       <ul class="swiper-wrapper">
         <template v-for="(item, i) in metadata?.navigationTrees" :key="item.id">
           <li
-            v-if="item.children.length"
+            v-if="getCurrentTabScenes(item).length"
             class="swiper-slide"
             :class="{
               active: currentRootId == item.id,
@@ -163,14 +171,70 @@ const secondaryW = computed(() => {
   let list = metadata.value?.navigationTrees[rootTabIndex.value].children.filter((item) => item.children.length);
   return list.length * (swidth.value["swSecondary"] + 10) - 10;
 });
+const rootTabShow = computed(() => {
+  let list = [];
+
+  metadata.value.navigationTrees.forEach((item) => {
+    let show = false;
+    item.children.forEach((i) => {
+      if (i.type != "group") {
+        // list.push(i);
+        show = true;
+      } else {
+        let res = i.children.filter((t) => t.type != "group");
+        if (res.length) {
+          show = true;
+        }
+        // list = list.concat(res);
+      }
+    });
+    if (show) {
+      list.push(item);
+    }
+  });
 
+  return list.length > 1 ? true : false;
+});
 const catalogRootW = computed(() => {
-  let list = metadata.value.navigationTrees.filter((item) => item.children.length);
+  // let list = metadata.value.navigationTrees.filter((item) => item.children.length);
+
+  let list = [];
+
+  metadata.value.navigationTrees.forEach((item) => {
+    let show = false;
+    item.children.forEach((i) => {
+      if (i.type != "group") {
+        // list.push(i);
+        show = true;
+      } else {
+        let res = i.children.filter((t) => t.type != "group");
+        if (res.length) {
+          show = true;
+        }
+        // list = list.concat(res);
+      }
+    });
+    if (show) {
+      list.push(item);
+    }
+    // return list.length * (swidth.value["swcatalogRoot"] + 10);
+  });
   return list.length * (swidth.value["swcatalogRoot"] + 10);
 });
 
 const innerW = computed(() => window.innerWidth);
-
+const getCurrentTabScenes = (item) => {
+  let list = [];
+  item.children.forEach((i) => {
+    if (i.type != "group") {
+      list.push(i);
+    } else {
+      let res = i.children.filter((t) => t.type != "group");
+      list = list.concat(res);
+    }
+  });
+  return list;
+};
 watch(
   () => currentScenesList.value,
   () => {
@@ -200,6 +264,8 @@ const fixTitle = (name) => {
     name = t("navigation.default_group_two");
   } else if (name == "一级分组") {
     name = t("navigation.group_one");
+  } else if (name == "二级分组") {
+    name = t("navigation.group_two");
   } else {
     name = name;
   }
@@ -245,10 +311,11 @@ const changeSceneList = () => {
   let currentList = null;
 
   if (metadata.value.navigationTrees[rootTabIndex.value].children.length && metadata.value.navigationTrees[rootTabIndex.value].children[0].type == "group") {
-    store.commit("scene/setData", { currentSecondId: metadata.value.navigationTrees[rootTabIndex.value].children[0].id });
+    // store.commit("scene/setData", { currentSecondId: metadata.value.navigationTrees[rootTabIndex.value].children[0].id });
     //如果有当前视图则选择二级目录
     metadata.value.navigationTrees[rootTabIndex.value].children.forEach((item, index) => {
       if (item.children.length) {
+        store.commit("scene/setData", { currentSecondId: item.id });
         item.children.forEach((t_item, t_index) => {
           if (t_item.id == currentScene.value.id || (t_item.sid && currentScene.value.sid && t_item.sid == currentScene.value.sid)) {
             store.commit("scene/setData", { currentSecondId: item.id });
@@ -292,7 +359,7 @@ const initSceneSwiper = () => {
   });
 };
 const tabCurrentScene = (data, index) => {
-  if(data.type == '4dkk') {
+  if (data.type == "4dkk") {
     store.commit("functions/setShowScenesList", false);
   }
   store.commit("scene/setCurrentScene", data);
@@ -345,7 +412,7 @@ const tabCurrentRootGroup = (data, index) => {
 
 onMounted(() => {
   useApp().then(async (app) => {
-    if(currentScene.value.type == '4dkk' && currentScene.value.version == 'V4') {
+    if (currentScene.value.type == "4dkk" && currentScene.value.version == "V4") {
       store.commit("functions/setShowScenesList", false);
     }
     show.value = true;
@@ -554,4 +621,4 @@ onMounted(() => {
 .marquee-text-text {
   padding: 0 5px;
 }
-</style>
+</style>

+ 8 - 6
packages/qjkankan-view/src/hooks/useAudio.js

@@ -6,7 +6,7 @@ import { computed, onMounted, watch, ref, unref, reactive } from "vue";
 import debounce from "lodash-es/debounce";
 import mitt from "mitt";
 let CLICKFIRST = false;
-
+let canPlay = false;
 const currentPlayer = ref(null);
 const isInit = ref(false);
 const currentAudio = computed(() => store.getters["audio/currentAudio"]);
@@ -98,6 +98,7 @@ function initAudioPlayer() {
     const player = createAudioPlayer(unref(currentAudio).url, unref(currentAudio).isAuto, unref(currentAudio).repeat);
     currentPlayer.value = player;
     player.on("play", () => {
+      isInit.value = false;
       console.log("play--22", player.isPlaying);
       store.dispatch("audio/updatePlayerStatus", player.isPlaying);
     });
@@ -195,8 +196,8 @@ class AudioPlayer {
     this._src = url;
     this.audio = null;
     this.createAudio();
-    // this.play();
-    this.audio.play();
+    this.play();
+    // this.audio.play();
     this.emit("change", this.audio);
   }
   init() {
@@ -229,12 +230,13 @@ class AudioPlayer {
       },
     });
   }
-  bindElement() {
+  bindElement(e) {
     const $player = document.querySelector(".ui-view-layout");
-    const onclick = () => {
+    const onclick = (e) => {
       $player.removeEventListener("click", onclick);
       $player.removeEventListener("touchstart", onclick);
       //判断是否第一次进入或者是否已点击过 或已自动播放过。
+
       if (CLICKFIRST || this._isPlaying) {
         console.log("已点击过或自动播放中");
         return;
@@ -254,7 +256,7 @@ class AudioPlayer {
           `playStatus: audioplay->${this._autoplay},
           lock:${this._lock},firstPlay:${this._firstPlay},loop:${this._loop}`
         );
-        if (this._autoplay || this._firstPlay) {
+        if (this._autoplay || this._firstPlay ||!isInit.value) {
           await this.audio.play();
         } else {
           //默认不自动播放重置状态并记录已播放过