|
@@ -47,7 +47,7 @@
|
|
|
<div class="swiper-wrapper second-group-wrapper">
|
|
|
<div
|
|
|
class="swiper-slide second-group-slide"
|
|
|
- @click="tabSecond(item)"
|
|
|
+ @click="tabSecond(item, index)"
|
|
|
v-if="item.children.length"
|
|
|
v-for="(item, index) in info.navigationTrees[rootTabIndex].children"
|
|
|
:class="{ active: currentSecondId == item.id, disabled: isLockV4Scene, loopspan: fixTitle(item.name).length > spanlength && currentSecondId == item.id }"
|
|
@@ -76,7 +76,7 @@
|
|
|
loopspan: fixTitle(item.name).length > spanlength && currentRootId.id == item.id,
|
|
|
}"
|
|
|
v-for="(item, index) in info.navigationTrees"
|
|
|
- @click="tabRoot(item)"
|
|
|
+ @click="tabRoot(item, index)"
|
|
|
>
|
|
|
<div class="root-group-content">
|
|
|
<marquee-text :duration="Math.ceil(fixTitle(item.name).length / 10) * 5" :key="item.id" :repeat="1" v-if="fixTitle(item.name).length > spanlength && currentRootId == item.id">
|
|
@@ -113,6 +113,7 @@ export default {
|
|
|
swiperOptions: {
|
|
|
slidesPerView: "auto",
|
|
|
centeredSlides: true,
|
|
|
+ slideToClickedSlide: true,
|
|
|
centerInsufficientSlides: true,
|
|
|
centeredSlidesBounds: true,
|
|
|
freeMode: {
|
|
@@ -163,6 +164,7 @@ export default {
|
|
|
...mapGetters({
|
|
|
info: "base/baseInfo",
|
|
|
currentScene: "scene/currentScene",
|
|
|
+ sceneList: "base/sceneList",
|
|
|
currentScenesList: "scene/currentScenesList",
|
|
|
currentSecondId: "navigation/currentSecondId",
|
|
|
currentRootId: "navigation/currentRootId",
|
|
@@ -202,22 +204,40 @@ export default {
|
|
|
return name;
|
|
|
},
|
|
|
|
|
|
- tabRoot(item) {
|
|
|
+ tabRoot(item, index) {
|
|
|
this.$store.commit("navigation/setData", { currentRootId: item.id, currentSecondId: null });
|
|
|
+ // this.handlerCurrent();
|
|
|
this.changeSceneList();
|
|
|
+ this.$nextTick(() => {
|
|
|
+ // this.rootGroupSwiper.slideTo(index);
|
|
|
+ });
|
|
|
},
|
|
|
- tabSecond(item) {
|
|
|
+ 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)
|
|
|
this.$store.commit("scene/setCurrentScenesList", sceneList);
|
|
|
- // this.changeSceneList();
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.rootGroupSwiper.slideTo(index);
|
|
|
+ });
|
|
|
},
|
|
|
changeSceneList() {
|
|
|
let currentList = null;
|
|
|
|
|
|
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.info.navigationTrees[this.rootTabIndex].children.forEach((item, index) => {
|
|
|
+ if (item.children.length) {
|
|
|
+ item.children.forEach((t_item, t_index) => {
|
|
|
+ if (t_item.id == this.currentScene.id || (t_item.sid && this.currentScene.sid && t_item.sid == this.currentScene.sid)) {
|
|
|
+ this.$store.commit("navigation/setData", { currentSecondId: item.id });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
currentList = this.info.navigationTrees[this.rootTabIndex].children[this.secondTabIndex].children;
|
|
|
this.$store.commit("scene/setCurrentScenesList", currentList);
|
|
|
}
|
|
@@ -237,6 +257,17 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ handlerCurrent() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.SecondGroupSwiper.slideTo(this.secondTabIndex);
|
|
|
+ let sceneIndex = this.currentScenesList.findIndex((item) => {
|
|
|
+ return item.id == this.currentScene.id || (item.sid && this.currentScene.sid && item.sid == this.currentScene.sid);
|
|
|
+ });
|
|
|
+ if (sceneIndex >= 0) {
|
|
|
+ this.SceneSwiper.slideTo(this.sceneIndex);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
initSceneSwiper() {
|
|
|
if (this.SceneSwiper) {
|
|
|
this.SceneSwiper.destroy();
|
|
@@ -246,6 +277,14 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
this.SceneSwiper = new Swiper(".scene-list", this.swiperOptions);
|
|
|
+ this.$nextTick(() => {
|
|
|
+ let sceneIndex = this.currentScenesList.findIndex((item) => {
|
|
|
+ return item.id == this.currentScene.id || (item.sid && this.currentScene.sid && item.sid == this.currentScene.sid);
|
|
|
+ });
|
|
|
+ if (sceneIndex >= 0) {
|
|
|
+ this.SceneSwiper.slideTo(sceneIndex);
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
tabCurrentScene(data, index) {
|
|
@@ -259,6 +298,11 @@ export default {
|
|
|
this.SecondGroupSwiper = null;
|
|
|
}
|
|
|
this.SecondGroupSwiper = new Swiper(".second-group-list", this.swiperOptions);
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (this.secondTabIndex >= 0) {
|
|
|
+ this.SecondGroupSwiper.slideTo(this.secondTabIndex);
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
tabCurrentSecondGroup(data, index) {
|
|
@@ -273,6 +317,11 @@ export default {
|
|
|
this.rootGroupSwiper = null;
|
|
|
}
|
|
|
this.rootGroupSwiper = new Swiper(".root-group-list", this.swiperOptions);
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (this.rootTabIndex >= 0) {
|
|
|
+ this.rootGroupSwiper.slideTo(this.rootTabIndex);
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
tabCurrentRootGroup(data, index) {
|