Bläddra i källkod

fix:修复app订阅页面重复请求

yangfeng 3 år sedan
förälder
incheckning
4d372e4b75

+ 32 - 0
src/jfw/modules/app/src/web/staticres/jyapp/js/historypush.js

@@ -471,6 +471,23 @@ var vm = new Vue({
           } else {
             _this.screenShow = false
           }
+          // 从页面移植来的
+          if(!res.data.entniche && !res.data.member && res.data.vip <= 0) {
+            sessionStorage.removeItem('switch-product')
+            setTimeout(function() {
+                (window.slotbydup = window.slotbydup || []).push({
+                    id: "u6603902",
+                    container: "_36y1d8lbx9n",
+                    async: true
+                });
+                (window.slotbydup = window.slotbydup || []).push({
+                    id: "u6603902",
+                    container: "_061vbh43quq3",
+                    async: true
+                });
+            },1000)
+            _this.getAjaxAdv()
+          }
         }
       })
       $.ajax({
@@ -479,6 +496,7 @@ var vm = new Vue({
           dataType: "json",
           success: function (res) {
               if (res.data) {
+                window.userNewType = res.data.isUpgrade // 原页面里的用户版本 变量赋值
                 _this.rootInfo = res.data
                 let switchProduct = sessionStorage.getItem('switch-product')
                 // res.data.memberStatus = 3
@@ -736,6 +754,20 @@ var vm = new Vue({
       this.$refs.areaCityItem.toggle(false)
       this.$refs.industryItem.toggle(false)
       this.$refs.moreDropdownItems.toggle(false)
+    },
+    getAjaxAdv: function () {
+      $.ajax({
+        type: 'POST',
+        url: '/publicapply/adLeague/exposure',
+        data: {
+            client: 'APP',
+            id: 'ad6',
+            position: '订阅推送列表页'
+        },
+        success: function(res) {
+            console.log(res)
+        }
+      })
     }
   }
 })

+ 3 - 57
src/jfw/modules/app/src/web/templates/weixin/historypush.html

@@ -581,48 +581,6 @@
         })
     </script>
     <script type="text/javascript">
-    $.ajax({
-        type: 'POST',
-        url: '/publicapply/bidcoll/power',
-        success: function(res) {
-                console.log(res)
-                if(res.error_code == 0) {
-                    if(!res.data.entniche && !res.data.member && res.data.vip <= 0) {
-                        sessionStorage.removeItem('switch-product')
-                        setTimeout(function() {
-                            (window.slotbydup = window.slotbydup || []).push({
-                                id: "u6603902",
-                                container: "_36y1d8lbx9n",
-                                async: true
-                            });
-                            (window.slotbydup = window.slotbydup || []).push({
-                                id: "u6603902",
-                                container: "_061vbh43quq3",
-                                async: true
-                            });
-                        },1000)
-                        getAjaxAdv()
-                    }
-                }
-        },
-        error: function(err) {
-                console.log(err)
-        }
-    })
-    function getAjaxAdv () {
-        $.ajax({
-            type: 'POST',
-            url: '/publicapply/adLeague/exposure',
-            data: {
-                client: 'APP',
-                id: 'ad6',
-                position: '订阅推送列表页'
-            },
-            success: function(res) {
-                console.log(res)
-            }
-        })
-    }
     addEventListener('focus', function() {
         if(document.activeElement = document.getElementById('iframeu6603902_0')) {
             $.ajax({
@@ -829,18 +787,6 @@
             }
         }
     })
-    var userNewType = false // 用户版本
-    // 获取用户权限
-    function getUserMsg() {
-        $.ajax({
-            url: '/bigmember/use/isAdd',
-            type: 'POST',
-            success: function (res) {
-                userNewType = res.data.isUpgrade
-            }
-        })
-    }
-    getUserMsg()
   function initpage() {
       afterJyObjInit();
       var thisClass=this;
@@ -856,7 +802,7 @@
         $("#sub_manager").click(function() {
             sessionStorage.setItem(vm.sessStorageKey, JSON.stringify(vm.$data))
             let thisType = sessionStorage.getItem('userIsNew')
-            if (userNewType || thisType) {
+            if (window.userNewType || thisType) {
                 location.href = '/jyapp/vipsubscribe/toSubVipSetPage'
             } else {
                 if(vm.rootInfo.memberStatus > 0) {
@@ -887,7 +833,7 @@
             console.log(vm.rootInfo, 'vmrootInfo')
             sessionStorage.setItem(vm.sessStorageKey, JSON.stringify(vm.$data))
             let thisType = sessionStorage.getItem('userIsNew')
-            if (userNewType || thisType) {
+            if (window.userNewType || thisType) {
                 location.href = '/jyapp/vipsubscribe/toSubVipSetPage'
             } else {
                 if(vm.selectPro) {
@@ -1663,7 +1609,7 @@ function hasNoData() {
   //
   function appendList(content) {
       content.children(".tslist").on("click", function (event) {
-        if (!userNewType) {
+        if (!window.userNewType) {
             $('#tipsType').show()
           } else {
             $('#tipsType').hide()