|
@@ -1,67 +1,75 @@
|
|
|
<template>
|
|
|
<div class="scene-body">
|
|
|
- <iframe
|
|
|
- ref="ifr"
|
|
|
- id="ifr"
|
|
|
- :key="viewId"
|
|
|
- :src="`scene.html?m=1204${boothItem||firstView[viewId]}`"
|
|
|
- allowfullscreen="true"
|
|
|
- frameborder="0"
|
|
|
- ></iframe>
|
|
|
+ <iframe ref="ifr" id="ifr" :key="viewId" :src="`scene.html?m=1204${boothItem || firstView[viewId]}`" allowfullscreen="true" frameborder="0"></iframe>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {region,Booth} from "@/data/raw.js";
|
|
|
-let firstView = {}
|
|
|
-region.forEach(item=>{
|
|
|
- let {x,y,z,w} = item.firstView.panoQuaternion
|
|
|
- firstView[item.id] = `&firstView=pano:${item.firstView.panoId},qua:${x+', '+y+', '+z+', '+w}`
|
|
|
-})
|
|
|
+import { region } from "@/data/raw.js";
|
|
|
+import { Booth } from "@/data/booth.js";
|
|
|
+
|
|
|
+let firstView = {};
|
|
|
+region.forEach((item) => {
|
|
|
+ let { x, y, z, w } = item.firstView.panoQuaternion;
|
|
|
+ firstView[item.id] = `&firstView=pano:${item.firstView.panoId},qua:${x + ", " + y + ", " + z + ", " + w}`;
|
|
|
+});
|
|
|
|
|
|
export default {
|
|
|
props: ["tourStatus"],
|
|
|
- data(){
|
|
|
+ data() {
|
|
|
return {
|
|
|
firstView,
|
|
|
- viewId:this.$route.params.type,
|
|
|
- boothId:this.$route.query.boothId,
|
|
|
- }
|
|
|
+ viewId: this.$route.params.type,
|
|
|
+ boothId: this.$route.query.boothId,
|
|
|
+ };
|
|
|
},
|
|
|
|
|
|
- computed:{
|
|
|
- boothItem:function () {
|
|
|
- let tmp = ''
|
|
|
+ computed: {
|
|
|
+ boothItem: function() {
|
|
|
+ let tmp = "";
|
|
|
if (this.boothId) {
|
|
|
- let tt = Booth.find(item=>item.id == this.boothId)
|
|
|
- let {x,y,z,w} = tt.panoQuaternion
|
|
|
- tmp = `&firstView=pano:${tt.panoId},qua:${x+', '+y+', '+z+', '+w}`
|
|
|
+ let tt = ''
|
|
|
+ for (let index = 0; index < Booth.length; index++) {
|
|
|
+ const item = Booth[index];
|
|
|
+ tt = item.company.find(sub=>sub.panoId==this.boothId)
|
|
|
+ if (tt) {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ let panoQuat = tt.firstView.split("qua:")[1];
|
|
|
+ let [x, y, z, w] = panoQuat.split(",");
|
|
|
+ tmp = `&firstView=pano:${tt.panoId},qua:${x + ", " + y + ", " + z + ", " + w}`;
|
|
|
}
|
|
|
- return tmp
|
|
|
- }
|
|
|
+ return tmp;
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
- let ifrWindow = this.$refs.ifr.contentWindow
|
|
|
- this.$bus.$on('ifrMessage',(data)=>{
|
|
|
+ let ifrWindow = this.$refs.ifr.contentWindow;
|
|
|
+ this.$bus.$on("ifrMessage", (data) => {
|
|
|
if (data.events == "flyToPano") {
|
|
|
let panoQuat = data.data.firstView.split("qua:")[1];
|
|
|
let [x, y, z, w] = panoQuat.split(",");
|
|
|
- ifrWindow.player.blackToPano({
|
|
|
+ let fnname = "flyToPano";
|
|
|
+ if (ifrWindow.player.mode == "panorama") {
|
|
|
+ fnname = "blackToPano";
|
|
|
+ }
|
|
|
+ ifrWindow.player[fnname]({
|
|
|
pano: ifrWindow.player.model.panos.index[data.data.panoId],
|
|
|
quaternion: new ifrWindow.THREE.Quaternion(Number(x), Number(y), Number(z), Number(w)),
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- if (data.events=='toggleTour') {
|
|
|
- ifrWindow[data.data]()
|
|
|
+ if (data.events == "toggleTour") {
|
|
|
+ ifrWindow[data.data]();
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
watch: {
|
|
|
theme(newVal) {
|
|
|
- let currentRegion = region.find(item=>item.id==newVal)
|
|
|
- window.g_lock = true
|
|
|
- if (this.$route.params.isjump=='yes') {
|
|
|
+ let currentRegion = region.find((item) => item.id == newVal);
|
|
|
+ window.g_lock = true;
|
|
|
+ if (this.$route.params.isjump == "yes") {
|
|
|
this.$refs.ifr.contentWindow.postMessage(
|
|
|
{
|
|
|
source: "changeExhition",
|