|
@@ -1,7 +1,5 @@
|
|
|
<template>
|
|
|
- <div
|
|
|
- class="scene-group"
|
|
|
- >
|
|
|
+ <div class="scene-group">
|
|
|
<div
|
|
|
class="top-bar"
|
|
|
:class="isConfirmingDeletion ? '' : 'show-icons-on-hover'"
|
|
@@ -18,13 +16,34 @@
|
|
|
<div class="drag-image" ref="drag-image">
|
|
|
<i class="iconfont icon-editor_folder_off"></i>
|
|
|
</div>
|
|
|
- <i class="iconfont icon-edit_input_arrow icon-expand" :class="isExpanded ? '' : 'collapsed'"></i>
|
|
|
- <i v-show="isExpanded" class="iconfont icon-editor_folder_on folder_expanded"></i>
|
|
|
- <i v-show="!isExpanded" class="iconfont icon-editor_folder_off folder_collapsed"></i>
|
|
|
+ <i
|
|
|
+ class="iconfont icon-edit_input_arrow icon-expand"
|
|
|
+ :class="isExpanded ? '' : 'collapsed'"
|
|
|
+ ></i>
|
|
|
+ <i
|
|
|
+ v-show="isExpanded"
|
|
|
+ class="iconfont icon-editor_folder_on folder_expanded"
|
|
|
+ ></i>
|
|
|
+ <i
|
|
|
+ v-show="!isExpanded"
|
|
|
+ class="iconfont icon-editor_folder_off folder_collapsed"
|
|
|
+ ></i>
|
|
|
<template v-if="!isRenaming">
|
|
|
- <span class="group-name" v-title="$i18n.t(`zh_key.${groupNode.name}`).indexOf('zh_key')>-1?groupNode.name:$i18n.t(`zh_key.${groupNode.name}`)">{{
|
|
|
- $i18n.t(`zh_key.${groupNode.name}`).indexOf('zh_key')>-1?groupNode.name:$i18n.t(`zh_key.${groupNode.name}`)}}</span>
|
|
|
- <i v-show="level === 1"
|
|
|
+ <span
|
|
|
+ class="group-name"
|
|
|
+ v-title="
|
|
|
+ $i18n.t(`zh_key.${groupNode.name}`).indexOf('zh_key') > -1
|
|
|
+ ? groupNode.name
|
|
|
+ : $i18n.t(`zh_key.${groupNode.name}`)
|
|
|
+ "
|
|
|
+ >{{
|
|
|
+ $i18n.t(`zh_key.${groupNode.name}`).indexOf("zh_key") > -1
|
|
|
+ ? groupNode.name
|
|
|
+ : $i18n.t(`zh_key.${groupNode.name}`)
|
|
|
+ }}</span
|
|
|
+ >
|
|
|
+ <i
|
|
|
+ v-show="level === 1"
|
|
|
class="iconfont icon-editor_list_add icon-add"
|
|
|
v-tooltip="$i18n.t('navigation.add_two_group')"
|
|
|
@click.stop="onRequestForAddGroup"
|
|
@@ -32,20 +51,16 @@
|
|
|
</i>
|
|
|
<i
|
|
|
class="iconfont icon-editor_list_image icon-image"
|
|
|
- v-tooltip="$i18n.t('navigation.add_pano_or_scene')"
|
|
|
+ v-tooltip="$i18n.t('navigation.add_pano_or_scene')"
|
|
|
@click.stop="onRequestForAddScene"
|
|
|
v-show="
|
|
|
level === 2 ||
|
|
|
- (
|
|
|
- level === 1 &&
|
|
|
- (
|
|
|
- groupNode.children.length === 0 ||
|
|
|
- (
|
|
|
- groupNode.children.length === 1 &&
|
|
|
- (groupNode.children[0].name === '默认二级分组'||groupNode.children[0].name === $i18n.t('navigation.default_group_two'))
|
|
|
- )
|
|
|
- )
|
|
|
- )
|
|
|
+ (level === 1 &&
|
|
|
+ (groupNode.children.length === 0 ||
|
|
|
+ (groupNode.children.length === 1 &&
|
|
|
+ (groupNode.children[0].name === '默认二级分组' ||
|
|
|
+ groupNode.children[0].name ===
|
|
|
+ $i18n.t('navigation.default_group_two')))))
|
|
|
"
|
|
|
>
|
|
|
</i>
|
|
@@ -62,11 +77,13 @@
|
|
|
>
|
|
|
</i>
|
|
|
<div class="deletion-confirm-wrap">
|
|
|
- <div class="deletion-confirm" :class="isConfirmingDeletion ? 'show' : 'hide'"
|
|
|
+ <div
|
|
|
+ class="deletion-confirm"
|
|
|
+ :class="isConfirmingDeletion ? 'show' : 'hide'"
|
|
|
v-clickoutside="onRequestForCancelDelete"
|
|
|
@click.stop="onConfirmDelete"
|
|
|
>
|
|
|
- {{$i18n.t('navigation.delete')}}
|
|
|
+ {{ $i18n.t("navigation.delete") }}
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -84,8 +101,16 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="group-content" v-if="isExpanded">
|
|
|
- <template v-if="!(groupNode.children.length === 1 &&
|
|
|
- (groupNode.children[0].name === '默认二级分组' || groupNode.children[0].name === $i18n.t('navigation.default_group_two')))">
|
|
|
+ <template
|
|
|
+ v-if="
|
|
|
+ !(
|
|
|
+ groupNode.children.length === 1 &&
|
|
|
+ (groupNode.children[0].name === '默认二级分组' ||
|
|
|
+ groupNode.children[0].name ===
|
|
|
+ $i18n.t('navigation.default_group_two'))
|
|
|
+ )
|
|
|
+ "
|
|
|
+ >
|
|
|
<InsertPositionTip
|
|
|
position-debug="1"
|
|
|
:indentLevel="level + 1"
|
|
@@ -93,10 +118,7 @@
|
|
|
:parentNode="groupNode"
|
|
|
:index="0"
|
|
|
></InsertPositionTip>
|
|
|
- <div
|
|
|
- v-for="(item, index) of groupNode.children"
|
|
|
- :key=item.id
|
|
|
- >
|
|
|
+ <div v-for="(item, index) of groupNode.children" :key="item.id">
|
|
|
<component
|
|
|
:is="'SceneGroup'"
|
|
|
ref="scene-group"
|
|
@@ -137,7 +159,7 @@
|
|
|
></InsertPositionTip>
|
|
|
<div
|
|
|
v-for="(item, index) of groupNode.children[0].children"
|
|
|
- :key=item.id
|
|
|
+ :key="item.id"
|
|
|
>
|
|
|
<SceneInGroup
|
|
|
:style="{
|
|
@@ -178,7 +200,7 @@ import InsertPositionTip from "@/components/insertPositionTipInEditor.vue";
|
|
|
import { mapGetters, mapMutations } from "vuex";
|
|
|
|
|
|
export default {
|
|
|
- name: 'SceneGroup',
|
|
|
+ name: "SceneGroup",
|
|
|
components: {
|
|
|
SceneInGroup,
|
|
|
MaterialSelector,
|
|
@@ -192,193 +214,208 @@ export default {
|
|
|
level: {
|
|
|
type: Number,
|
|
|
default: 1,
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
isExpanded: false,
|
|
|
isRenaming: false,
|
|
|
- newName: '',
|
|
|
+ newName: "",
|
|
|
isConfirmingDeletion: false,
|
|
|
isShowSelectionWindow: false,
|
|
|
dragEnterTimerId: null,
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters({
|
|
|
info: "info",
|
|
|
- dragInfo: 'editorNavDragInfo',
|
|
|
+ dragInfo: "editorNavDragInfo",
|
|
|
}),
|
|
|
topBarPaddingLeft() {
|
|
|
- return 12 + (this.level - 1) * 12 + 'px'
|
|
|
+ return 12 + (this.level - 1) * 12 + "px";
|
|
|
},
|
|
|
sceneItemPaddingLeft() {
|
|
|
- return 18 + this.level * 12 + 'px'
|
|
|
+ return 18 + this.level * 12 + "px";
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
...mapMutations({
|
|
|
- recordDragType: 'setEditorNavDragType',
|
|
|
- recordDragNode: 'setEditorNavDragNode',
|
|
|
- clearDragInfo: 'clearEditorNavDragInfo',
|
|
|
+ recordDragType: "setEditorNavDragType",
|
|
|
+ recordDragNode: "setEditorNavDragNode",
|
|
|
+ clearDragInfo: "clearEditorNavDragInfo",
|
|
|
}),
|
|
|
onClickTopBar() {
|
|
|
if (this.isConfirmingDeletion) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- this.isExpanded = !this.isExpanded
|
|
|
+ this.isExpanded = !this.isExpanded;
|
|
|
},
|
|
|
|
|
|
onRenameScene(...params) {
|
|
|
- this.$emit('renameScene', ...params)
|
|
|
+ this.$emit("renameScene", ...params);
|
|
|
},
|
|
|
onDeleteScene(...params) {
|
|
|
- this.$emit('deleteScene', ...params)
|
|
|
+ this.$emit("deleteScene", ...params);
|
|
|
},
|
|
|
|
|
|
onRequestForAddGroup() {
|
|
|
- this.$emit('addGroup', this.groupNode.id)
|
|
|
+ this.$emit("addGroup", this.groupNode.id);
|
|
|
},
|
|
|
onRequestForAddScene() {
|
|
|
- this.isShowSelectionWindow = true
|
|
|
+ this.isShowSelectionWindow = true;
|
|
|
},
|
|
|
onClickForRename() {
|
|
|
- this.isRenaming = true
|
|
|
+ this.isRenaming = true;
|
|
|
console.log(this.groupNode.name);
|
|
|
|
|
|
- if (this.groupNode.name=='默认二级分组') {
|
|
|
- this.newName = this.$i18n.t('navigation.default_group_two')
|
|
|
- } else if (this.groupNode.name=='一级分组') {
|
|
|
- this.newName = this.$i18n.t('navigation.group_one')
|
|
|
- } else{
|
|
|
- this.newName = this.groupNode.name
|
|
|
+ if (this.groupNode.name == "默认二级分组") {
|
|
|
+ this.newName = this.$i18n.t("navigation.default_group_two");
|
|
|
+ } else if (this.groupNode.name == "一级分组") {
|
|
|
+ this.newName = this.$i18n.t("navigation.group_one");
|
|
|
+ } else {
|
|
|
+ this.newName = this.groupNode.name;
|
|
|
}
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
// this.$refs['input-for-rename'].focus()
|
|
|
- this.$refs['input-for-rename'].select()
|
|
|
- this.$refs['input-for-rename'].scrollIntoView({
|
|
|
- behavior: 'smooth',
|
|
|
- })
|
|
|
- })
|
|
|
+ this.$refs["input-for-rename"].select();
|
|
|
+ this.$refs["input-for-rename"].scrollIntoView({
|
|
|
+ behavior: "smooth",
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
onInputNewNameComplete() {
|
|
|
- this.isRenaming = false
|
|
|
+ this.isRenaming = false;
|
|
|
console.log(this.groupNode.name);
|
|
|
if (!this.newName.trim()) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
if (this.newName !== this.groupNode.name) {
|
|
|
- this.$emit('renameGroup', this.groupNode.id, this.level, this.newName)
|
|
|
+ this.$emit("renameGroup", this.groupNode.id, this.level, this.newName);
|
|
|
}
|
|
|
- this.newName = ''
|
|
|
+ this.newName = "";
|
|
|
},
|
|
|
onInputEnter() {
|
|
|
- this.isRenaming = false // 会导致input blur,进而触发onInputNewNameComplete
|
|
|
+ this.isRenaming = false; // 会导致input blur,进而触发onInputNewNameComplete
|
|
|
},
|
|
|
onInnerGroupRename(...params) {
|
|
|
- this.$emit('renameGroup', ...params)
|
|
|
+ this.$emit("renameGroup", ...params);
|
|
|
},
|
|
|
|
|
|
onRequestForDelete() {
|
|
|
- this.isConfirmingDeletion = true
|
|
|
+ this.isConfirmingDeletion = true;
|
|
|
},
|
|
|
onRequestForCancelDelete() {
|
|
|
if (!this.isConfirmingDeletion) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
// 先保持isConfirmingDeletion不变,因为onClickTopBar可能要用到
|
|
|
setTimeout(() => {
|
|
|
- this.isConfirmingDeletion = false
|
|
|
+ this.isConfirmingDeletion = false;
|
|
|
}, 0);
|
|
|
},
|
|
|
onConfirmDelete() {
|
|
|
- this.$emit('deleteGroup', this.groupNode.id, this.level)
|
|
|
- this.isConfirmingDeletion = false
|
|
|
+ this.$emit("deleteGroup", this.groupNode.id, this.level);
|
|
|
+ this.isConfirmingDeletion = false;
|
|
|
},
|
|
|
onInnerGroupConfirmDelete(...params) {
|
|
|
- this.$emit('deleteGroup', ...params)
|
|
|
+ this.$emit("deleteGroup", ...params);
|
|
|
},
|
|
|
onSubmitFromMaterialSelector(selected) {
|
|
|
- let newScenes = []
|
|
|
+ let newScenes = [];
|
|
|
for (const item of selected) {
|
|
|
- if (item.materialType === 'pano') {
|
|
|
+ if (item.materialType === "pano") {
|
|
|
newScenes.push({
|
|
|
icon: item.icon,
|
|
|
sceneCode: item.sceneCode,
|
|
|
sceneTitle: item.name,
|
|
|
- category: this.level === 1 ? this.groupNode.children[0].id : this.groupNode.id,
|
|
|
+ category:
|
|
|
+ this.level === 1
|
|
|
+ ? this.groupNode.children[0].id
|
|
|
+ : this.groupNode.id,
|
|
|
type: "pano",
|
|
|
- id: 's_' + this.$randomWord(true, 8, 8)
|
|
|
- })
|
|
|
- } else if (item.materialType === '3D') {
|
|
|
+ id: "s_" + this.$randomWord(true, 8, 8),
|
|
|
+ });
|
|
|
+ } else if (item.materialType === "3D") {
|
|
|
+ console.log("item.num", item.num);
|
|
|
newScenes.push({
|
|
|
icon: item.thumb,
|
|
|
sceneCode: item.num,
|
|
|
sceneTitle: item.sceneName,
|
|
|
- category: this.level === 1 ? this.groupNode.children[0].id : this.groupNode.id,
|
|
|
+ category:
|
|
|
+ this.level === 1
|
|
|
+ ? this.groupNode.children[0].id
|
|
|
+ : this.groupNode.id,
|
|
|
type: "4dkk",
|
|
|
- version: item.buildType, // 'V3' OR 'V4'. 全景看看v1.3新增
|
|
|
- id:'s_'+this.$randomWord(true,8,8)
|
|
|
- })
|
|
|
+ version: item.isUpgrade === 1 ? "V4" : "V3", // 'V3' OR 'V4'. 全景看看v1.3新增
|
|
|
+ id: "s_" + this.$randomWord(true, 8, 8),
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- let allSuccess = true
|
|
|
+ let allSuccess = true;
|
|
|
newScenes.forEach((item, i) => {
|
|
|
- let temp = this.info.scenes.find(eachScene => {
|
|
|
- return eachScene.sceneCode === item.sceneCode
|
|
|
- })
|
|
|
+ let temp = this.info.scenes.find((eachScene) => {
|
|
|
+ return eachScene.sceneCode === item.sceneCode;
|
|
|
+ });
|
|
|
if (temp) {
|
|
|
setTimeout(() => {
|
|
|
this.$msg.message(
|
|
|
- `${item.type == '4dkk' ? this.$i18n.t('navigation.scene_name') : this.$i18n.t('navigation.pano')}${this.$i18n.t('navigation.already_exists',{msg:item.sceneTitle})}`)
|
|
|
- }, i * 100)
|
|
|
- allSuccess = false
|
|
|
- return
|
|
|
+ `${
|
|
|
+ item.type == "4dkk"
|
|
|
+ ? this.$i18n.t("navigation.scene_name")
|
|
|
+ : this.$i18n.t("navigation.pano")
|
|
|
+ }${this.$i18n.t("navigation.already_exists", {
|
|
|
+ msg: item.sceneTitle,
|
|
|
+ })}`
|
|
|
+ );
|
|
|
+ }, i * 100);
|
|
|
+ allSuccess = false;
|
|
|
+ return;
|
|
|
}
|
|
|
- this.info.scenes.push(item)
|
|
|
- })
|
|
|
+ this.info.scenes.push(item);
|
|
|
+ });
|
|
|
|
|
|
- this.isShowSelectionWindow = false
|
|
|
+ this.isShowSelectionWindow = false;
|
|
|
if (allSuccess) {
|
|
|
- this.$msg.success(this.$i18n.t('gather.success'))
|
|
|
+ this.$msg.success(this.$i18n.t("gather.success"));
|
|
|
}
|
|
|
},
|
|
|
onDragStart(e) {
|
|
|
if (this.isRenaming) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- this.recordDragType(`topologyGroupLevel${this.level}`)
|
|
|
- this.recordDragNode(this.groupNode)
|
|
|
- e.dataTransfer.setDragImage(this.$refs['drag-image'], -10, -18)
|
|
|
+ this.recordDragType(`topologyGroupLevel${this.level}`);
|
|
|
+ this.recordDragNode(this.groupNode);
|
|
|
+ e.dataTransfer.setDragImage(this.$refs["drag-image"], -10, -18);
|
|
|
},
|
|
|
onDragEnter(e) {
|
|
|
- if (e.target.contains(e.relatedTarget) || (this.level === 2 && this.dragInfo.type.includes('Group'))) {
|
|
|
- return
|
|
|
+ if (
|
|
|
+ e.target.contains(e.relatedTarget) ||
|
|
|
+ (this.level === 2 && this.dragInfo.type.includes("Group"))
|
|
|
+ ) {
|
|
|
+ return;
|
|
|
}
|
|
|
this.dragEnterTimerId = setTimeout(() => {
|
|
|
if (!this.isExpanded) {
|
|
|
- this.isExpanded = true
|
|
|
+ this.isExpanded = true;
|
|
|
}
|
|
|
- }, 700)
|
|
|
+ }, 700);
|
|
|
},
|
|
|
onDragEnd() {
|
|
|
- this.clearDragInfo()
|
|
|
- clearTimeout(this.dragEnterTimerId)
|
|
|
+ this.clearDragInfo();
|
|
|
+ clearTimeout(this.dragEnterTimerId);
|
|
|
},
|
|
|
onDragLeave(e) {
|
|
|
if (e.target.contains(e.relatedTarget)) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- clearTimeout(this.dragEnterTimerId)
|
|
|
- }
|
|
|
- },
|
|
|
- mounted() {
|
|
|
+ clearTimeout(this.dragEnterTimerId);
|
|
|
+ },
|
|
|
},
|
|
|
- destroyed() {
|
|
|
- }
|
|
|
-}
|
|
|
+ mounted() {},
|
|
|
+ destroyed() {},
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
@@ -400,7 +437,10 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
&.show-icons-on-hover:hover {
|
|
|
- > .icon-add, .icon-image, .icon-edit, .icon-delete {
|
|
|
+ > .icon-add,
|
|
|
+ .icon-image,
|
|
|
+ .icon-edit,
|
|
|
+ .icon-delete {
|
|
|
display: block;
|
|
|
}
|
|
|
}
|
|
@@ -409,7 +449,7 @@ export default {
|
|
|
width: 40px;
|
|
|
height: 40px;
|
|
|
background: #313131;
|
|
|
- box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.5);
|
|
|
+ box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.5);
|
|
|
border-radius: 4px;
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
@@ -491,7 +531,7 @@ export default {
|
|
|
top: 0;
|
|
|
bottom: 0;
|
|
|
width: 100%;
|
|
|
- background: #FA5555;
|
|
|
+ background: #fa5555;
|
|
|
transition: right 0.3s;
|
|
|
cursor: pointer;
|
|
|
text-align: center;
|
|
@@ -499,7 +539,7 @@ export default {
|
|
|
color: #fff;
|
|
|
pointer-events: auto;
|
|
|
&::after {
|
|
|
- content: '';
|
|
|
+ content: "";
|
|
|
height: 100%;
|
|
|
vertical-align: middle;
|
|
|
display: inline-block;
|
|
@@ -517,18 +557,18 @@ export default {
|
|
|
flex: 1 1 auto;
|
|
|
width: 1px;
|
|
|
height: 30px;
|
|
|
- background: #1A1B1D;
|
|
|
+ background: #1a1b1d;
|
|
|
border-radius: 2px;
|
|
|
border: 1px solid #404040;
|
|
|
color: #fff;
|
|
|
font-size: 14px;
|
|
|
padding: 0 10px 0 16px;
|
|
|
&:focus {
|
|
|
- border-color: #0076F6;
|
|
|
+ border-color: #0076f6;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
.group-content {
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|