Przeglądaj źródła

支持场景跳转、指定跳转后初始视角。

任一存 2 lat temu
rodzic
commit
0c8374b279
2 zmienionych plików z 26 dodań i 41 usunięć
  1. 7 40
      public/static/js/Hot.js
  2. 19 1
      src/views/gui/menu.vue

+ 7 - 40
public/static/js/Hot.js

@@ -1139,48 +1139,15 @@ window.initHot = function (model) {
       }
 
       if (openHot && this.info.linkType != "common" && this.info.iframe && this.info.iframe[0]) {
-        if (false) { // 场景跳转(热点编辑里添加网页链接——跳转)
+        if (this.info.linkType === 'jumpLink') { // 场景跳转(热点编辑里添加网页链接——跳转)
           // 注意,因为网站用了vue router, url里看上去像是查询片段的那一段其实是放在hash片段中的。
-          const hotspotWebQuerySection = new URLSearchParams(this.info.iframe[0].split('?')[1])
-          const targetSceneCode = hotspotWebQuerySection.get('m')
-
-          const currentLocationQuerySection = new URLSearchParams(location.href.split('?')[1])
-          const currentSceneCode = currentLocationQuerySection.get('m')
-
-          if (currentSceneCode === '1300' && targetSceneCode === '1302') {
-            const iframeElem = document.createElement('iframe')
-            iframeElem.style.position = 'absolute'
-            iframeElem.style.top = '50%'
-            iframeElem.style.left = '50%'
-            iframeElem.style.width = '600px'
-            iframeElem.style.height = '800px'
-            iframeElem.style.transform = 'translate(-50%, -50%)'
-            iframeElem.style.zIndex = '9999'
-            iframeElem.style.boxShadow = '0 0 0 1000px rgba(0, 0, 0, 0.85)'
-            // iframeElem.src = 'http://192.168.20.16:8081/#/topic'
-            iframeElem.src = '../quiz/index.html#/topic'
-            document.documentElement.appendChild(iframeElem)
-
-            const onMsg = (msg) => {
-              console.log('message received!', msg)
-              window.removeEventListener('message', onMsg, false)
-              if (msg.data === 'quiz over') {
-                // 跳转到新场景
-                currentLocationQuerySection.set('m', targetSceneCode)
-                const newLocation = location.href.split('?')[0] + '?' + currentLocationQuerySection.toString()
-                location.assign(newLocation)
-                location.reload(true)
-              }
-            }
-
-            window.addEventListener('message', onMsg, false)
-          } else {
-            // 跳转到新场景
-            currentLocationQuerySection.set('m', targetSceneCode)
-            const newLocation = location.href.split('?')[0] + '?' + currentLocationQuerySection.toString()
-            location.assign(newLocation)
-            location.reload(true)
+          let hotspotWebQuerySection = this.info.iframe[0].split('?')[1]
+          if (hotspotWebQuerySection.endsWith('#/')) {
+            hotspotWebQuerySection = hotspotWebQuerySection.substring(0, hotspotWebQuerySection.length - 2)
           }
+          const newLocation = location.href.split('?')[0] + '?' + hotspotWebQuerySection
+          location.assign(newLocation)
+          location.reload(true)
         } else {
           // 不是场景跳转
           var src = this.info.iframe[0]

+ 19 - 1
src/views/gui/menu.vue

@@ -24,6 +24,7 @@
             <a>
               <img
                 :src="require('@/assets/images/play.png')"
+                draggable="false"
               >
             </a>
           </div>
@@ -40,6 +41,7 @@
                 title=""
                 :src="require('@/assets/images/pause.png')"
                 data-original-title="暂停"
+                draggable="false"
               >
             </a>
           </div>
@@ -56,6 +58,7 @@
               <!-- 鼠标移入的显示 -->
               <!-- <div class="hoverTit">导览列表</div> -->
               <img
+                draggable="false"
                 title=""
                 class="icon icon-inside"
                 src="@/assets/images/auto.png"
@@ -73,6 +76,7 @@
               <!-- 鼠标移入的显示 -->
               <!-- <div class="hoverTit">自由漫游</div> -->
               <img
+                draggable="false"
                 class="icon icon-inside"
                 :src="require('@/assets/images/inside.png')"
               >
@@ -86,6 +90,7 @@
               <!-- 鼠标移入的显示 -->
               <!-- <div class="hoverTit">三维视觉</div> -->
               <img
+                draggable="false"
                 class="icon icon-inside"
                 :src="require('@/assets/images/dollhouse.png')"
               >
@@ -99,6 +104,8 @@
               <!-- 鼠标移入的显示 -->
               <!-- <div class="hoverTit">平面视觉</div> -->
               <img
+                draggable="false"
+
                 class="icon icon-inside"
                 :src="require('@/assets/images/floor.png')"
               >
@@ -111,6 +118,8 @@
               title=""
             >
               <img
+                draggable="false"
+
                 class="icon icon-inside"
                 :src="require('@/assets/images/hotlist.png')"
               >
@@ -132,9 +141,9 @@
         >
           <a>
             <img
+              draggable="false"
               src="@/assets/images/floor-1.png"
               alt=""
-              draggable="false"
             >
           </a>
         </div>
@@ -246,6 +255,8 @@
           <a>
             <img
               id="openMusic"
+
+              draggable="false"
               style="display: block"
               src="../../assets/images/music-muted.png"
               alt=""
@@ -254,6 +265,8 @@
             >
             <img
               id="closeMusic"
+
+              draggable="false"
               style="display: none"
               src="../../assets/images/music.png"
               alt=""
@@ -274,6 +287,8 @@
         >
           <a>
             <img
+              draggable="false"
+
               title="全屏"
               :src="require('@/assets/images/full.png')"
             >
@@ -291,6 +306,8 @@
         >
           <a>
             <img
+              draggable="false"
+
               title="关闭全屏"
               :src="require('@/assets/images/fullAc.png')"
             >
@@ -367,6 +384,7 @@ export default {
       if (this.currentSceneCode !== sceneCode) {
         const locationQuerySection = new URLSearchParams(location.href.split('?')[1])
         locationQuerySection.set('m', sceneCode)
+        locationQuerySection.delete('firstView')
         const newLocation = location.href.split('?')[0] + '?' + locationQuerySection.toString()
         location.assign(newLocation)
         location.reload(true)