Sfoglia il codice sorgente

用户浏览记录

zhengjinyi 2 anni fa
parent
commit
a3e08e6038
26 ha cambiato i file con 85 aggiunte e 21 eliminazioni
  1. 3 0
      src/main/resources/static/js/activity/attestation.js
  2. 0 1
      src/main/resources/static/js/base.js
  3. 11 0
      src/main/resources/static/js/common/serviceapi/user.service.js
  4. 11 8
      src/main/resources/static/js/flea-market/form.js
  5. 4 1
      src/main/resources/static/js/flea-market/list.js
  6. 3 0
      src/main/resources/static/js/flea-market/secondDetail.js
  7. 3 1
      src/main/resources/static/js/index.js
  8. 19 8
      src/main/resources/static/js/mixins/cmSysMixins.js
  9. 4 1
      src/main/resources/static/js/product/detail.js
  10. 3 0
      src/main/resources/static/js/product/list.js
  11. 6 0
      src/main/resources/static/js/product/produce-list.js
  12. 3 0
      src/main/resources/static/js/product/product-hot.js
  13. 3 0
      src/main/resources/static/js/supplier/list.js
  14. 1 0
      src/main/resources/templates/activity/attestation.html
  15. 0 1
      src/main/resources/templates/components/foot-link.html
  16. 1 0
      src/main/resources/templates/encyclopedia/instrument-detail.html
  17. 1 0
      src/main/resources/templates/encyclopedia/product-detail.html
  18. 1 0
      src/main/resources/templates/flea-market/detail.html
  19. 1 0
      src/main/resources/templates/flea-market/form.html
  20. 1 0
      src/main/resources/templates/flea-market/list.html
  21. 1 0
      src/main/resources/templates/index.html
  22. 1 0
      src/main/resources/templates/product/detail.html
  23. 1 0
      src/main/resources/templates/product/instruelist.html
  24. 1 0
      src/main/resources/templates/product/list.html
  25. 1 0
      src/main/resources/templates/product/product-hot.html
  26. 1 0
      src/main/resources/templates/supplier/list.html

+ 3 - 0
src/main/resources/static/js/activity/attestation.js

@@ -1,6 +1,7 @@
 new Vue({
     data: {
         popupVisiable: false,
+        mixins: [cmSysVitaMixins],
         twoData: [
             {icon: '/img/activity/attestation/section_icon_1.png', text: '自主授权'},
             {icon: '/img/activity/attestation/section_icon_2.png', text: '自主认证'},
@@ -62,6 +63,8 @@ new Vue({
     },
     mounted() {
         // this.initSwiper1()
+        this.cmSysParams.pageType = '认证通';
+        this.cmSysParams.pageLabel = '认证通';
         this.initSwiper2()
     },
     methods: {

+ 0 - 1
src/main/resources/static/js/base.js

@@ -49,7 +49,6 @@ if(localStorage.getItem('userInfo')){
 // 头部
 var globalHead = new Vue({
     el: '#globalHead',
-    mixins: [cmSysVitaMixins],
     data: {
         loginStatus: false,
         userData: {},

+ 11 - 0
src/main/resources/static/js/common/serviceapi/user.service.js

@@ -463,4 +463,15 @@ var UserApi = {
                 callback(res);
             });
         },
+        userRecordStatistics: function (params, callback) {//上送统计用户浏览记录
+            Http.AjaxService({
+                url: '/user/record/Statistics',
+                type:'get',
+                data:params,
+                json:false,
+                isHost:true
+            }).then(function (res) {
+                callback(res);
+            });
+        },
 };

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

@@ -1,6 +1,7 @@
 var isPC = ($(window).width()>768);
 var fleaMarketForm = new Vue({
     el:'#fleaMarketForm',
+    mixins: [cmSysVitaMixins],
     data:{
         fenlei:[
             {name:'二手仪器',value:1},
@@ -482,17 +483,19 @@ var fleaMarketForm = new Vue({
     },
     mounted:function () {
         var _this = this;
+        this.cmSysParams.pageType = '发布二手';
+        this.cmSysParams.pageLabel = '发布二手';
         SecondApi.brandList({},function (res) {//品牌列表
             if(res.code == 0){
                _this.BrandList = res.data;
             }
         })
-     PublicApi.GetProvince({},function(response){ //省份
-            if(response.code == 0){
-                _this.provinceArray = response.data
-            }else{
-                CAIMEI.Alert(response.msg, '确定', false);
-            }
-        })
-    },
+         PublicApi.GetProvince({},function(response){ //省份
+                if(response.code == 0){
+                    _this.provinceArray = response.data
+                }else{
+                    CAIMEI.Alert(response.msg, '确定', false);
+                }
+            })
+        },
 })

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

@@ -1,6 +1,7 @@
 var isPC = ($(window).width()>768);
 var fleaMarketList = new Vue({
      el: "#fleaMarketList",
+     mixins: [cmSysVitaMixins],
      data:{
          currentId:1,
          currentID2:0,
@@ -156,7 +157,9 @@ var fleaMarketList = new Vue({
         }
      },
      mounted:function () {
-          var _this = this;
+        var _this = this;
+        this.cmSysParams.pageType = '二手市场';
+        this.cmSysParams.pageLabel = '二手市场';
           var userInfo = JSON.parse(localStorage.getItem('userInfo'));
           if(userInfo){
               _this.userId = userInfo.userId;

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

@@ -3,6 +3,7 @@
  */
 var fleaMarket = new Vue({
     el:"#fleaMarket",
+    mixins: [cmSysVitaMixins],
     data: {
         tabIndex:0,
         shopId:'',
@@ -38,6 +39,7 @@ var fleaMarket = new Vue({
                    _this.detail = res.data;
                    _this.previewThumb =  res.data.imageList;
                    _this.previewBigimage =res.data.imageList[0];
+                   _this.cmSysParams.pageLabel = `${res.data.brandName}`;
                    setTimeout(function(){  // 图片懒加载
                        $("img[data-original]").lazyload();
                    },500);
@@ -125,6 +127,7 @@ var fleaMarket = new Vue({
     },
     created: function () {
         this.id = $("#productId").val();
+        this.cmSysParams.pageType = '二手商品详情';
     },
     mounted: function () {
      var _self = this;

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

@@ -2,7 +2,7 @@
 // if(isFormal){var _czc = _czc || [];_czc.push(["_setAccount", "1279558759"]);}
 var homeData = new Vue({
     el: '#container',
-    mixins: [cmsMixins],
+    mixins: [cmsMixins,cmSysVitaMixins],
     data: {
         userId:0,
         asideNav: [],
@@ -360,6 +360,8 @@ var homeData = new Vue({
     },
     mounted: function() {
         var _this = this;
+        this.cmSysParams.pageType = '商城首页';
+        this.cmSysParams.pageLabel = '首页';
         // 页面主图轮播
         this.swiperBanner();
         // 获取设置商品价格

+ 19 - 8
src/main/resources/static/js/mixins/cmSysMixins.js

@@ -6,32 +6,43 @@ var cmSysVitaMixins = function () {
             return {
                 browseTime: 0,  // 浏览时长初始值为 0
                 clearTimeSet: null,
+                cmSysParams:{
+                    pagePath:'',//页面路径
+                    accessDuration:0,//停留时间
+                    pageType:'',//页面类型
+                    pageLabel:'',//页面标签
+                    userId:0,//用户Id
+                    productId:0//商品Id
+                }
             }
+
         },
         methods: {
             setTime() {
                 //设置定时器
                 let _self = this;
+                if(GLOBAL_TOKEN){ this.cmSysParams.userId = GLOBAL_USER_ID; }
+                this.cmSysParams.pagePath = window.location.href;
                 this.clearTimeSet = setInterval(() => {
-                    _self.browseTime++;
-                    console.log(_self.browseTime, "时长累计");
+                    _self.cmSysParams.accessDuration++;
+                    console.log(`页面路径:${_self.cmSysParams.pagePath}`,`停留:${_self.cmSysParams.accessDuration}s`,`标签:${_self.cmSysParams.pageLabel}`)
                 }, 1000);
             },
-            cmSysVitas() {
+            userRecordStatistics(params) {
                 var _this = this;
-                UserApi.cmSysVitas({},function (response) {
+                UserApi.userRecordStatistics(params,function (response) {
                     if(response.code === 0){
-                        _this.bankInfo = response.data;
+                        console.log('<-------上送用户行为记录成功------>')
                     }else{
                         console.log('<-------上送用户行为记录异常------>')
                     }
                 })
             },
             beforeunloadHandler(e) {
-                console.log('关闭窗口之后')
-                debugger
+                console.log('关闭窗口之后',this.cmSysParams)
                 clearInterval(this.clearTimeSet); // 离开页面后清除定时器
-                this.cmSysVitas(); // 上送后台接口,将浏览时长等信息传到后台,离开当前路由后调用
+                this.userRecordStatistics(this.cmSysParams); // 上送后台接口,将浏览时长等信息传到后台,离开当前路由后调用
+                debugger
             }
         },
         mounted() {

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

@@ -1,6 +1,6 @@
 var productDetail = new Vue({
     el: "#productDetail",
-    mixins: [beautyArchiveDetailMixin],
+    mixins: [beautyArchiveDetailMixin,cmSysVitaMixins],
     data: {
         showProduct: false,
         productId: 0,
@@ -183,6 +183,7 @@ var productDetail = new Vue({
                     _self.recommendType = product.recommendType ? product.recommendType : 0;
                     _self.archiveId = product.archiveId; // 保存资料列表id
                     _self.productDetailChose = product.productDetailChose; // 同资质机构显示商品详情
+                    _self.cmSysParams.pageLabel = `${product.smallTypeName}${product.brandName?product.brandName:''}`;//设置统计数据标签
                     if(product.shopType == 2){
                         _self.isShowCaimeiShop = true
                     }
@@ -817,6 +818,8 @@ var productDetail = new Vue({
     },
     created: function () {
         this.productId = this.couponParam.productId = this.listQuery.productId = $("#productId").val();
+        this.cmSysParams.pageType = '新商品详情';
+        this.cmSysParams.productId = this.productId;
         this.typeId = $("#typeId").val();
         console.log('typeId', this.typeId)
         this.userId = this.couponParam.userId = this.listQuery.userId = GLOBAL_USER_ID;

+ 3 - 0
src/main/resources/static/js/product/list.js

@@ -1,5 +1,6 @@
 var productList = new Vue({
     el: "#productList",
+    mixins: [cmSysVitaMixins],
     data: {
         // searchFlag: false,
         listLoading: true,
@@ -320,6 +321,8 @@ var productList = new Vue({
             this.params.num = 1;
         }
         this.params.keyword = this.brandParam.keyword = getUrlParam("keyword") ? getUrlParam("keyword") : "";
+        this.cmSysParams.pageType = '商品搜索';
+        this.cmSysParams.pageLabel = this.params.keyword;
         // 搜索框赋值
         $('#topSearch').find('[data-select]').attr("data-select", 0).text("产品");
         $('#topSearch').find('.jqSelect').find('select').val(0);

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

@@ -1,5 +1,6 @@
 var productList = new Vue({
     el:'#productList',
+    mixins: [cmSysVitaMixins],
     data:{
         userId:0,
         listLoading: true,
@@ -337,6 +338,11 @@ var productList = new Vue({
                 this.choiceBrandText = names.join(',').slice(0,15)
             }
         },500)
+        //设置数据统计
+        this.$nextTick(function(){
+            _self.cmSysParams.pageType = '分类列表';//设置数据统计
+            _self.cmSysParams.pageLabel = $('.crumbs-nav-item.on').text();//设置数据统计
+        })
         if(!isPC){
             $('footer').addClass("noneImportant");
             //移动端上垃加载更多

+ 3 - 0
src/main/resources/static/js/product/product-hot.js

@@ -1,5 +1,6 @@
 var productList = new Vue({
     el: "#productList",
+    mixins: [cmSysVitaMixins],
     data: {
         // searchFlag: false,
         isRequest:false,
@@ -261,6 +262,8 @@ var productList = new Vue({
     created: function () {
         var _self = this
         // this.searchFlag = (this.params.keyword !== "");
+        this.cmSysParams.pageType = '新品橱窗';
+        this.cmSysParams.pageLabel = '新品';
         if(globalUserData){
             this.userId = 	this.listQuery.userId = globalUserData.userId;
             this.userIdentity = globalUserData.identity;

+ 3 - 0
src/main/resources/static/js/supplier/list.js

@@ -1,5 +1,6 @@
 var supplierList = new Vue({
     el: "#supplierList",
+    mixins: [cmSysVitaMixins],
     data: {
         searchFlag: false,
         listLoading: true,
@@ -94,6 +95,8 @@ var supplierList = new Vue({
             this.params.num = 1;
         }
         this.params.keyword = getUrlParam("keyword") ? getUrlParam("keyword") : "";
+        this.cmSysParams.pageType = '供应商搜索';
+        this.cmSysParams.pageLabel = this.params.keyword;
         // 搜索框赋值
         $('#topSearch').find('[data-select]').attr("data-select", 1).text("供应商");
         $('#topSearch').find('.jqSelect').find('select').val(1);

+ 1 - 0
src/main/resources/templates/activity/attestation.html

@@ -314,6 +314,7 @@
         th:src="@{/js/common/serviceapi/product.service.js(v=${version})}"></script>
 <script charset="utf-8" type="text/javascript"
         th:src="@{/js/common/serviceapi/shopping.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/activity/attestation.js(v=${version})}"></script>
 </body>
 </html>

+ 0 - 1
src/main/resources/templates/components/foot-link.html

@@ -8,6 +8,5 @@
 <script charset="utf-8" type="text/javascript" th:src="@{/js/common/ajax.service.js(v=${version})}"></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/common/serviceapi/shopping.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/utils.js(v=${version})}"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/base.js(v=${version})}"></script>

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

@@ -322,6 +322,7 @@
 <!-- 引用公共底部 -->
 <template th:replace="encyclopedia/components/footer"></template>
 <script charset="utf-8" type="text/javascript" src="/lib/viewer.min.js"></script>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/mixins/cmSysMixins.js(v=${version})}"></script>
 <script th:src="@{/js/encyclopedia/detail.js(v=${version})}"></script>
 </body>
 </html>

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

@@ -308,6 +308,7 @@
 <!-- 引用公共底部 -->
 <template th:replace="encyclopedia/components/footer"></template>
 <script charset="utf-8" type="text/javascript" src="/lib/viewer.min.js"></script>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/mixins/cmSysMixins.js(v=${version})}"></script>
 <script th:src="@{/js/encyclopedia/detail.js(v=${version})}"></script>
 </body>
 </html>

+ 1 - 0
src/main/resources/templates/flea-market/detail.html

@@ -185,6 +185,7 @@
 <template th:replace="components/foot-link"></template>
 <script charset="utf-8" type="text/javascript" src="/lib/magnifier.js"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/second.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/flea-market/secondDetail.js(v=${version})}"></script>
 </body>
 </html>

+ 1 - 0
src/main/resources/templates/flea-market/form.html

@@ -222,6 +222,7 @@
 <script charset="utf-8" type="text/javascript"
         th:src="@{/js/common/serviceapi/second.service.js(v=${version})}"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/user.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/flea-market/form.js(v=${version})}"></script>
 </body>
 </html>

+ 1 - 0
src/main/resources/templates/flea-market/list.html

@@ -144,6 +144,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/second.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/flea-market/list.js(v=${version})}"></script>
 </body>
 </html>

+ 1 - 0
src/main/resources/templates/index.html

@@ -582,6 +582,7 @@
 <template th:replace="components/foot-link"></template>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/product.service.js(v=${version})}"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/mixins/cmsMixins.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/index.js(v=${version})}"></script>
 </body>
 </html>

+ 1 - 0
src/main/resources/templates/product/detail.html

@@ -772,6 +772,7 @@
 <script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/shopping.service.js(v=${version})}"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/beautyArchive.service.js(v=${version})}"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/document/beautyArchiveDetailMixin.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/product/detail.js(v=${version})}"></script>
 </body>
 </html>

+ 1 - 0
src/main/resources/templates/product/instruelist.html

@@ -287,6 +287,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/product.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/product/produce-list.js(v=${version})}"></script>
 </body>
 </html>

+ 1 - 0
src/main/resources/templates/product/list.html

@@ -237,6 +237,7 @@
 <template th:replace="components/foot-link"></template>
 <script charset="utf-8" type="text/javascript"
         th:src="@{/js/common/serviceapi/product.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/product/list.js(v=${version})}"></script>
 </body>
 </html>

+ 1 - 0
src/main/resources/templates/product/product-hot.html

@@ -205,6 +205,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/product.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/product/product-hot.js(v=${version})}"></script>
 </body>
 </html>

+ 1 - 0
src/main/resources/templates/supplier/list.html

@@ -79,6 +79,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/supplier.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/supplier/list.js(v=${version})}"></script>
 </body>
 </html>