Selaa lähdekoodia

feat: 优化工作桌面引导返回按钮逻辑

cuiyalong 1 vuosi sitten
vanhempi
commit
10daabae2d

+ 11 - 2
src/web/staticres/js/ent-search-index-pc.js

@@ -371,6 +371,15 @@ var entSearch = new Vue({
               history.back()
             }
           }
+
+          var goHome = function () {
+            // 判断是否在iframe,如果在iframe,则用父级返回
+            if (goTemplateData.inIframe) {
+              window.parent.location.href = '/'
+            } else {
+              window.location.href = '/'
+            }
+          }
         
           var referer = document.referer
           if(referer) {
@@ -394,10 +403,10 @@ var entSearch = new Vue({
                 back()
               }
             } else {
-              location.href = '/'
+                goHome()
             }
           } else {
-            location.href = '/'
+            goHome()
           }
         },
         // 筛选条件回显

+ 11 - 2
src/web/staticres/js/pur-search-index-pc.js

@@ -254,6 +254,15 @@ var vm = new Vue({
               history.back()
             }
           }
+
+          var goHome = function () {
+            // 判断是否在iframe,如果在iframe,则用父级返回
+            if (goTemplateData.inIframe) {
+              window.parent.location.href = '/'
+            } else {
+              window.location.href = '/'
+            }
+          }
         
           var referer = document.referer
           if(referer) {
@@ -277,10 +286,10 @@ var vm = new Vue({
                 back()
               }
             } else {
-              location.href = '/'
+              goHome()
             }
           } else {
-            location.href = '/'
+            goHome()
           }
         },
         goWorkSpace: function () {

+ 12 - 3
src/web/staticres/public-pc/js/article-content.js

@@ -2904,7 +2904,7 @@ var detailActionRight = new Vue({
         window.location.href = goHref
       }
     },
-    goBack () {
+    goBack: function () {
       var back = function () {
         // 判断是否在iframe,如果在iframe,则用父级返回
         if (goTemplateData.inIframe) {
@@ -2913,6 +2913,15 @@ var detailActionRight = new Vue({
           history.back()
         }
       }
+
+      var goHome = function () {
+        // 判断是否在iframe,如果在iframe,则用父级返回
+        if (goTemplateData.inIframe) {
+          window.parent.location.href = '/'
+        } else {
+          window.location.href = '/'
+        }
+      }
     
       var referer = document.referer
       if(referer) {
@@ -2936,10 +2945,10 @@ var detailActionRight = new Vue({
             back()
           }
         } else {
-          location.href = '/'
+          goHome()
         }
       } else {
-        location.href = '/'
+        goHome()
       }
     },
   }

+ 11 - 2
src/web/templates/pc/supsearch.html

@@ -3220,6 +3220,15 @@ function checkTagDisabled () {
             history.back()
           }
         }
+
+        var goHome = function () {
+          // 判断是否在iframe,如果在iframe,则用父级返回
+          if (goTemplateData.inIframe) {
+            window.parent.location.href = '/'
+          } else {
+            window.location.href = '/'
+          }
+        }
       
         var referer = document.referer
         if(referer) {
@@ -3243,10 +3252,10 @@ function checkTagDisabled () {
               back()
             }
           } else {
-            location.href = '/'
+            goHome()
           }
         } else {
-          location.href = '/'
+          goHome()
         }
       },
       goWorkSpace: function () {