浏览代码

fix:苹果app、wx三级页返回未刷新

yangfeng 3 年之前
父节点
当前提交
134841cdcb

+ 11 - 0
src/jfw/modules/app/src/web/templates/weixin/wxinfocontent.html

@@ -2522,6 +2522,17 @@
       })
     }
     $(function(){
+      var u = navigator.userAgent;
+      var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
+      var isPageHide = false;
+      window.addEventListener('pageshow', function () {
+          if (isPageHide && isiOS) {
+          window.location.reload();
+          }
+      });
+      window.addEventListener('pagehide', function () {
+          isPageHide = true;
+      });
       // 收藏
       $('.collec_star').on('click', function () {
         var $this = $(this)

+ 11 - 1
src/web/templates/weixin/wxinfocontent_rec.html

@@ -2107,7 +2107,17 @@ function subData(){
 }
 //
 $(function(){
-
+  var u = navigator.userAgent;
+  var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
+  var isPageHide = false;
+  window.addEventListener('pageshow', function () {
+      if (isPageHide && isiOS) {
+      window.location.reload();
+      }
+  });
+  window.addEventListener('pagehide', function () {
+      isPageHide = true;
+  });
 	$(document).on("click",function(e) {
         if($(e.target).parents(".easyalert-mask").length == 0){
             $("#easyalert-mask").remove();