Bläddra i källkod

优化代码,更换ico,完成场景切换功能。

任一存 2 år sedan
förälder
incheckning
39c9e29063
3 ändrade filer med 52 tillägg och 31 borttagningar
  1. BIN
      public/favicon.ico
  2. 46 24
      public/static/js/Hot.js
  3. 6 7
      src/assets/style/public.less

BIN
public/favicon.ico


+ 46 - 24
public/static/js/Hot.js

@@ -37,8 +37,8 @@ window.initHot = function (model) {
     var getLink = function (link) {
         var querySectionInLink = link.split('?')[1]
         var langParam = "en" == manage.number("lang") ? "&lang=" + manage.number("lang") : "";
-        return `http://192.168.20.16:8085/#/${browser.isMobile() ? 'mobile' : 'web'}/?${querySectionInLink}&time=${randomTime().getTime()}&id=${window.number}${langParam}`
-        // return `/AnhuiDaily/hotspot/index.html#/${browser.isMobile() ? 'mobile' : 'web'}/?${querySectionInLink}&time=${randomTime().getTime()}&id=${window.number}${langParam}`
+        // return `http://192.168.20.16:8085/#/${browser.isMobile() ? 'mobile' : 'web'}/?${querySectionInLink}&time=${randomTime().getTime()}&id=${window.number}${langParam}`
+        return `/AnhuiDaily/hotspot/index.html#/${browser.isMobile() ? 'mobile' : 'web'}/?${querySectionInLink}&time=${randomTime().getTime()}&id=${window.number}${langParam}`
     }
     var removeSrcPostMark = function (url) {//去除texture.load时自动加上的'?'
         var index = url.indexOf('?')
@@ -1105,16 +1105,50 @@ window.initHot = function (model) {
           if (!openHot && !needExamine) return
         
           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])
-            // // console.log('111', hotspotWebQuerySection.get('m'));
-            
-            // const mainWebQuerySection = new URLSearchParams(location.href.split('?')[1])
-            // mainWebQuerySection.set('m', '1302')
-            // const newLocation = location.href.split('?')[0] + '?' + mainWebQuerySection.toString()
-            // location.assign(newLocation)
-            // location.reload(true)
-            
+            // 注意,因为网站用了vue router, url里看上去像是查询片段的那一段其实是放在hash片段中的。
+            const hotspotWebQuerySection = new URLSearchParams(this.info.iframe[0].split('?')[1])
+            const targetSceneCode = hotspotWebQuerySection.get('m')
+
+            if (targetSceneCode === '1300') {
+              const iframeElem = document.createElement('iframe')
+              iframeElem.style.position = 'absolute'
+              iframeElem.style.top = '0'
+              iframeElem.style.left = '0'
+              iframeElem.style.width = '100%'
+              iframeElem.style.height = '100%'
+              iframeElem.style.zIndex = '9999'
+              // 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') {
+                  
+                  // 注意,因为网站用了vue router, url里看上去像是查询片段的那一段其实是放在hash片段中的。
+                  const hotspotWebQuerySection = new URLSearchParams(this.info.iframe[0].split('?')[1])
+  
+                  // 跳转到新场景
+                  const mainWebQuerySection = new URLSearchParams(location.href.split('?')[1])
+                  mainWebQuerySection.set('m', hotspotWebQuerySection.get('m'))
+                  const newLocation = location.href.split('?')[0] + '?' + mainWebQuerySection.toString()
+                  location.assign(newLocation)
+                  location.reload(true)
+                }
+              }
+              
+              window.addEventListener('message', onMsg, false)
+            } else {
+              // 跳转到新场景
+              const mainWebQuerySection = new URLSearchParams(location.href.split('?')[1])
+              mainWebQuerySection.set('m', targetSceneCode)
+              const newLocation = location.href.split('?')[0] + '?' + mainWebQuerySection.toString()
+              location.assign(newLocation)
+              location.reload(true)
+            }
+
+            return
             
             
             var src = getLink(this.info.iframe[0])
@@ -1173,18 +1207,6 @@ window.initHot = function (model) {
           var popup = document.getElementById("popup")
         
           if (openHot) {
-            // // 注意,因为网站用了vue router, url里看上去像是查询片段的那一段其实是放在hash片段中的。
-            // const hotspotWebQuerySection = new URLSearchParams(this.info.link.split('?')[1])
-            // // console.log('222', hotspotWebQuerySection.get('m'));
-
-            // const mainWebQuerySection = new URLSearchParams(location.href.split('?')[1])
-            // mainWebQuerySection.set('m', '1302')
-            // const newLocation = location.href.split('?')[0] + '?' + mainWebQuerySection.toString()
-            // location.assign(newLocation)
-            // location.reload(true)
-            
-            
-            
             g_currentHot = this,
             popup.style.display = "block",
             popup.classList.add("wait")

+ 6 - 7
src/assets/style/public.less

@@ -81,6 +81,12 @@ input:-ms-input-placeholder{  /* Internet Explorer 10-11 */
   border-radius: initial !important;
   z-index: 999;
   background: initial !important;
+  svg {
+    path {
+      stroke-width: 0.5;
+    }
+    
+  }
 }
 
 .mobile {
@@ -105,11 +111,4 @@ input:-ms-input-placeholder{  /* Internet Explorer 10-11 */
 // 视野
 #ele1 path {
   fill: #165491;
-}
-
-// 用于调整小地图墙壁粗细
-body {
-  path {
-    stroke-width: 0.5;
-  }
 }