Преглед на файлове

支持场景跳转功能

任一存 преди 2 години
родител
ревизия
42cac0bfac
променени са 1 файла, в които са добавени 6 реда и са изтрити 35 реда
  1. 6 35
      public/static/js/Hot.js

+ 6 - 35
public/static/js/Hot.js

@@ -1140,7 +1140,7 @@ window.initHot = function (model) {
       }
 
       if (openHot && this.info.linkType != "common" && this.info.iframe && this.info.iframe[0]) {
-        if (false) { // 场景跳转(热点编辑里添加网页链接——跳转)
+        if (openHot && this.info.linkType != "common" && this.info.iframe && this.info.iframe[0]) { // 场景跳转(热点编辑里添加网页链接——跳转)
           // 注意,因为网站用了vue router, url里看上去像是查询片段的那一段其实是放在hash片段中的。
           const hotspotWebQuerySection = new URLSearchParams(this.info.iframe[0].split('?')[1])
           const targetSceneCode = hotspotWebQuerySection.get('m')
@@ -1148,40 +1148,11 @@ window.initHot = function (model) {
           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 = '/AnhuiDaily/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)
-          }
+          // 跳转到新场景
+          currentLocationQuerySection.set('m', targetSceneCode)
+          const newLocation = location.href.split('?')[0] + '?' + currentLocationQuerySection.toString()
+          location.assign(newLocation)
+          location.reload(true)
         } else {
           // 不是场景跳转
           var src = this.info.iframe[0]