Parcourir la source

行为轨迹统计

zhengjinyi il y a 2 ans
Parent
commit
89716f828e

+ 1 - 1
src/main/resources/config/dev/application-dev.yml

@@ -56,7 +56,7 @@ caimei:
   #spiServer: http://192.168.2.68:8008
   coreServer: https://core-b.caimei365.com
   #coreServer: http://192.168.2.67:18002
-  #coreServer: http://192.168.2.75:18002
+#  coreServer: http://192.168.2.17:18002
   #coreServer: http://192.168.2.200:18002
   imageDomain: https://img-b.caimei365.com
   wwwDomain: http://localhost:8009

+ 1 - 1
src/main/resources/static/js/activity/attestation.js

@@ -63,7 +63,7 @@ new Vue({
     },
     mounted() {
         // this.initSwiper1()
-        this.cmSysParams.pageType = '认证通';
+        this.cmSysParams.pageType = 5;
         this.cmSysParams.pageLabel = '认证通';
         this.initSwiper2()
     },

+ 7 - 0
src/main/resources/static/js/article/detail.js

@@ -19,6 +19,7 @@
 //相关阅读
 var articleRelated = new Vue({
     el: "#articleRelated",
+    mixins: [cmSysVitaMixins],
     data: {
         infoId: $("#articleId").val()?$("#articleId").val()*1:0,
         articleLabels: $("#articleLabels").val()?$("#articleLabels").val():"",
@@ -40,6 +41,12 @@ var articleRelated = new Vue({
 
     },
     created: function () {
+        const pageLabelArray = []
+        $('.dea-tag-li').each(function(){
+            pageLabelArray.push($(this).find('a').text());
+        })
+        this.cmSysParams.pageType = 11;
+        this.cmSysParams.pageLabel =  pageLabelArray.join(',');
         this.infoId = $("#articleId").val() ? $("#articleId").val()*1 : 0;
         this.articleLabels = $("#articleLabels").val()?$("#articleLabels").val():"";
         // 获取相关阅读

+ 17 - 0
src/main/resources/static/js/encyclopedia/detail.js

@@ -89,3 +89,20 @@ $(function () {
         $(this).parents('#video-popup').hide();
     });
 });
+//百科
+var encyclopedia = new Vue({
+    el: "#encyclopedia",
+    mixins: [cmSysVitaMixins],
+    data: {
+
+    },
+    methods: {},
+    created: function () {
+        // 行为轨迹统计
+        this.cmSysParams.pageType = 12;
+        this.cmSysParams.pageLabel =  $('#discription').text();
+    },
+    mounted: function () {
+
+    }
+});

+ 1 - 1
src/main/resources/static/js/flea-market/form.js

@@ -483,7 +483,7 @@ var fleaMarketForm = new Vue({
     },
     mounted:function () {
         var _this = this;
-        this.cmSysParams.pageType = '发布二手';
+        this.cmSysParams.pageType = 4;
         this.cmSysParams.pageLabel = '发布二手';
         SecondApi.brandList({},function (res) {//品牌列表
             if(res.code == 0){

+ 1 - 1
src/main/resources/static/js/flea-market/list.js

@@ -158,7 +158,7 @@ var fleaMarketList = new Vue({
      },
      mounted:function () {
         var _this = this;
-        this.cmSysParams.pageType = '二手市场';
+        this.cmSysParams.pageType = 3;
         this.cmSysParams.pageLabel = '二手市场';
           var userInfo = JSON.parse(localStorage.getItem('userInfo'));
           if(userInfo){

+ 1 - 1
src/main/resources/static/js/flea-market/secondDetail.js

@@ -127,7 +127,7 @@ var fleaMarket = new Vue({
     },
     created: function () {
         this.id = $("#productId").val();
-        this.cmSysParams.pageType = '二手商品详情';
+        this.cmSysParams.pageType = 7;
     },
     mounted: function () {
      var _self = this;

+ 1 - 1
src/main/resources/static/js/index.js

@@ -360,7 +360,7 @@ var homeData = new Vue({
     },
     mounted: function() {
         var _this = this;
-        this.cmSysParams.pageType = '商城首页';
+        this.cmSysParams.pageType = 1;
         this.cmSysParams.pageLabel = '首页';
         // 页面主图轮播
         this.swiperBanner();

+ 9 - 16
src/main/resources/static/js/mixins/cmSysMixins.js

@@ -25,27 +25,20 @@ var cmSysVitaMixins = function () {
                 this.cmSysParams.pagePath = window.location.href;
                 this.clearTimeSet = setInterval(() => {
                     _self.cmSysParams.accessDuration++;
-                    console.log(`页面路径:${_self.cmSysParams.pagePath}`,`停留:${_self.cmSysParams.accessDuration}s`,`标签:${_self.cmSysParams.pageLabel}`)
                 }, 1000);
             },
-            userRecordStatistics(params) {
-                var _this = this;
-                PublicApi.userRecordStatistics(params,function (response) {
-                    if(response.code === 0){
-                        alert('111111111111111')
-                        console.log('<-------上送用户行为记录成功------>')
-                    }else{
-                        console.log('<-------上送用户行为记录异常------>')
-                    }
-                })
+            userRecordStatistics(url,data) {// navigator.sendBeacon 方式  发送统计数据
+                const blob = new Blob([JSON.stringify(data)], {
+                    type: 'application/json; charset=UTF-8',
+                });
+                navigator.sendBeacon(url, blob);
             },
             beforeunloadHandler(e) {
-                debugger
-                this.userRecordStatistics(this.cmSysParams); // 上送后台接口,将浏览时长等信息传到后台,离开当前路由后调用
-
-                console.log('关闭窗口之后',this.cmSysParams)
+                console.log(`页面路径:${this.cmSysParams.pagePath}`,`停留:${this.cmSysParams.accessDuration}s`,`标签:${this.cmSysParams.pageLabel}`)
+                var NODE_ENV_BASE_URL = $("#coreServer").val();
+                var url = `${NODE_ENV_BASE_URL}/user/record/Statistics`
+                this.userRecordStatistics(url,this.cmSysParams); // 上送后台接口,将浏览时长等信息传到后台,离开当前路由后调用
                 clearInterval(this.clearTimeSet); // 离开页面后清除定时器
-
             }
         },
         mounted() {

+ 1 - 1
src/main/resources/static/js/product/detail.js

@@ -818,7 +818,7 @@ var productDetail = new Vue({
     },
     created: function () {
         this.productId = this.couponParam.productId = this.listQuery.productId = $("#productId").val();
-        this.cmSysParams.pageType = '新商品详情';
+        this.cmSysParams.pageType = 6;
         this.cmSysParams.productId = this.productId;
         this.typeId = $("#typeId").val();
         console.log('typeId', this.typeId)

+ 1 - 1
src/main/resources/static/js/product/list.js

@@ -321,7 +321,7 @@ var productList = new Vue({
             this.params.num = 1;
         }
         this.params.keyword = this.brandParam.keyword = getUrlParam("keyword") ? getUrlParam("keyword") : "";
-        this.cmSysParams.pageType = '商品搜索';
+        this.cmSysParams.pageType = 8;
         this.cmSysParams.pageLabel = this.params.keyword;
         // 搜索框赋值
         $('#topSearch').find('[data-select]').attr("data-select", 0).text("产品");

+ 1 - 1
src/main/resources/static/js/product/produce-list.js

@@ -340,7 +340,7 @@ var productList = new Vue({
         },500)
         //设置数据统计
         this.$nextTick(function(){
-            _self.cmSysParams.pageType = '分类列表';//设置数据统计
+            _self.cmSysParams.pageType = 10;//设置数据统计
             _self.cmSysParams.pageLabel = $('.crumbs-nav-item.on').text();//设置数据统计
         })
         if(!isPC){

+ 1 - 1
src/main/resources/static/js/product/product-hot.js

@@ -262,7 +262,7 @@ var productList = new Vue({
     created: function () {
         var _self = this
         // this.searchFlag = (this.params.keyword !== "");
-        this.cmSysParams.pageType = '新品橱窗';
+        this.cmSysParams.pageType = 2;
         this.cmSysParams.pageLabel = '新品';
         if(globalUserData){
             this.userId = 	this.listQuery.userId = globalUserData.userId;

+ 3 - 1
src/main/resources/static/js/single-page/page.js

@@ -1,5 +1,6 @@
 var freePage = new Vue({
     el: "#freePage",
+    mixins: [cmSysVitaMixins],
     data: {
         pageId:0,
         bgClass:'',
@@ -15,6 +16,7 @@ var freePage = new Vue({
             PagesApi.GetPageFree({id: _self.pageId}, function (response) {
                 if (response.code === 0) {
                     _self.pageInfo =  response.data;
+                    _self.cmSysParams.pageLabel = _self.pageInfo.pageLabel;
                     if( _self.pageInfo.backgroundImageWay == 1){
                         _self.bgClass = 'bg-repeat';
                     }else{
@@ -27,7 +29,7 @@ var freePage = new Vue({
         },
     },
     created: function () {
-
+        this.cmSysParams.pageType = 13;
     },
     mounted: function () {
         var _self = this;

+ 1 - 1
src/main/resources/static/js/supplier/list.js

@@ -95,7 +95,7 @@ var supplierList = new Vue({
             this.params.num = 1;
         }
         this.params.keyword = getUrlParam("keyword") ? getUrlParam("keyword") : "";
-        this.cmSysParams.pageType = '供应商搜索';
+        this.cmSysParams.pageType = 9;
         this.cmSysParams.pageLabel = this.params.keyword;
         // 搜索框赋值
         $('#topSearch').find('[data-select]').attr("data-select", 1).text("供应商");

+ 2 - 1
src/main/resources/templates/article/detail.html

@@ -37,7 +37,7 @@
                 <span class="like icon mIcon" th:attr="data-count=*{likes}, data-id=*{id}" th:text="*{likes}"></span>
             </div>
             <p class="dea-tag">
-                <span th:each="label,labelStat:*{labels}" th:if="${not #strings.isEmpty(label)}">
+                <span class="dea-tag-li" th:each="label,labelStat:*{labels}" th:if="${not #strings.isEmpty(label)}">
                     <a th:each="labelId,idStat:*{labelIds}" th:if="${idStat.index==labelStat.index}" th:href="'/info/label-'+${labelId}+'-1.html'" th:text="${label}"></a>
                 </span>
             </p>
@@ -90,6 +90,7 @@
 <template th:replace="components/foot-link"></template>
 <script charset="utf-8" type="text/javascript" src="/lib/jquery.qrcode.min.js"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/article/common.js(v=${version})}"></script>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/mixins/cmSysMixins.js(v=${version})}"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/article/detail.js(v=${version})}"></script>
 </body>
 </html>

+ 4 - 0
src/main/resources/templates/encyclopedia/components/footer.html

@@ -13,4 +13,8 @@
 </footer>
 <!-- 底部公共js -->
 <script src="/lib/jquery-3.6.0.min.js"></script>
+<script charset="utf-8" type="text/javascript" src="/lib/vue2.6.12.min.js"></script>
+<script charset="utf-8" type="text/javascript" src="/lib/jquery.slide-2.1.3.js"></script>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/utils.service.js(v=${version})}"></script>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/base.js(v=${version})}"></script>
 <script th:src="@{/js/encyclopedia/common.js(v=${version})}" xmlns:th="https://www.thymeleaf.org"></script>

+ 2 - 2
src/main/resources/templates/encyclopedia/instrument-detail.html

@@ -18,7 +18,7 @@
 <!-- 引用公共头部 -->
 <template th:replace="encyclopedia/components/header"></template>
 
-<article class="article" th:object="${baikeInstrument}">
+<article class="article" th:object="${baikeInstrument}" id="encyclopedia">
     <!-- 仪器简述 -->
     <section class="section description">
         <div class="title">
@@ -32,7 +32,7 @@
                     <div class="alias">别名:<span th:text="*{alias}"></span></div>
                 </div>
                 <!-- 描述 -->
-                <div class="row desc" th:text="*{discription}"></div>
+                <div class="row desc" id="discription" th:text="*{discription}"></div>
             </div>
             <div class="cover">
                 <img th:src="*{image}" th:alt="*{name}"/>

+ 2 - 2
src/main/resources/templates/encyclopedia/product-detail.html

@@ -17,7 +17,7 @@
 <body>
 <!-- 引用公共头部 -->
 <template th:replace="encyclopedia/components/header"></template>
-<article class="article" th:object="${baikeProduct}">
+<article class="article" th:object="${baikeProduct}" id="encyclopedia">
     <!-- 产品简述 -->
     <section class="section description">
         <div class="title">
@@ -31,7 +31,7 @@
                     <div class="alias">别名:<span th:text="*{alias}"></span></div>
                 </div>
                 <!-- 描述 -->
-                <div class="row desc" th:text="*{discription}"></div>
+                <div class="row desc" id="discription" th:text="*{discription}"></div>
             </div>
             <div class="cover">
                 <img th:src="*{image}" th:alt="*{name}"/>

+ 1 - 0
src/main/resources/templates/single-page/page.html

@@ -49,6 +49,7 @@
 <template th:replace="components/footer"></template>
 <template th:replace="components/foot-link"></template>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/pages.service.js(v=${version})}"></script>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/mixins/cmSysMixins.js(v=${version})}"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/single-page/page.js(v=${version})}"></script>
 
 </body>