Просмотр исходного кода

feat: 采购单位画像数据缓存

cuiyalong 1 год назад
Родитель
Сommit
93a3019059

+ 16 - 10
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/unit_portrayal.js

@@ -285,13 +285,9 @@ var vNode = {
     this.buyer.name = decodeURIComponent(utils.getParam('entName'))
     this.getUserSimpleInfo()
     this.restore = this.reStoreState()
-    if (this.restore) {
-      this.getInfoWithPower()
-    } else {
-      setTimeout(() => {
-        this.getPowerInfo()
-      }, 1000)
-    }
+    setTimeout(() => {
+      this.getPowerInfo()
+    }, 1000)
     setTimeout(() => {
       this.getIsSc()
     }, 1000)
@@ -469,6 +465,7 @@ var vNode = {
     },
     // 点击去开通埋点方法(免费体验埋点)
     goBuyBuried: function (text) {
+      this.savePageState()
       var _this = this
       var params = {
         mold: 'isCBBT',
@@ -507,6 +504,7 @@ var vNode = {
       }, 20)
     },
     goEntInfo: function (item) {
+      this.savePageState()
       location.href = './ent_portrait?eId=' + encodeURIComponent(item.id)
     },
     // 查询采购单位地址(暂不需要)
@@ -582,6 +580,7 @@ var vNode = {
         }
         return
       } else {
+        _this.savePageState()
         location.href = './free_buyer_project_news?entName=' + decodeURIComponent(utils.getParam('entName'))
       }
     },
@@ -602,12 +601,14 @@ var vNode = {
       if (this.bigStatus <= 0) {
         requestUrl = '/bigmember/subVipPortrait/buyer/getNewMsgExport'
       }
+      var _this = this
       $.ajax({
         type: 'POST',
         url: requestUrl,
         data: storageSet ? Object.assign(data, storageSet) : data,
         timeout: 8000,
         success: function (res) {
+          _this.savePageState()
           window.location.href = "/jy_mobile/common/order/create/dataexport?id=" + res.data
         },
         error: function (err) {
@@ -1676,7 +1677,7 @@ var vNode = {
     },
     savePageState: function () {
       this.scrollTop = $('#unit_portrayal').scrollTop()
-      var scrollTopOffset = 10 // 滚动误差
+      var scrollTopOffset = 5 // 滚动误差
       var data = {
         chartLoading: this.chartLoading,
         tabActiveName: this.tabActiveName,
@@ -1699,6 +1700,7 @@ var vNode = {
         $data = JSON.parse($data)
         // 如果恢复的企业名称和当前url企业名称不同,则清除缓存,重新请求
         if (this.buyer.name !== $data.buyer.name) {
+          console.log('画像id与缓存id不同,清空缓存')
           sessionStorage.removeItem(this.sessKey)
           return false
         }
@@ -1724,11 +1726,11 @@ var vNode = {
       if (this.scrollTop) {
         setTimeout(function () {
           $('#unit_portrayal').scrollTop(_this.scrollTop)
-        }, 300)
+        }, 200)
       }
     },
     onExampleOpenPage: function () {
-      // this.savePageState()
+      this.savePageState()
     },
     // dialog
     openDialog: function () {
@@ -1746,6 +1748,7 @@ var vNode = {
           btnText = '去开通'
         } else {
           // 立即解锁
+          _this.savePageState()
           location.href = '/jyapp/frontPage/bigmember/free/perfect_info?source=buyer_portrait_getNewMsg_freeuser'
           // 需要return出去 直接跳留资 不弹弹框
           return
@@ -1779,6 +1782,7 @@ var vNode = {
           // } catch (error) {
           //   console.log(error)
           // }
+          _this.savePageState()
           location.href = '/jyapp/free/customer'
         } else if (btnText == '前往升级') {
           //跳转清除旧套餐缓存,防止计算价格出错
@@ -1807,6 +1811,7 @@ var vNode = {
             )
           )
         } catch (error) { }
+        this.savePageState()
         var href = '/jyapp/article/content/' + item.id + '.html'
         location.href = href
       } else {
@@ -1841,6 +1846,7 @@ var vNode = {
     },
     //免费赠送采购单位全景分析体验 去解锁
     goGiveAnalysis: function () {
+      this.savePageState()
       location.href = '/jyapp/frontPage/bigmember/free/perfect_info?source=buyer_portrait_freeuser';
     },
     // 前往升级或联系客服

+ 14 - 8
src/web/staticres/big-member/js/unit_portrayal.js

@@ -277,11 +277,7 @@ var vNode = {
     created () {
       this.buyer.name = decodeURIComponent(utils.getParam('entName'))
       this.restore = this.reStoreState()
-      if (this.restore) {
-        this.getInfoWithPower()
-      } else {
-        this.getPowerInfo()
-      }
+      this.getPowerInfo()
     },
     mounted: function () {
         var storageName = decodeURIComponent(sessionStorage.getItem('buyer_high_name'))
@@ -425,6 +421,7 @@ var vNode = {
         // 点击去开通埋点方法(免费体验)
         goBuyBuried: function(text) {
           var _this = this
+          this.savePageState()
           var params = {
             mold: 'isCBBT',
             id: _this.encryptId,
@@ -462,6 +459,7 @@ var vNode = {
           }, 20)
         },
         goEntInfo: function(item) {
+            this.savePageState()
             location.href = "/weixin/frontPage/collection/sess/ent_portrait?eId=" + encodeURIComponent(item.id)
         },
         // 查询采购单位地址(暂不需要)
@@ -538,11 +536,13 @@ var vNode = {
             }
             return
           } else {
+            _this.savePageState()
             location.href = '/big/wx/page/free_buyer_project_news?entName=' + decodeURIComponent(utils.getParam('entName'))
           }
         },
         //数据导出
         onExport(){
+          var _this = this
           var storageSet = this.getHighSet()
           var data = {
             buyer: decodeURIComponent(utils.getParam('entName')),
@@ -559,6 +559,7 @@ var vNode = {
           data: storageSet ? Object.assign(data, storageSet) : data,
           timeout: 8000,
           success:function(res) {
+            _this.savePageState()
             window.location.href = "/jy_mobile/common/order/create/dataexport?id=" + res.data
           },
           error:function(err) {
@@ -1577,7 +1578,7 @@ var vNode = {
         },
         savePageState: function () {
             this.scrollTop = $('#unit_portrayal').scrollTop()
-            var scrollTopOffset = 10 // 滚动误差
+            var scrollTopOffset = 5 // 滚动误差
             var data = {
                 chartLoading: this.chartLoading,
                 tabActiveName: this.tabActiveName,
@@ -1600,6 +1601,7 @@ var vNode = {
                 $data = JSON.parse($data)
                 // 如果恢复的企业名称和当前url企业名称不同,则清除缓存,重新请求
                 if (this.buyer.name !== $data.buyer.name) {
+                    console.log('画像id与缓存id不同,清空缓存')
                     sessionStorage.removeItem(this.sessKey)
                     return false
                 }
@@ -1625,11 +1627,11 @@ var vNode = {
             if (this.scrollTop) {
               setTimeout(function () {
                 $('#unit_portrayal').scrollTop(_this.scrollTop)
-              }, 300)
+              }, 200)
             }
         },
         onExampleOpenPage: function () {
-          // this.savePageState()
+          this.savePageState()
         },
         openDialog: function () {
           var _this = this
@@ -1646,6 +1648,7 @@ var vNode = {
               btnText = '去开通'
             } else {
               // 立即解锁
+              this.savePageState()
               location.href = '/weixin/frontPage/bigmember/free/perfect_info?source=buyer_portrait_getNewMsg_freeuser'
               // 需要return出去 直接跳留资 不弹弹框
               return
@@ -1674,6 +1677,7 @@ var vNode = {
           }).then(function(){
             if (btnText == '联系客服') {
               // location.href = "tel: 400-108-6670"
+              _this.savePageState()
               location.href = '/big/wx/page/customer'
             } else if (btnText == '前往升级') {
               // location.href = '/front/vipsubscribe/upgradePage'
@@ -1700,6 +1704,7 @@ var vNode = {
                 )
               )
             } catch (error) {}
+            this.savePageState()
             var href = '/article/content/' + item.id + '.html'
             location.href = href
           } else {
@@ -1731,6 +1736,7 @@ var vNode = {
         },
         //免费赠送采购单位全景分析体验 去解锁
         goGiveAnalysis: function(){
+          this.savePageState()
           location.href = '/weixin/frontPage/bigmember/free/perfect_info?source=buyer_portrait_freeuser';
         },
         // 前往升级或联系客服

+ 9 - 1
src/web/staticres/common-module/big-member/js/client_portrayal.js

@@ -385,6 +385,7 @@ var vNode = {
         }, 20)
       },
       goEntInfo: function(item) {
+        this.savePageState()
         if (utils.isWeiXinBrowser) {
           location.href = "/weixin/frontPage/collection/sess/ent_portrait?eId=" + encodeURIComponent(item.id)
         } else {
@@ -519,6 +520,7 @@ var vNode = {
       },
       //数据导出
       onExport() {
+        var _this = this
         var storageSet = this.getHighSet()
         // var isMember = this.bigStatus > 0 && this.power.indexOf(5) > -1
         var data = {
@@ -536,6 +538,7 @@ var vNode = {
           data: storageSet ? Object.assign(data, storageSet) : data,
           timeout: 8000,
           success: function (res) {
+            _this.savePageState()
             window.location.href = "/jy_mobile/common/order/create/dataexport?id=" + res.data
           },
           error: function (err) {
@@ -593,6 +596,7 @@ var vNode = {
             confirmButtonColor: '#2ABED1'
           });
         } else {
+          this.savePageState()
           if (utils.isWeiXinBrowser) {
             location.href = '/big/wx/page/free_buyer_project_news?entName=' + decodeURIComponent(utils.getParam('entName'))
           } else {
@@ -1588,7 +1592,7 @@ var vNode = {
       },
       savePageState: function () {
         this.scrollTop = $('#client_portrayal').scrollTop()
-        var scrollTopOffset = 10 // 滚动误差
+        var scrollTopOffset = 5 // 滚动误差
         var data = {
           chartLoading: this.chartLoading,
           tabActiveName: this.tabActiveName,
@@ -1660,6 +1664,7 @@ var vNode = {
             content = '您已经免费解锁过【采购单位全景分析】权益1次,暂无免费查看权限。如需查看更多,请开通超级订阅获取更多权限。'
             btnText = '去开通'
           } else {
+            _this.savePageState()
             // 立即解锁
             location.href = '/weixin/frontPage/bigmember/free/perfect_info?source=buyer_portrait_getNewMsg_freeuser'
             // 需要return出去 直接跳留资 不弹弹框
@@ -1694,6 +1699,7 @@ var vNode = {
             // } catch (error) {
             //   console.log(error)
             // }
+            _this.savePageState()
             location.href = '/big/wx/page/customer'
           } else if (btnText == '前往升级') {
             //跳转清除旧套餐缓存,防止计算价格出错
@@ -1721,6 +1727,7 @@ var vNode = {
               )
             )
           } catch (error) {}
+          this.savePageState()
           var href = ''
           if (utils.isWeiXinBrowser) {
             href = '/article/content/' + item.id + '.html'
@@ -1761,6 +1768,7 @@ var vNode = {
       },
       //免费赠送采购单位全景分析体验 去解锁
       goGiveAnalysis: function(){
+        this.savePageState()
         var prefix = utils.isWeiXinBrowser ? '/weixin' : '/jyapp'
         location.href = prefix + '/frontPage/bigmember/free/perfect_info?source=buyer_portrait_freeuser';
       },