ソースを参照

场景跳转逻辑优化,使用热点数据中新场景url的全部参数而不仅仅是m。

任一存 2 年 前
コミット
63448deba2
1 ファイル変更5 行追加4 行削除
  1. 5 4
      public/static/js/Hot.js

+ 5 - 4
public/static/js/Hot.js

@@ -1140,6 +1140,7 @@ window.initHot = function (model) {
           
           if (openHot && this.info.linkType != "common" && this.info.iframe && this.info.iframe[0]) {
             if (this.info.linkType === 'jumpLink' && !this.info.iframe[0].startsWith('external-')) { // 场景跳转(热点编辑里添加网页链接——跳转)
+              
               // 注意,因为网站用了vue router, url里看上去像是查询片段的那一段其实是放在hash片段中的。
               const hotspotWebQuerySection = new URLSearchParams(this.info.iframe[0].split('?')[1])
               const targetSceneCode = hotspotWebQuerySection.get('m')
@@ -1166,8 +1167,8 @@ window.initHot = function (model) {
                   window.removeEventListener('message', onMsg, false)
                   if (msg.data === 'quiz over') {
                     // 跳转到新场景
-                    currentLocationQuerySection.set('m', targetSceneCode)
-                    const newLocation = location.href.split('?')[0] + '?' + currentLocationQuerySection.toString()
+                    // hotspotWebQuerySection.set('m', targetSceneCode)
+                    const newLocation = location.href.split('?')[0] + '?' + hotspotWebQuerySection.toString()
                     location.assign(newLocation)
                     location.reload(true)
                   }
@@ -1176,8 +1177,8 @@ window.initHot = function (model) {
                 window.addEventListener('message', onMsg, false)
               } else {
                 // 跳转到新场景
-                currentLocationQuerySection.set('m', targetSceneCode)
-                const newLocation = location.href.split('?')[0] + '?' + currentLocationQuerySection.toString()
+                // hotspotWebQuerySection.set('m', targetSceneCode)
+                const newLocation = location.href.split('?')[0] + '?' + hotspotWebQuerySection.toString()
                 location.assign(newLocation)
                 location.reload(true)
               }