|
@@ -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]
|