|
@@ -59,8 +59,8 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="image-info" v-else>
|
|
|
- <div class="cover-image">
|
|
|
- <img ref="drag-image" :src="data.icon + ossImagePreviewUrlSuffix()" alt="" />
|
|
|
+ <div class="cover-image" ref="drag-image">
|
|
|
+ <img :id="`drag_image_${data.id}`" :src="data.icon + ossImagePreviewUrlSuffix()" alt="" />
|
|
|
</div>
|
|
|
|
|
|
<div class="image-name">
|
|
@@ -212,42 +212,18 @@ export default {
|
|
|
this.$nextTick(() => {
|
|
|
if (this.currentRootId || this.currentSecondId) {
|
|
|
if (this.currentRootId && this.currentSecondId) {
|
|
|
- this.$store.commit("scene/setCurrentScenesList", this.info.navigationTrees[this.rootTabIndex].children[this.secondTabIndex].children);
|
|
|
+ if (this.info.navigationTrees[this.rootTabIndex].children[this.secondTabIndex]) {
|
|
|
+ this.$store.commit("scene/setCurrentScenesList", this.info.navigationTrees[this.rootTabIndex].children[this.secondTabIndex].children);
|
|
|
+ }
|
|
|
} else if (this.currentRootId && !this.currentSecondId) {
|
|
|
- this.$store.commit("scene/setCurrentScenesList", this.info.navigationTrees[this.rootTabIndex].children);
|
|
|
+ if (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 {
|
|
|
+ this.$store.commit("scene/setCurrentScenesList", this.info.navigationTrees[this.rootTabIndex].children);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // let activeScene = null;
|
|
|
- // let currentScene = this.currentScene;
|
|
|
-
|
|
|
- // this.info.navigationTrees.forEach((item, index) => {
|
|
|
- // activeScene = item.children.find((pano) => pano.id == currentScene.id);
|
|
|
-
|
|
|
- // if (activeScene) {
|
|
|
- // this.$store.commit("scene/setCurrentScenesList", item.children);
|
|
|
- // this.$store.commit("navigation/setData", { currentSecondId: null, currentRootId: item.id });
|
|
|
- // // throw new Error("LoopTerminated");
|
|
|
- // }
|
|
|
- // item = item.children.forEach((s_item, s_index) => {
|
|
|
- // activeScene = s_item.children.find((pano) => pano.id == currentScene.id);
|
|
|
-
|
|
|
- // if (activeScene) {
|
|
|
- // this.$store.commit("scene/setCurrentScenesList", s_item.children);
|
|
|
- // this.$store.commit("navigation/setData", { currentSecondId: s_item.id, currentRootId: item.id });
|
|
|
- // // throw new Error("LoopTerminated");
|
|
|
- // }
|
|
|
- // s_item = s_item.children.forEach((t_item, t_index) => {
|
|
|
- // activeScene = t_item.children.find((pano) => pano.id == currentScene.id);
|
|
|
-
|
|
|
- // if (activeScene) {
|
|
|
- // this.$store.commit("scene/setCurrentScenesList", s_item.children);
|
|
|
- // this.$store.commit("navigation/setData", { currentSecondId: s_item.id, currentRootId: item.id });
|
|
|
- // // throw new Error("LoopTerminated");
|
|
|
- // }
|
|
|
- // });
|
|
|
- // });
|
|
|
- // });
|
|
|
});
|
|
|
}
|
|
|
},
|
|
@@ -313,7 +289,9 @@ export default {
|
|
|
if (node.data.type == "group") {
|
|
|
ev.dataTransfer.setDragImage(this.$refs["drag-group"], -10, -18);
|
|
|
} else {
|
|
|
- ev.dataTransfer.setDragImage(this.$refs["drag-image"], -10, -18);
|
|
|
+ // ev.dataTransfer.setDragImage(this.$refs["drag-image"], -10, -18);
|
|
|
+ let dom = document.getElementById(`drag_image_${node.data.id}`);
|
|
|
+ ev.dataTransfer.setDragImage(dom, -10, -18);
|
|
|
}
|
|
|
},
|
|
|
handleDragEnter(draggingNode, dropNode, ev) {
|
|
@@ -384,9 +362,17 @@ export default {
|
|
|
return false;
|
|
|
}
|
|
|
} else {
|
|
|
+ if (draggingNode.level == 1 && draggingNode.data.children.length && draggingNode.data.children[0].type == "group") {
|
|
|
+ //禁止含有二级目录的一级目录,拖拽到其他一级目录
|
|
|
+ return false;
|
|
|
+ }
|
|
|
return type == "prev" || type == "next";
|
|
|
}
|
|
|
} else if (dropNode.level == 1) {
|
|
|
+ //禁止含有二级目录的一级目录,拖拽到其他一级目录
|
|
|
+ if (draggingNode.level == 1 && draggingNode.data.children.length && draggingNode.data.children[0].type == "group") {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
return type == "prev" || type == "next" || type == "inner";
|
|
|
}
|
|
|
}
|
|
@@ -710,7 +696,7 @@ export default {
|
|
|
item.children = list;
|
|
|
}
|
|
|
|
|
|
- if (item.children.length == 1 && item.type == "group" && !item.children[0].children.length) {
|
|
|
+ if (item.children.length == 1 && item.type == "group" && !item.children[0].children.length && item.children[0].type != "pano") {
|
|
|
//新增二级目录的时候,如果新增完只有一个二级目录,且二级目录为空,创建多一个目录,且第一个为默认二级目录
|
|
|
let list = [];
|
|
|
let defaultDir = {
|
|
@@ -756,8 +742,19 @@ export default {
|
|
|
list = list.concat(groupList);
|
|
|
item.children = list;
|
|
|
console.error(item.children);
|
|
|
- break;
|
|
|
}
|
|
|
+
|
|
|
+ // if (groupList.length == 1 && !groupList[0].children.length) {
|
|
|
+ // //当只有一个二级目录,二级目录没有场景
|
|
|
+
|
|
|
+ // item.children = [];
|
|
|
+ // }
|
|
|
+ if (groupList.length == 1 && !panoList.length && groupList[0].children.length) {
|
|
|
+ //当只有一个二级目录,二级目录有场景
|
|
|
+ item.children = groupList[0].children;
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
// if (item.id == this.currentRootId) {
|
|
@@ -967,7 +964,7 @@ export default {
|
|
|
|
|
|
> i {
|
|
|
margin-left: 12px;
|
|
|
-
|
|
|
+ cursor: pointer;
|
|
|
&.iconfont {
|
|
|
&:hover {
|
|
|
color: #0076f6;
|
|
@@ -1016,6 +1013,7 @@ export default {
|
|
|
height: auto;
|
|
|
// padding: 10px 0;
|
|
|
border-radius: 4px;
|
|
|
+ cursor: default;
|
|
|
}
|
|
|
.el-tree-node__content {
|
|
|
// padding-left: 30px !important;
|