|
@@ -1,38 +1,20 @@
|
|
|
<template>
|
|
|
<header class="app-head" app-border dir-bottom>
|
|
|
- <a
|
|
|
- class="app-head-back"
|
|
|
- :href="`./material.html?lang=${$lang}&from=${routerForm}#/works`"
|
|
|
- >
|
|
|
+ <a class="app-head-back" :href="`./material.html?lang=${$lang}&from=${routerForm}#/works`">
|
|
|
<i class="iconfont icon-editor_return"></i>
|
|
|
{{ back_myworks }}
|
|
|
</a>
|
|
|
<span class="app-head-title">{{ info.name }}</span>
|
|
|
- <div
|
|
|
- class="app-head-save ui-button deepcancel app-head-view"
|
|
|
- @click="onView"
|
|
|
- :class="{ disable: !canLoad || isEditing }"
|
|
|
- >
|
|
|
+ <div class="app-head-save ui-button deepcancel app-head-view" @click="onView" :class="{ disable: !canLoad || isEditing }">
|
|
|
<i class="iconfont icon-editor_play"></i>
|
|
|
{{ preview }}
|
|
|
</div>
|
|
|
|
|
|
- <div
|
|
|
- class="ui-button submit app-head-save"
|
|
|
- @click="onSave"
|
|
|
- :class="{ disable: !canLoad || isEditing }"
|
|
|
- >
|
|
|
+ <div class="ui-button submit app-head-save" @click="onSave" :class="{ disable: !canLoad || isEditing }">
|
|
|
<i class="iconfont icon-editor_save"></i>
|
|
|
{{ savetips }}
|
|
|
</div>
|
|
|
- <preview
|
|
|
- v-if="info"
|
|
|
- :key="Math.random()"
|
|
|
- :name="info.name"
|
|
|
- :show="showPreview"
|
|
|
- :ifr="`./show.html?id=${info.id}&lang=${$lang}&rnd=${Math.random()}`"
|
|
|
- @close="showPreview = false"
|
|
|
- />
|
|
|
+ <preview v-if="info" :key="Math.random()" :name="info.name" :show="showPreview" :ifr="`./show.html?id=${info.id}&lang=${$lang}&rnd=${Math.random()}`" @close="showPreview = false" />
|
|
|
</header>
|
|
|
</template>
|
|
|
<script>
|
|
@@ -89,12 +71,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
checkParams() {
|
|
|
- if (
|
|
|
- !this.info.name &&
|
|
|
- !this.info.icon &&
|
|
|
- !this.info.description &&
|
|
|
- this.info.scenes.length <= 0
|
|
|
- ) {
|
|
|
+ if (!this.info.name && !this.info.icon && !this.info.description && this.info.scenes.length <= 0) {
|
|
|
this.$alert({
|
|
|
content: this.$i18n.t("gather.nothing_edit"),
|
|
|
ok: () => {
|
|
@@ -162,19 +139,13 @@ export default {
|
|
|
}
|
|
|
|
|
|
if (this.info.firstScene) {
|
|
|
- this.info.firstScene = this.info.scenes.find(
|
|
|
- (item) => item.sceneCode == this.info.firstScene.sceneCode
|
|
|
- );
|
|
|
+ this.info.firstScene = this.info.scenes.find((item) => item.sceneCode == this.info.firstScene.sceneCode);
|
|
|
}
|
|
|
const scenes = this.info.scenes;
|
|
|
// debugger
|
|
|
if (scenes && scenes.length > 0) {
|
|
|
scenes.forEach((scene, index) => {
|
|
|
- if (
|
|
|
- scene.someData &&
|
|
|
- scene.someData.hotspots &&
|
|
|
- scene.someData.hotspots.length > 0
|
|
|
- ) {
|
|
|
+ if (scene.someData && scene.someData.hotspots && scene.someData.hotspots.length > 0) {
|
|
|
this.lockHotspotResourceTree(index, scene.someData.hotspots);
|
|
|
}
|
|
|
});
|
|
@@ -182,34 +153,19 @@ export default {
|
|
|
//开场校验
|
|
|
if (this.info.coverInfo.isShowCover === 1) {
|
|
|
if (this.info.coverInfo.coverSelect === "videoAndImg") {
|
|
|
- if (
|
|
|
- !this.info.coverInfo.coverPc ||
|
|
|
- !this.info.coverInfo.coverMo ||
|
|
|
- !this.info.coverInfo.videoPc ||
|
|
|
- !this.info.coverInfo.videoMo
|
|
|
- ) {
|
|
|
+ if (!this.info.coverInfo.coverPc || !this.info.coverInfo.coverMo || !this.info.coverInfo.videoPc || !this.info.coverInfo.videoMo) {
|
|
|
this.$msg.warning(this.$i18n.t("gather.converinfo_no_valid"));
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
if (this.info.coverInfo.coverSelect === "video") {
|
|
|
- if (
|
|
|
- !this.info.coverInfo.videoPc ||
|
|
|
- !this.info.coverInfo.videoMo ||
|
|
|
- this.info.coverInfo.videoPc == "" ||
|
|
|
- this.info.coverInfo.videoMo == ""
|
|
|
- ) {
|
|
|
+ if (!this.info.coverInfo.videoPc || !this.info.coverInfo.videoMo || this.info.coverInfo.videoPc == "" || this.info.coverInfo.videoMo == "") {
|
|
|
this.$msg.warning(this.$i18n.t("gather.converinfo_no_valid"));
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
if (this.info.coverInfo.coverSelect === "img") {
|
|
|
- if (
|
|
|
- !this.info.coverInfo.coverPc ||
|
|
|
- !this.info.coverInfo.coverMo ||
|
|
|
- this.info.coverInfo.coverPc == "" ||
|
|
|
- this.info.coverInfo.coverMo == ""
|
|
|
- ) {
|
|
|
+ if (!this.info.coverInfo.coverPc || !this.info.coverInfo.coverMo || this.info.coverInfo.coverPc == "" || this.info.coverInfo.coverMo == "") {
|
|
|
this.$msg.warning(this.$i18n.t("gather.converinfo_no_valid"));
|
|
|
return false;
|
|
|
}
|
|
@@ -237,20 +193,15 @@ export default {
|
|
|
|
|
|
switch (item.hotspotType) {
|
|
|
case "image":
|
|
|
- fodderId = target.image
|
|
|
- .reduce((p, c) => p.concat(c["id"]), [])
|
|
|
- .map((i) => i);
|
|
|
+ fodderId = target.image.reduce((p, c) => p.concat(c["id"]), []).map((i) => i);
|
|
|
target.fodderId = fodderId;
|
|
|
break;
|
|
|
case "audio":
|
|
|
target.fodderId = [target.audio.id].map((i) => i);
|
|
|
break;
|
|
|
case "imageText":
|
|
|
- fodderId = target.imageTextInfo.imageList
|
|
|
- .reduce((p, c) => p.concat(c["id"]), [])
|
|
|
- .map((i) => i);
|
|
|
- target.imageTextInfo.audio.id &&
|
|
|
- fodderId.push(target.imageTextInfo.audio.id);
|
|
|
+ fodderId = target.imageTextInfo.imageList.reduce((p, c) => p.concat(c["id"]), []).map((i) => i);
|
|
|
+ target.imageTextInfo.audio.id && fodderId.push(target.imageTextInfo.audio.id);
|
|
|
target.fodderId = fodderId;
|
|
|
break;
|
|
|
case "video":
|
|
@@ -277,22 +228,24 @@ export default {
|
|
|
});
|
|
|
$waiting.show();
|
|
|
|
|
|
- saveWorks(
|
|
|
- {
|
|
|
- password: this.info.password,
|
|
|
- someData: { ...this.info, status: 1 },
|
|
|
- },
|
|
|
- () => {
|
|
|
- this.$msg.success(this.$i18n.t("gather.save_done"));
|
|
|
- // document.title = this.info.name;
|
|
|
- document.title = this.info.name || this.$i18n.t("gather.no_title");
|
|
|
- $waiting.hide();
|
|
|
- // this.getInfo();
|
|
|
- // this.$store.commit("UpdateIsShowState", true);
|
|
|
- this.$store.commit("TakeInfoSnapShotAtSave");
|
|
|
- },
|
|
|
- () => {}
|
|
|
- );
|
|
|
+ // console.error(this.$router.name)
|
|
|
+ this.$store.dispatch(`${this.$route.name}/save`)
|
|
|
+ // saveWorks(
|
|
|
+ // {
|
|
|
+ // password: this.info.password,
|
|
|
+ // someData: { ...this.info, status: 1 },
|
|
|
+ // },
|
|
|
+ // () => {
|
|
|
+ // this.$msg.success(this.$i18n.t("gather.save_done"));
|
|
|
+ // // document.title = this.info.name;
|
|
|
+ // document.title = this.info.name || this.$i18n.t("gather.no_title");
|
|
|
+ // $waiting.hide();
|
|
|
+ // // this.getInfo();
|
|
|
+ // // this.$store.commit("UpdateIsShowState", true);
|
|
|
+ // this.$store.commit("TakeInfoSnapShotAtSave");
|
|
|
+ // },
|
|
|
+ // () => {}
|
|
|
+ // );
|
|
|
}
|
|
|
},
|
|
|
getInfo() {
|
|
@@ -312,38 +265,23 @@ export default {
|
|
|
let firstScene = "";
|
|
|
|
|
|
if (data.firstScene) {
|
|
|
- firstScene = data.scenes.find(
|
|
|
- (item) => item.sceneCode == data.firstScene.sceneCode
|
|
|
- );
|
|
|
+ firstScene = data.scenes.find((item) => item.sceneCode == data.firstScene.sceneCode);
|
|
|
}
|
|
|
|
|
|
//判断列表里是否有全景图
|
|
|
- if (
|
|
|
- data.scenes.some((item) => item.type == "pano") &&
|
|
|
- firstScene &&
|
|
|
- firstScene.type == "4dkk"
|
|
|
- ) {
|
|
|
+ if (data.scenes.some((item) => item.type == "pano") && firstScene && firstScene.type == "4dkk") {
|
|
|
console.log(this.currentScene.sceneCode);
|
|
|
//如果当前有选中场景,则激活选中场景,无则显示第一个全景图
|
|
|
- firstScene = this.currentScene.sceneCode
|
|
|
- ? this.currentScene
|
|
|
- : data.scenes.find((item) => item.type == "pano");
|
|
|
+ firstScene = this.currentScene.sceneCode ? this.currentScene : data.scenes.find((item) => item.type == "pano");
|
|
|
}
|
|
|
|
|
|
console.log(firstScene, "firstScene");
|
|
|
- this.$store.commit(
|
|
|
- "scene/setCurrentScene",
|
|
|
- firstScene || data.scenes[0]
|
|
|
- );
|
|
|
+ this.$store.commit("scene/setCurrentScene", firstScene || data.scenes[0]);
|
|
|
|
|
|
// 查询初始场景的所在1级分组
|
|
|
- let catalog = data.catalogs.find(
|
|
|
- (item) => item.id == this.currentScene.category
|
|
|
- );
|
|
|
+ let catalog = data.catalogs.find((item) => item.id == this.currentScene.category);
|
|
|
data.catalogRoot.forEach((item) => {
|
|
|
- let temp =
|
|
|
- item.children &&
|
|
|
- item.children.find((sub) => sub == catalog.id);
|
|
|
+ let temp = item.children && item.children.find((sub) => sub == catalog.id);
|
|
|
if (temp) {
|
|
|
this.$store.commit("scene/setCurrentCatalogRoot", item);
|
|
|
return;
|