浏览代码

fix:画像toast提示、重置画像生成、style

yangfeng 3 年之前
父节点
当前提交
321ec4134c

+ 13 - 9
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/analysis_result.js

@@ -180,12 +180,12 @@ var vNode = {
     },
     },
     beforeDestroy() {
     beforeDestroy() {
         window.removeEventListener("resize", this.init,20);
         window.removeEventListener("resize", this.init,20);
-        // if(hotChart) {
-        //     hotChart.dispose();
-        // }
-        // if(pieChart) {
-        //     pieChart.dispose();
-        // }
+        if(this.hotChartRef) {
+          this.hotChartRef.dispose();
+        }
+        if(this.pieChartRef) {
+          this.pieChartRef.dispose();
+        }
     },
     },
     mounted() {
     mounted() {
         this.year = new Date().getFullYear() - 2;
         this.year = new Date().getFullYear() - 2;
@@ -217,11 +217,15 @@ var vNode = {
         },
         },
         // resize 屏幕尺寸
         // resize 屏幕尺寸
         init: function(){
         init: function(){
-            var that = this
-            window.addEventListener('resize', function() {
+          var that = this
+          window.addEventListener('resize', function() {
+            if (that.hotChartRef) {
               that.hotChartRef.resize();
               that.hotChartRef.resize();
+            }
+            if (that.pieChartRef) {
               that.pieChartRef.resize();
               that.pieChartRef.resize();
-              that.screenWidth = document.body.clientWidth || window.screen.width
+            }
+            that.screenWidth = document.body.clientWidth || window.screen.width
           })
           })
         },
         },
         // 跳企业画像
         // 跳企业画像

+ 3 - 3
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/ent_portrait.js

@@ -390,7 +390,7 @@ var vNode = {
           }
           }
         },
         },
         error: function (error) {
         error: function (error) {
-          _this.$toast('请求失败')
+          // _this.$toast('请求失败')
         }
         }
       })
       })
     },
     },
@@ -469,11 +469,11 @@ var vNode = {
               _this.topProject.list = res.data.list
               _this.topProject.list = res.data.list
             }
             }
           } else {
           } else {
-            _this.$toast(res.error_msg)
+            // _this.$toast(res.error_msg)
           }
           }
         },
         },
         error: function (error) {
         error: function (error) {
-          _this.$toast('请求失败')
+          // _this.$toast('请求失败')
         }
         }
       })
       })
     },
     },

+ 54 - 32
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/unit_portrayal.js

@@ -1,5 +1,5 @@
-var hotChart = null;
-var pieChart = null;
+// var hotChart = null;
+// var pieChart = null;
 var vNode = {
 var vNode = {
     delimiters: ['${', '}'],
     delimiters: ['${', '}'],
     el: '#unit_portrayal',
     el: '#unit_portrayal',
@@ -42,7 +42,6 @@ var vNode = {
                 showLine: ['项目金额'],
                 showLine: ['项目金额'],
                 axisSite: { right: ['项目金额'] }
                 axisSite: { right: ['项目金额'] }
             },
             },
-            // hotChart: null,
             isShow:{
             isShow:{
                 showDynamic: false,
                 showDynamic: false,
                 showYearData: false,
                 showYearData: false,
@@ -117,7 +116,9 @@ var vNode = {
             },
             },
             bigStatus: 0,
             bigStatus: 0,
             encryptId: '', // 首次埋点返回的加密id 用于点击去开通传参
             encryptId: '', // 首次埋点返回的加密id 用于点击去开通传参
-            power: []
+            power: [],
+            hotChart: null,
+            pieChart: null
         }
         }
     },
     },
     computed: {
     computed: {
@@ -157,9 +158,26 @@ var vNode = {
           return this.power.indexOf(5)  == -1 // power == 5
           return this.power.indexOf(5)  == -1 // power == 5
         },
         },
     },
     },
+    watch: {
+      // 监听热力图
+      hotChart: function (newVal) {
+        // console.log(newVal, chartOptions.hotChart, '热力图')
+        if (newVal) {
+          newVal.setOption(chartOptions.hotChart);
+          newVal.resize()
+        }
+      },
+      // 监听饼图
+      pieChart: function (newVal) {
+        // console.log(newVal, chartOptions.deformPieChart, '饼图')
+        if (newVal) {
+          newVal.setOption(chartOptions.deformPieChart);
+          newVal.resize()
+        }
+      }
+    },
     created () {
     created () {
       this.getPowerInfo()
       this.getPowerInfo()
-      this.init();
     },
     },
     mounted: function () {
     mounted: function () {
         this.buyer.name = decodeURIComponent(utils.getParam('entName'))
         this.buyer.name = decodeURIComponent(utils.getParam('entName'))
@@ -170,20 +188,19 @@ var vNode = {
           sessionStorage.removeItem('buyer_high_set')
           sessionStorage.removeItem('buyer_high_set')
           sessionStorage.removeItem('buyer_high_name')
           sessionStorage.removeItem('buyer_high_name')
         }
         }
-        // var storageSet = JSON.parse(sessionStorage.getItem('buyer_high_set'))
-        // if (storageSet && this.getStatus) {
-          this.getNewMsg(); // 中标动态
-          this.getChartData(); // 企业画像
-        // }
+        
+        this.getNewMsg(); // 中标动态
+        this.getChartData(); // 企业画像
+        this.init();
     },
     },
     beforeDestroy() {
     beforeDestroy() {
-        window.removeEventListener("resize", this.init,20);
-        if(hotChart) {
-            hotChart.dispose();
-        }
-        if(pieChart) {
-            pieChart.dispose();
-        }
+      window.removeEventListener("resize", this.init,20);
+      if(this.hotChart) {
+        this.hotChart.dispose();
+      }
+      if(this.pieChart) {
+        this.pieChart.dispose();
+      }
     },
     },
     methods: {
     methods: {
         // 获取权限信息
         // 获取权限信息
@@ -279,11 +296,16 @@ var vNode = {
           })
           })
         },
         },
         init() {
         init() {
-            setTimeout(function() {
-                window.addEventListener('resize', function() {
-                    hotChart.resize();
-                })
-            }, 20)
+          setTimeout(function() {
+            window.addEventListener('resize', function() {
+              if (this.hotChart) {
+                this.hotChart.resize();
+              }
+              if (this.pieChart) {
+                this.pieChart.resize();
+              }
+            })
+          }, 20)
         },
         },
         goEntInfo: function(item) {
         goEntInfo: function(item) {
             location.href = './ent_portrait?eId=' + encodeURIComponent(item.entId)
             location.href = './ent_portrait?eId=' + encodeURIComponent(item.entId)
@@ -975,30 +997,30 @@ var vNode = {
             var index;
             var index;
             that.$nextTick(function(){
             that.$nextTick(function(){
                 var ref = that.$refs.hotChart;
                 var ref = that.$refs.hotChart;
-                hotChart = echarts.init(ref,null,{renderer: "svg"});
-                hotChart.setOption(chartOptions.hotChart);
+                that.hotChart = echarts.init(ref,null,{renderer: "svg"});
+                that.hotChart.setOption(chartOptions.hotChart);
                 setTimeout(function(){
                 setTimeout(function(){
                     // 默认展示某一个tooltip
                     // 默认展示某一个tooltip
-                    hotChart.dispatchAction({
+                    that.hotChart.dispatchAction({
                         type: 'highlight',
                         type: 'highlight',
                         seriesIndex: 0,  // 显示第几个series
                         seriesIndex: 0,  // 显示第几个series
                         dataIndex: that.getMaxProjectCount(data) // 显示第几个数据
                         dataIndex: that.getMaxProjectCount(data) // 显示第几个数据
                     });
                     });
                 },20)
                 },20)
-                hotChart.on("mouseover", function(e) {
+                that.hotChart.on("mouseover", function(e) {
                     index = that.getMaxProjectCount(data)
                     index = that.getMaxProjectCount(data)
                     if (e.dataIndex != index) {
                     if (e.dataIndex != index) {
-                        hotChart.dispatchAction({
+                      that.hotChart.dispatchAction({
                             type: "downplay",
                             type: "downplay",
                             seriesIndex: 0,
                             seriesIndex: 0,
                             dataIndex: index
                             dataIndex: index
                         });
                         });
                     }
                     }
                 });
                 });
-                hotChart.on("mouseout", function(e) {
+                that.hotChart.on("mouseout", function(e) {
                     index = that.getMaxProjectCount(data)
                     index = that.getMaxProjectCount(data)
                     if (e.dataIndex != index) {
                     if (e.dataIndex != index) {
-                        hotChart.dispatchAction({
+                      that.hotChart.dispatchAction({
                             type: "highlight",
                             type: "highlight",
                             seriesIndex: 0,
                             seriesIndex: 0,
                             dataIndex: that.getMaxProjectCount(data)
                             dataIndex: that.getMaxProjectCount(data)
@@ -1080,9 +1102,9 @@ var vNode = {
             }
             }
             that.$nextTick(function(){
             that.$nextTick(function(){
                 var ref = that.$refs.pieChart;
                 var ref = that.$refs.pieChart;
-                pieChart = echarts.init(ref,null,{renderer: "svg"});
-                pieChart.setOption(chartOptions.deformPieChart);
-                pieChart.resize();
+                that.pieChart = echarts.init(ref,null,{renderer: "svg"});
+                that.pieChart.setOption(chartOptions.deformPieChart);
+                that.pieChart.resize();
             })
             })
         },
         },
         arrTrans: function(num, arr) { // 一维数组转换为二维数组
         arrTrans: function(num, arr) { // 一维数组转换为二维数组

+ 50 - 31
src/web/staticres/big-member/js/unit_portrayal.js

@@ -1,5 +1,3 @@
-var hotChart = null;
-var pieChart = null;
 var vNode = {
 var vNode = {
     delimiters: ['${', '}'],
     delimiters: ['${', '}'],
     el: '#unit_portrayal',
     el: '#unit_portrayal',
@@ -117,7 +115,9 @@ var vNode = {
             },
             },
             bigStatus: 0,
             bigStatus: 0,
             encryptId: '', // 首次埋点返回的加密id 用于点击去开通传参
             encryptId: '', // 首次埋点返回的加密id 用于点击去开通传参
-            power: []
+            power: [],
+            hotChart: null,
+            pieChart: null
         }
         }
     },
     },
     computed: {
     computed: {
@@ -157,9 +157,24 @@ var vNode = {
           return this.power.indexOf(5)  == -1 // power == 5
           return this.power.indexOf(5)  == -1 // power == 5
         },
         },
     },
     },
+    watch: {
+      // 监听热力图
+      hotChart: function (newVal) {
+        if (newVal) {
+          newVal.setOption(chartOptions.hotChart);
+          newVal.resize()
+        }
+      },
+      // 监听饼图
+      pieChart: function (newVal) {
+        if (newVal) {
+          newVal.setOption(chartOptions.deformPieChart);
+          newVal.resize()
+        }
+      }
+    },
     created () {
     created () {
       this.getPowerInfo()
       this.getPowerInfo()
-        this.init();
     },
     },
     mounted: function () {
     mounted: function () {
         this.buyer.name = decodeURIComponent(utils.getParam('entName'));
         this.buyer.name = decodeURIComponent(utils.getParam('entName'));
@@ -169,20 +184,19 @@ var vNode = {
           sessionStorage.removeItem('buyer_high_set')
           sessionStorage.removeItem('buyer_high_set')
           sessionStorage.removeItem('buyer_high_name')
           sessionStorage.removeItem('buyer_high_name')
         }
         }
-        // var storageSet = JSON.parse(sessionStorage.getItem('buyer_high_set'))
-        // if (storageSet && !this.getStatus) {
-          this.getNewMsg(); // 中标动态
-          this.getChartData(); // 企业画像
-        // }
+      
+        this.getNewMsg(); // 中标动态
+        this.getChartData(); // 企业画像
+        this.init();
     },
     },
     beforeDestroy() {
     beforeDestroy() {
-        window.removeEventListener("resize", this.init,20);
-        if(hotChart) {
-            hotChart.dispose();
-        }
-        if(pieChart) {
-            pieChart.dispose();
-        }
+      window.removeEventListener("resize", this.init,20);
+      if(this.hotChart) {
+        this.hotChart.dispose();
+      }
+      if(this.pieChart) {
+        this.pieChart.dispose();
+      }
     },
     },
     methods: {
     methods: {
         // 获取权限信息
         // 获取权限信息
@@ -278,11 +292,16 @@ var vNode = {
           })
           })
         },
         },
         init() {
         init() {
-            setTimeout(function() {
-                window.addEventListener('resize', function() {
-                    hotChart.resize();
-                })
-            }, 20)
+          setTimeout(function() {
+            window.addEventListener('resize', function() {
+              if (this.hotChart) {
+                this.hotChart.resize();
+              }
+              if (this.pieChart) {
+                this.pieChart.resize();
+              }
+            })
+          }, 20)
         },
         },
         goEntInfo: function(item) {
         goEntInfo: function(item) {
             location.href = "/weixin/frontPage/collection/sess/ent_portrait?eId=" + encodeURIComponent(item.entId)
             location.href = "/weixin/frontPage/collection/sess/ent_portrait?eId=" + encodeURIComponent(item.entId)
@@ -975,30 +994,30 @@ var vNode = {
             var index;
             var index;
             that.$nextTick(function(){
             that.$nextTick(function(){
                 var ref = that.$refs.hotChart;
                 var ref = that.$refs.hotChart;
-                hotChart = echarts.init(ref,null,{renderer: "svg"});
-                hotChart.setOption(chartOptions.hotChart);
+                that.hotChart = echarts.init(ref,null,{renderer: "svg"});
+                that.hotChart.setOption(chartOptions.hotChart);
                 setTimeout(function(){
                 setTimeout(function(){
                     // 默认展示某一个tooltip
                     // 默认展示某一个tooltip
-                    hotChart.dispatchAction({
+                    that.hotChart.dispatchAction({
                         type: 'highlight',
                         type: 'highlight',
                         seriesIndex: 0,  // 显示第几个series
                         seriesIndex: 0,  // 显示第几个series
                         dataIndex: that.getMaxProjectCount(data) // 显示第几个数据
                         dataIndex: that.getMaxProjectCount(data) // 显示第几个数据
                     });
                     });
                 },20)
                 },20)
-                hotChart.on("mouseover", function(e) {
+                that.hotChart.on("mouseover", function(e) {
                     index = that.getMaxProjectCount(data)
                     index = that.getMaxProjectCount(data)
                     if (e.dataIndex != index) {
                     if (e.dataIndex != index) {
-                        hotChart.dispatchAction({
+                      that.hotChart.dispatchAction({
                             type: "downplay",
                             type: "downplay",
                             seriesIndex: 0,
                             seriesIndex: 0,
                             dataIndex: index
                             dataIndex: index
                         });
                         });
                     }
                     }
                 });
                 });
-                hotChart.on("mouseout", function(e) {
+                that.hotChart.on("mouseout", function(e) {
                     index = that.getMaxProjectCount(data)
                     index = that.getMaxProjectCount(data)
                     if (e.dataIndex != index) {
                     if (e.dataIndex != index) {
-                        hotChart.dispatchAction({
+                      that.hotChart.dispatchAction({
                             type: "highlight",
                             type: "highlight",
                             seriesIndex: 0,
                             seriesIndex: 0,
                             dataIndex: that.getMaxProjectCount(data)
                             dataIndex: that.getMaxProjectCount(data)
@@ -1080,9 +1099,9 @@ var vNode = {
             }
             }
             that.$nextTick(function(){
             that.$nextTick(function(){
                 var ref = that.$refs.pieChart;
                 var ref = that.$refs.pieChart;
-                pieChart = echarts.init(ref,null,{renderer: "svg"});
-                pieChart.setOption(chartOptions.deformPieChart);
-                pieChart.resize();
+                that.pieChart = echarts.init(ref,null,{renderer: "svg"});
+                that.pieChart.setOption(chartOptions.deformPieChart);
+                that.pieChart.resize();
             })
             })
         },
         },
         arrTrans: function(num, arr) { // 一维数组转换为二维数组
         arrTrans: function(num, arr) { // 一维数组转换为二维数组

+ 3 - 3
src/web/staticres/common-module/big-member/css/high_set.css

@@ -67,10 +67,10 @@
   border-radius: 4px;
   border-radius: 4px;
 }
 }
 .match-item.active{
 .match-item.active{
-  background: url(../image/item-checked.png) no-repeat center center #fff;
-  background-size: 100% 100%;
+  background: url(../image/item-checked.png) no-repeat center center;
+  background-size: contain;
   border: 0;
   border: 0;
-  overflow: hidden;
+  box-sizing: border-box;
 }
 }
 .match-item .match-value{
 .match-item .match-value{
   color: #171826;
   color: #171826;

+ 3 - 3
src/web/staticres/common-module/collection/js/ent_portrait.js

@@ -395,7 +395,7 @@ var vNode = {
           }
           }
         },
         },
         error: function (error) {
         error: function (error) {
-          _this.$toast('请求失败')
+          // _this.$toast('请求失败')
         }
         }
       })
       })
     },
     },
@@ -471,11 +471,11 @@ var vNode = {
               _this.topProject.list = res.data.list
               _this.topProject.list = res.data.list
             }
             }
           } else {
           } else {
-            _this.$toast(res.error_msg)
+            // _this.$toast(res.error_msg)
           }
           }
         },
         },
         error: function (error) {
         error: function (error) {
-          _this.$toast('请求失败')
+          // _this.$toast('请求失败')
         }
         }
       })
       })
     },
     },