Browse Source

cnzz流量统计,计数器去除轮询

yangc 8 years ago
parent
commit
e26b26132d
3 changed files with 25 additions and 16 deletions
  1. 6 2
      app.html
  2. 5 0
      assets/scss/common.scss
  3. 14 14
      components/main/count/Box.vue

+ 6 - 2
app.html

@@ -21,12 +21,16 @@
         appendScript('https://cdn.bootcss.com/html5shiv/r29/html5.min.js')
         appendScript('https://cdn.bootcss.com/js-polyfills/0.1.33/polyfill.min.js')
       }
-      var hm = document.createElement("script");
+      var hm = d.createElement("script");
       hm.src = "https://hm.baidu.com/hm.js?34793672f88552a77437f2cee7864118;"
-      var s = document.getElementsByTagName("script")[0];
+      var s = d.getElementsByTagName("script")[0];
       s.parentNode.insertBefore(hm, s);
+      var cnzz_protocol = (("https:" == d.location.protocol) ? " https://" : " http://");
+      d.write(unescape("%3Cspan id='cnzz_stat_icon_1267002346'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s19.cnzz.com/z_stat.php%3Fid%3D1267002346%26show%3Dpic' type='text/javascript'%3E%3C/script%3E"));
     })(window, document)
   </script>
+  <script type="text/javascript">
+  </script>
 </head>
 <body {{ BODY_ATTRS }}>
 {{ APP }}

+ 5 - 0
assets/scss/common.scss

@@ -18,6 +18,11 @@
     background-color: rgba(95,95,95, .7);
   }
 }
+
+#cnzz_stat_icon_1267002346 {
+  display: none;
+}
+
 // common style
 .clearfix {
   &:before, &:after {

+ 14 - 14
components/main/count/Box.vue

@@ -32,21 +32,21 @@
       counts () {
         return this.$store.state.product.common.counts
       }
-    },
-    mounted () {
-      this.$nextTick(() => {
-//        this.loadCounts()
-        // 刷新统计信息
-        setInterval(() => {
-          this.loadCounts()
-        }, 30000)
-      })
-    },
-    methods: {
-      loadCounts () {
-        this.$store.dispatch('loadProductCounts', { _status: 'actived' })
-      }
     }
+//    mounted () {
+//      this.$nextTick(() => {
+//        this.loadCounts()
+//        // 刷新统计信息
+//        setInterval(() => {
+//          this.loadCounts()
+//        }, 30000)
+//      })
+//    },
+//    methods: {
+//      loadCounts () {
+//        this.$store.dispatch('loadProductCounts', { _status: 'actived' })
+//      }
+//    }
   }
 </script>
 <style lang="scss" scoped>