2 Commits ebd6f381a3 ... 6ab0084e34

Author SHA1 Message Date
  任一存 6ab0084e34 Merge branch 'master' of http://192.168.0.115:3000/renyicun/WenLanGe 1 year ago
  任一存 1159ff4196 未登录时不能答题,会跳转到登录页面 1 year ago
2 changed files with 137 additions and 128 deletions
  1. 132 128
      public/static/js/Hot.js
  2. 5 0
      src/App.vue

+ 132 - 128
public/static/js/Hot.js

@@ -1140,145 +1140,149 @@ window.initHot = function (model) {
       }
 
       if (openHot && this.info.linkType != "common" && this.info.iframe && this.info.iframe[0]) {
-        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')
-
-          const currentLocationQuerySection = new URLSearchParams(location.href.split('?')[1])
-          const currentSceneCode = currentLocationQuerySection.get('m')
-
-          // 跳转到新场景
-          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]
-
-          if (this.info.linkType == "jumpLink") { // 新页面打开链接
-            var newPage = window.open(src, "_blank")
-            newPage.focus()
-
-          } else if (this.info.linkType == "iframeDiv") { // iframe里打开链接
-            var div = document.createElement("div")
-            div.style.position = 'fixed'
-            div.style.width = div.style.height = "100%"
-            div.style.left = div.style.top = '0'
-            div.style["z-index"] = "999"
-
-            var exit = document.createElement("div")
-            exit.style["background-image"] = "url(images/vrOffImg.png)"
-            exit.style.position = 'absolute'
-            exit.style.width = exit.style.height = "50px"
-            exit.style.left = '17px'; exit.style.top = "20px"
-            exit.style.cursor = "pointer"
-            exit.style["background-repeat"] = "no-repeat"
-            exit.style["background-size"] = "25%"
-            exit.style["background-position"] = "center center"
-            exit.style["background-color"] = "rgba(0, 0, 0, 0.2)"
-            exit.style["border-radius"] = "50%"
-            exit.style["z-index"] = "3"
-            exit.onclick = () => {
-              $(div).remove()
-
-              Hot.closePopup()
-
-            }
-
-            var myElement = document.createElement("iframe")
-            myElement.style.position = 'absolute'
-            myElement.style.width = myElement.style.height = "100%"
-            myElement.style.left = myElement.style.top = '0'
-
-            myElement.src = this.info.iframe[0]
-
-            $("body").append(div)
-            div.appendChild(exit)
-            div.appendChild(myElement)
-
-            SoundManager.play('hot')
-          }
-        }
+        // 注意,因为网站用了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')
+
+        // 跳转到新场景
+        currentLocationQuerySection.set('m', targetSceneCode)
+        const newLocation = location.href.split('?')[0] + '?' + currentLocationQuerySection.toString()
+        location.assign(newLocation)
+        location.reload(true)
+
+        // // 不是场景跳转
+        // var src = this.info.iframe[0]
+
+        // if (this.info.linkType == "jumpLink") { // 新页面打开链接
+        //   var newPage = window.open(src, "_blank")
+        //   newPage.focus()
+
+        // } else if (this.info.linkType == "iframeDiv") { // iframe里打开链接
+        //   var div = document.createElement("div")
+        //   div.style.position = 'fixed'
+        //   div.style.width = div.style.height = "100%"
+        //   div.style.left = div.style.top = '0'
+        //   div.style["z-index"] = "999"
+
+        //   var exit = document.createElement("div")
+        //   exit.style["background-image"] = "url(images/vrOffImg.png)"
+        //   exit.style.position = 'absolute'
+        //   exit.style.width = exit.style.height = "50px"
+        //   exit.style.left = '17px'; exit.style.top = "20px"
+        //   exit.style.cursor = "pointer"
+        //   exit.style["background-repeat"] = "no-repeat"
+        //   exit.style["background-size"] = "25%"
+        //   exit.style["background-position"] = "center center"
+        //   exit.style["background-color"] = "rgba(0, 0, 0, 0.2)"
+        //   exit.style["border-radius"] = "50%"
+        //   exit.style["z-index"] = "3"
+        //   exit.onclick = () => {
+        //     $(div).remove()
+
+        //     Hot.closePopup()
+
+        //   }
+
+        //   var myElement = document.createElement("iframe")
+        //   myElement.style.position = 'absolute'
+        //   myElement.style.width = myElement.style.height = "100%"
+        //   myElement.style.left = myElement.style.top = '0'
+
+        //   myElement.src = this.info.iframe[0]
+
+        //   $("body").append(div)
+        //   div.appendChild(exit)
+        //   div.appendChild(myElement)
+
+        //   SoundManager.play('hot')
+        // }
       } else {
         // 图片、视频之类的热点
         if (!player.currentPano) return
 
-        var popup = document.getElementById("popup")
-
-        if (openHot) {
-          g_currentHot = this,
-          popup.style.display = "block",
-          popup.classList.add("wait")
-          var iframeElem = document.createElement("iframe")
-
-          SoundManager.play('hot')
-
-          var src = getCommonHotspotUrl(this.info.link)
-          iframeElem.src = src
-          iframeElem.id = "id1",
-          iframeElem.allowTransparency = "true"
-          var a = document.getElementById("id1")
-          if (void 0 === a || null == a) {
-            document.querySelector(".popup-content").appendChild(iframeElem)
-            document.body.classList.add('hotspot-detail-open')
-            var s = !1
-            window.loaddingSuccess = function () {
-              s = !0
+        window.checkLoginStatusAndProcess().then((res) => {
+          if (!res) {
+            window.showLogin()
+          } else {
+            var popup = document.getElementById("popup")
+
+            if (openHot) {
+              g_currentHot = this,
+              popup.style.display = "block",
+              popup.classList.add("wait")
+              var iframeElem = document.createElement("iframe")
+
+              SoundManager.play('hot')
+
+              var src = getCommonHotspotUrl(this.info.link)
+              iframeElem.src = src
+              iframeElem.id = "id1",
+              iframeElem.allowTransparency = "true"
+              var a = document.getElementById("id1")
+              if (void 0 === a || null == a) {
+                document.querySelector(".popup-content").appendChild(iframeElem)
+                document.body.classList.add('hotspot-detail-open')
+                var s = !1
+                window.loaddingSuccess = function () {
+                  s = !0
+                }
+                ,
+                setTimeout(function e() {
+                  if (s) {
+                    var t = document.querySelector("#id1").contentWindow.document
+                    t.querySelector("video") && (t.querySelector("video").play(),
+                    !t.querySelector("video").paused && t.querySelector(".playPause") && t.querySelector(".playPause").classList.add("fa-pause")),
+                    t.querySelector("audio") && t.querySelector("audio").play()
+                  } else
+                    setTimeout(e, 300)
+                }, 800)
+              }
             }
-            ,
-            setTimeout(function e() {
-              if (s) {
-                var t = document.querySelector("#id1").contentWindow.document
-                t.querySelector("video") && (t.querySelector("video").play(),
-                !t.querySelector("video").paused && t.querySelector(".playPause") && t.querySelector(".playPause").classList.add("fa-pause")),
-                t.querySelector("audio") && t.querySelector("audio").play()
-              } else
-                setTimeout(e, 300)
-            }, 800)
-          }
-        }
 
-        var done = function () {
-          player.flyingToTag = !1
-          openHot && popup.classList.remove("wait")
-        }.bind(this)
+            var done = function () {
+              player.flyingToTag = !1
+              openHot && popup.classList.remove("wait")
+            }.bind(this)
 
-        if (!needExamine) {
-          done()
-          return
-        }
+            if (!needExamine) {
+              done()
+              return
+            }
 
-        var c = this.closestPanoTowardTag(player.mode, player.currentPano) || player.currentPano
-          , h = this.mesh.getWorldPosition()
-        player.flyingToTag = !0
+            var c = this.closestPanoTowardTag(player.mode, player.currentPano) || player.currentPano
+              , h = this.mesh.getWorldPosition()
+            player.flyingToTag = !0
 
-        if (player.mode === 'panorama') {
-          var d = {
-            pano: c,
-            lookAtPoint: h,
-            duration: options.duration,
-            maxDistanceOverride: null,
-            skipWarpingCheck: !1,
-            aimDuration: options.aimDuration,
+            if (player.mode === 'panorama') {
+              var d = {
+                pano: c,
+                lookAtPoint: h,
+                duration: options.duration,
+                maxDistanceOverride: null,
+                skipWarpingCheck: !1,
+                aimDuration: options.aimDuration,
 
+              }
+              player.flyToPano(d, done)
+            } else {
+              var p = {
+                pano: c
+              }
+              if (h) {
+                var f = (new THREE.Matrix4).lookAt(c.position, h, new THREE.Vector3(0, 1, 0))
+                p.quaternion = (new THREE.Quaternion).setFromRotationMatrix(f)
+              }
+              p.callback = done,
+              p.duration = options.duration || 1500,
+              p.mode = 'panorama',
+              p.aimDuration = options.aimDuration
+              player.flyToNewMode(p)
+            }
           }
-          player.flyToPano(d, done)
-        } else {
-          var p = {
-            pano: c
-          }
-          if (h) {
-            var f = (new THREE.Matrix4).lookAt(c.position, h, new THREE.Vector3(0, 1, 0))
-            p.quaternion = (new THREE.Quaternion).setFromRotationMatrix(f)
-          }
-          p.callback = done,
-          p.duration = options.duration || 1500,
-          p.mode = 'panorama',
-          p.aimDuration = options.aimDuration
-          player.flyToNewMode(p)
-        }
+        })
       }
     }
 

+ 5 - 0
src/App.vue

@@ -28,6 +28,11 @@ import globalApi from "@/api"
 
 export default {
   mounted() {
+    window.checkLoginStatusAndProcess = globalApi.checkLoginStatusAndProcess
+    window.showLogin = () => {
+      this.$router.push({ name: `Login` })
+    }
+
     if (this.isMobile) {
       document.body.classList.add('mobile')
     }