|
@@ -5,18 +5,31 @@
|
|
|
{{ 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 iconeditor_preview"></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 iconeditor_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>
|
|
@@ -24,7 +37,7 @@ import { saveWorks, getPanoInfo, checkLogin } from "@/api";
|
|
|
import { mapGetters } from "vuex";
|
|
|
// import config from '@/config'
|
|
|
import preview from "@/components/preview";
|
|
|
-import { i18n } from "@/lang"
|
|
|
+import { i18n } from "@/lang";
|
|
|
import { $waiting } from "@/components/shared/loading";
|
|
|
|
|
|
let hhhreg = /\\\\\\\\/g;
|
|
@@ -37,7 +50,6 @@ export default {
|
|
|
preview: i18n.t("edit_page.preview"),
|
|
|
savetips: i18n.t("edit_page.save"),
|
|
|
|
|
|
-
|
|
|
showPreview: false,
|
|
|
canLoad: false,
|
|
|
};
|
|
@@ -52,8 +64,8 @@ export default {
|
|
|
this.getInfo().then((res) => {
|
|
|
// getInfo里调用了后端接口,底层用了jquery的网络请求方法,为啥会导致promise嵌套没有展平,res拿到的不是promise 对象的resolve值而是promise对象本身????
|
|
|
res.then(() => {
|
|
|
- this.$store.commit("TakeInfoSnapShotAtSave")
|
|
|
- })
|
|
|
+ this.$store.commit("TakeInfoSnapShotAtSave");
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
});
|
|
@@ -69,9 +81,14 @@ 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'),
|
|
|
+ content: this.$i18n.t("gather.nothing_edit"),
|
|
|
ok: () => {
|
|
|
this.$router.push({ path: "/base" });
|
|
|
},
|
|
@@ -91,7 +108,7 @@ export default {
|
|
|
}
|
|
|
return item;
|
|
|
});
|
|
|
- $waiting.show()
|
|
|
+ $waiting.show();
|
|
|
|
|
|
saveWorks(
|
|
|
{
|
|
@@ -99,7 +116,7 @@ export default {
|
|
|
someData: { ...this.info, status: 1 },
|
|
|
},
|
|
|
() => {
|
|
|
- this.$msg.success(this.$i18n.t('gather.save_done'));
|
|
|
+ this.$msg.success(this.$i18n.t("gather.save_done"));
|
|
|
document.title = this.info.name;
|
|
|
// this.getInfo().then((res) => {
|
|
|
// // getInfo里调用了后端接口,底层用了jquery的网络请求方法,为啥会导致promise嵌套没有展平,res拿到的不是promise 对象的resolve值而是promise对象本身????
|
|
@@ -116,10 +133,10 @@ export default {
|
|
|
// }, 500);
|
|
|
// })
|
|
|
// });
|
|
|
- $waiting.hide()
|
|
|
+ $waiting.hide();
|
|
|
if (this.info.scenes.length <= 0 && this.isShow) {
|
|
|
return this.$alert({
|
|
|
- content: this.$i18n.t('gather.at_least_one_scene'),
|
|
|
+ content: this.$i18n.t("gather.at_least_one_scene"),
|
|
|
});
|
|
|
}
|
|
|
this.showPreview = true;
|
|
@@ -134,9 +151,58 @@ 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
|
|
|
+ );
|
|
|
}
|
|
|
- // fodderId:[] 资源引用给后端
|
|
|
+ const scenes = this.info.scenes;
|
|
|
+ if (scenes && scenes.length > 0) {
|
|
|
+ scenes.forEach((scene, index) => {
|
|
|
+ if (
|
|
|
+ scene.someData &&
|
|
|
+ scene.someData.hotspots &&
|
|
|
+ scene.someData.hotspots.length > 0
|
|
|
+ ) {
|
|
|
+ this.lockHotspotResourceTree(index, scene.someData.hotspots);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // this.lockHotspotResourceTree();
|
|
|
+ // fodderId:[] 资源引用给后端
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 给热点的资源引用上锁
|
|
|
+ */
|
|
|
+ lockHotspotResourceTree(sceneIndex, hotspots) {
|
|
|
+ hotspots.forEach((item, index) => {
|
|
|
+ const target = this.info.scenes[sceneIndex].someData.hotspots[index];
|
|
|
+ let fodderId = [];
|
|
|
+
|
|
|
+ switch (item.hotspotType) {
|
|
|
+ case "image":
|
|
|
+ fodderId = target.image.reduce((p, c) => p.concat(c["id"]), []);
|
|
|
+ target.fodderId = fodderId;
|
|
|
+ break;
|
|
|
+ case "audio":
|
|
|
+ target.fodderId = [target.audio.id];
|
|
|
+ break;
|
|
|
+ case "imageText":
|
|
|
+ fodderId = target.imageTextInfo.imageList.reduce(
|
|
|
+ (p, c) => p.concat(c["id"]),
|
|
|
+ []
|
|
|
+ );
|
|
|
+ fodderId.push(target.imageTextInfo.audio.id);
|
|
|
+ target.fodderId = fodderId;
|
|
|
+ break;
|
|
|
+ case "video":
|
|
|
+ target.fodderId = [target.video.id];
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ target.fodderId = [];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
onSave() {
|
|
@@ -151,7 +217,7 @@ export default {
|
|
|
}
|
|
|
return item;
|
|
|
});
|
|
|
- $waiting.show()
|
|
|
+ $waiting.show();
|
|
|
|
|
|
saveWorks(
|
|
|
{
|
|
@@ -159,61 +225,80 @@ export default {
|
|
|
someData: { ...this.info, status: 1 },
|
|
|
},
|
|
|
() => {
|
|
|
- this.$msg.success(this.$i18n.t('gather.save_done'));
|
|
|
+ this.$msg.success(this.$i18n.t("gather.save_done"));
|
|
|
document.title = this.info.name;
|
|
|
- $waiting.hide()
|
|
|
+ $waiting.hide();
|
|
|
// this.getInfo();
|
|
|
// this.$store.commit("UpdateIsShowState", true);
|
|
|
- this.$store.commit("TakeInfoSnapShotAtSave")
|
|
|
+ this.$store.commit("TakeInfoSnapShotAtSave");
|
|
|
},
|
|
|
- () => { }
|
|
|
+ () => {}
|
|
|
);
|
|
|
},
|
|
|
getInfo() {
|
|
|
return checkLogin().then((res) => {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- $waiting.hide()
|
|
|
+ $waiting.hide();
|
|
|
|
|
|
if (res.code == 0) {
|
|
|
- $waiting.show()
|
|
|
- getPanoInfo("", (data) => {
|
|
|
- this.$store.commit("SetInfo", data);
|
|
|
- this.$store.commit("scene/setScenes", data.scenes);
|
|
|
- $waiting.hide()
|
|
|
+ $waiting.show();
|
|
|
+ getPanoInfo(
|
|
|
+ "",
|
|
|
+ (data) => {
|
|
|
+ this.$store.commit("SetInfo", data);
|
|
|
+ this.$store.commit("scene/setScenes", data.scenes);
|
|
|
+ $waiting.hide();
|
|
|
|
|
|
- let firstScene = "";
|
|
|
+ let firstScene = "";
|
|
|
|
|
|
- if (data.firstScene) {
|
|
|
- firstScene = data.scenes.find((item) => item.sceneCode == data.firstScene.sceneCode);
|
|
|
- }
|
|
|
+ if (data.firstScene) {
|
|
|
+ firstScene = data.scenes.find(
|
|
|
+ (item) => item.sceneCode == data.firstScene.sceneCode
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
- //判断列表里是否有全景图
|
|
|
- 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')
|
|
|
- }
|
|
|
+ //判断列表里是否有全景图
|
|
|
+ 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");
|
|
|
+ }
|
|
|
|
|
|
- console.log(firstScene, 'firstScene');
|
|
|
- this.$store.commit("scene/setCurrentScene", firstScene || data.scenes[0]);
|
|
|
+ console.log(firstScene, "firstScene");
|
|
|
+ this.$store.commit(
|
|
|
+ "scene/setCurrentScene",
|
|
|
+ firstScene || data.scenes[0]
|
|
|
+ );
|
|
|
|
|
|
- // 查询初始场景的所在1级分组
|
|
|
- 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);
|
|
|
- if (temp) {
|
|
|
- this.$store.commit("scene/setCurrentCatalogRoot", item);
|
|
|
- return;
|
|
|
- }
|
|
|
- });
|
|
|
- resolve()
|
|
|
- }, (err) => {
|
|
|
- reject(err)
|
|
|
- });
|
|
|
+ // 查询初始场景的所在1级分组
|
|
|
+ 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);
|
|
|
+ if (temp) {
|
|
|
+ this.$store.commit("scene/setCurrentCatalogRoot", item);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ resolve();
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ reject(err);
|
|
|
+ }
|
|
|
+ );
|
|
|
} else {
|
|
|
- reject()
|
|
|
+ reject();
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
},
|
|
@@ -237,7 +322,7 @@ export default {
|
|
|
top: 50%;
|
|
|
transform: translateY(-50%);
|
|
|
|
|
|
- >i {
|
|
|
+ > i {
|
|
|
margin-right: 15px;
|
|
|
}
|
|
|
}
|