TrembleC 3 years ago
parent
commit
7f4de9ef9e

+ 9 - 0
src/pages/mobilescene/scene.vue

@@ -71,6 +71,15 @@ export default {
 
       if (data.events == "toggleTour") {
         ifrWindow[data.data]();
+        if (data.data == "startAndPlay") {
+          ifrWindow.postMessage(
+            {
+              source: "clickStartAndPlay",
+              data: "clickStartAndPlay",
+            },
+            "*"
+          );
+        }
       }
     });
   },

+ 1 - 0
src/pages/scene/raside/rmenu.vue

@@ -86,6 +86,7 @@ export default {
     onClick(item) {
       if (item.id == "play") {
         this.$emit("play");
+        this.$bus.$emit('startPlay')
         window.goldlog.record(`/spec.1.1`, "", `snsScene=p_func7&product=pcweb&pagename=中国网络文明建设成果展云展示`, "");
         return;
       }

+ 48 - 15
src/pages/scene/scene.vue

@@ -1,6 +1,13 @@
 <template>
   <div class="scene-body">
-    <iframe ref="ifr" id="ifr" :key="viewId" :src="`scene.html?m=1248${boothItem || firstView[viewId]}`" allowfullscreen="true" frameborder="0"></iframe>
+    <iframe
+      ref="ifr"
+      id="ifr"
+      :key="viewId"
+      :src="`scene.html?m=1248${boothItem || firstView[viewId]}`"
+      allowfullscreen="true"
+      frameborder="0"
+    ></iframe>
   </div>
 </template>
 
@@ -11,7 +18,13 @@ 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}`;
+  firstView[item.id] = `&firstView=pano:${item.firstView.panoId},qua:${x +
+    ", " +
+    y +
+    ", " +
+    z +
+    ", " +
+    w}`;
 });
 
 export default {
@@ -28,24 +41,30 @@ export default {
     boothItem: function() {
       let tmp = "";
       if (this.boothId) {
-        let tt = ''
-        let cutt = ''
+        let tt = "";
+        let cutt = "";
         for (let index = 0; index < Booth.length; index++) {
           const item = Booth[index];
-          tt = item.company.filter(sub=>sub.panoId==this.boothId)
-          if (tt.length>0) {
-            cutt = tt[0]
-            break
+          tt = item.company.filter((sub) => sub.panoId == this.boothId);
+          if (tt.length > 0) {
+            cutt = tt[0];
+            break;
           }
         }
 
-        if (tt.length>1&&this.boothRepeat) {
-          cutt = tt[this.boothRepeat.split('_')[1]]
+        if (tt.length > 1 && this.boothRepeat) {
+          cutt = tt[this.boothRepeat.split("_")[1]];
         }
 
         let panoQuat = cutt && cutt.firstView.split("qua:")[1];
         let [x, y, z, w] = panoQuat.split(",");
-        tmp = `&firstView=pano:${cutt.panoId},qua:${x + ", " + y + ", " + z + ", " + w}`;
+        tmp = `&firstView=pano:${cutt.panoId},qua:${x +
+          ", " +
+          y +
+          ", " +
+          z +
+          ", " +
+          w}`;
       }
       return tmp;
     },
@@ -56,18 +75,32 @@ export default {
       if (data.events == "flyToPano") {
         let panoQuat = data.data.firstView.split("qua:")[1];
         let [x, y, z, w] = panoQuat.split(",");
-        let fnname = 'flyToPano'
-        if (ifrWindow.player.mode == 'panorama') {
-          fnname = '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)),
+          quaternion: new ifrWindow.THREE.Quaternion(
+            Number(x),
+            Number(y),
+            Number(z),
+            Number(w)
+          ),
         });
       }
 
       if (data.events == "toggleTour") {
         ifrWindow[data.data]();
+        if (data.data == "startAndPlay") {
+          ifrWindow.postMessage(
+            {
+              source: "clickStartAndPlay",
+              data: "clickStartAndPlay",
+            },
+            "*"
+          );
+        }
       }
     });
   },

+ 5 - 0
src/pages/scenePage/index.vue

@@ -256,6 +256,11 @@ export default {
             // this.$store.dispatch("changeTheme", data.data);
           }
 
+            if (res.data.source === "clickStartAndPlay") {
+            this.$bus.$emit("startPlay")
+            // this.$store.dispatch("changeTheme", data.data);
+          }
+
           if (res.data.source === "changeTheme") {
             this.themescene = data;
             // this.$store.dispatch("changeTheme", data.data);

+ 32 - 8
src/pages/scenePage/views/gui/guide.vue

@@ -1,5 +1,10 @@
 <template>
-  <div id="drawer-container" :class="{ hiddenzhangxiang: !isZhankai && isTour, heping: g_isLandscape }" @touchstart.stop @click.stop>
+  <div
+    id="drawer-container"
+    :class="{ hiddenzhangxiang: !isZhankai && isTour, heping: g_isLandscape }"
+    @touchstart.stop
+    @click.stop
+  >
     <div class="stoptour">
       <template>
         <div @click.stop="stop()">
@@ -9,7 +14,9 @@
           <div
             @click="isZhankai = !isZhankai"
             :class="{ iactive: !isZhankai }"
-            :style="{ backgroundImage: `url(${require(`@/assets/images/proj2022/xueliezhen/project.png`)})` }"
+            :style="{
+              backgroundImage: `url(${require(`@/assets/images/proj2022/xueliezhen/project.png`)})`,
+            }"
           ></div>
         </div>
       </template>
@@ -18,7 +25,7 @@
     <div id="drawer" class="fullWidth open">
       <div class="frame-container">
         <div id="scrollFrame" class="frame">
-          <ul id="thumb-container" class="slidee" ></ul>
+          <ul id="thumb-container" class="slidee"></ul>
         </div>
         <div class="scrollbar" id="scroller">
           <div class="handle"></div>
@@ -53,13 +60,22 @@ export default {
     isTour(newVal) {
       if (newVal) {
         this.isZhankai = true;
+        // setTimeout(() => {
+        //   this.isZhankai = false;
+        // }, 1000);
+      }
+    },
+  },
+  mounted() {
+    this.$nextTick(() => {
+      this.$bus.$on("startPlay", () => {
+        this.isZhankai = true;
         setTimeout(() => {
           this.isZhankai = false;
         }, 1000);
-      }
-    },
+      });
+    });
   },
-  mounted() {},
 };
 </script>
 
@@ -97,7 +113,11 @@ export default {
               left: 0;
               top: 0;
               pointer-events: none;
-              background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.8) 100%);
+              background: linear-gradient(
+                180deg,
+                rgba(0, 0, 0, 0.5) 0%,
+                rgba(0, 0, 0, 0.8) 100%
+              );
             }
             &.active {
               border: 2px solid rgb(36, 139, 235);
@@ -199,7 +219,11 @@ export default {
                 left: 0;
                 top: 0;
                 // pointer-events: none;
-                background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.8) 100%);
+                background: linear-gradient(
+                  180deg,
+                  rgba(0, 0, 0, 0.5) 0%,
+                  rgba(0, 0, 0, 0.8) 100%
+                );
               }
               &.active {
                 border: solid 4px #3a9efc;