Selaa lähdekoodia

feat: 企业搜索、采购单位搜索跳转seo画像逻辑优化

cuiyalong 1 vuosi sitten
vanhempi
commit
879ff3fa01

+ 7 - 13
src/web/staticres/js/ent-search-index-pc.js

@@ -351,7 +351,7 @@ var entSearch = new Vue({
          * 初始化页面搜索框与工作台顶部搜索联动事件函数,详情见对应函数 common.js
          * 需要在 dom 初始化后调用来监听事件,Vue中需要额外在 input 对应事件额外手动触发事件
          */
-        // if (goTemplateData.inIframe) {
+        // if (this.inIframe) {
         //   this._$SearchEvent = initSearchPageEvent({
         //     type: 'company',
         //     el: '.search-header-top .input-container',
@@ -365,21 +365,12 @@ var entSearch = new Vue({
     methods: {
         goBack () {
           var back = function () {
-            // 判断是否在iframe,如果在iframe,则用父级返回
-            if (goTemplateData.inIframe) {
-              window.parent.history.back()
-            } else {
-              history.back()
-            }
+            window.top.history.back()
           }
 
           var goHome = function () {
             // 判断是否在iframe,如果在iframe,则用父级返回
-            if (goTemplateData.inIframe) {
-              window.parent.location.href = '/'
-            } else {
-              window.location.href = '/'
-            }
+            window.top.location.href = '/'
           }
         
           var referer = document.referer
@@ -1096,7 +1087,10 @@ var entSearch = new Vue({
               openLoginDig(null, svipLink)
               return
             } else {
-                return window.open(seoUrl)
+                if (!this.inIframe) {
+                    // 工作桌面外跳转seo画像
+                    return window.open(seoUrl)
+                }
             }
             try {
                 item.visited = true

+ 9 - 16
src/web/staticres/js/pur-search-index-pc.js

@@ -234,7 +234,7 @@ var vm = new Vue({
          * 初始化页面搜索框与工作台顶部搜索联动事件函数,详情见对应函数 common.js
          * 需要在 dom 初始化后调用来监听事件,Vue中需要额外在 input 对应事件额外手动触发事件
          */
-        // if (goTemplateData.inIframe) {
+        // if (this.inIframe) {
         //   this._$SearchEvent = initSearchPageEvent({
         //     type: 'buyer',
         //     el: '.search-header-top .input-container',
@@ -248,21 +248,11 @@ var vm = new Vue({
     methods: {
         goBack () {
           var back = function () {
-            // 判断是否在iframe,如果在iframe,则用父级返回
-            if (goTemplateData.inIframe) {
-              window.parent.history.back()
-            } else {
-              history.back()
-            }
+            window.top.history.back()
           }
 
           var goHome = function () {
-            // 判断是否在iframe,如果在iframe,则用父级返回
-            if (goTemplateData.inIframe) {
-              window.parent.location.href = '/'
-            } else {
-              window.location.href = '/'
-            }
+            window.top.location.href = '/'
           }
         
           var referer = document.referer
@@ -484,7 +474,7 @@ var vm = new Vue({
             }
         },
         yeFan: function() {
-          if (goTemplateData.inIframe) {
+          if (this.inIframe) {
             window.$BRACE.methods.open({
               route: {
                 link: '/jylab/purScopebusniess/index.html'
@@ -838,8 +828,11 @@ var vm = new Vue({
               openLoginDig(null, url)
               return
             }
-            url = seoUrl
-            window.open(url)
+            if (this.inIframe) {
+              window.open(url)
+            } else {
+              window.open(seoUrl)
+            }
         },
         // 全选
         allChange: function() {