소스 검색

统计收集

zhengjinyi 2 년 전
부모
커밋
2300e66334

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

@@ -4,13 +4,13 @@ spring:
   #数据源连接--start
   datasource:
     #本地连接数据库
-    url: jdbc:mysql://192.168.2.100:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
-    username: developer
-    password: 05bZ/OxTB:X+yd%1
-    #测试连接数据库
-#    url: jdbc:mysql://120.79.25.27:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+#    url: jdbc:mysql://192.168.2.100:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
 #    username: developer
-#    password: J5p3tgOVazNl4ydf
+#    password: 05bZ/OxTB:X+yd%1
+    #测试连接数据库
+    url: jdbc:mysql://120.79.25.27:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+    username: developer
+    password: J5p3tgOVazNl4ydf
     #type: com.zaxxer.hikari.HikariDataSource
     hikari:
       minimum-idle: 5

+ 16 - 0
src/main/resources/static/js/common/serviceapi/product.service.js

@@ -486,4 +486,20 @@ var ProductApi = {
                     callback(res);
                 });
         },
+        /**
+         * @数据统计
+         * @param:typeId 1:首页banner;2:直播模块;3:最新活动;4:热门文章;5:新品橱窗;6:活动列表
+         */
+        getCommodityStatisticsType:function (params, callback) {//获取商品收藏列表
+            Http.AjaxService({
+                url:'/commodity/StatisticsType/statisticsNumber',
+                type:'get',
+                data:params,
+                json:true,
+                isHost:true
+            })
+                .then(function(res){
+                    callback(res);
+                });
+        },
 };

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

@@ -2,6 +2,7 @@
 // if(isFormal){var _czc = _czc || [];_czc.push(["_setAccount", "1279558759"]);}
 var homeData = new Vue({
     el: '#container',
+    mixins: [cmsMixins],
     data: {
         userId:0,
         asideNav: [],

+ 55 - 0
src/main/resources/static/js/mixins/cmsMixins.js

@@ -0,0 +1,55 @@
+// 统计数据
+// 统计类型 1:首页banner;2:直播模块;3:最新活动;4:热门文章;5:新品橱窗;6:活动列表
+var cmsMixins = function () {
+    return {
+        mounted: function() {
+            window.handleBannerStatistics = this.handleBannerStatistics;
+            window.handleRightStatistics = this.handleRightStatistics;
+            window.handleHotStatistics = this.handleHotStatistics;
+        },
+        methods: {
+            handleBannerStatistics:function($event){// banner点击统计
+                const $eventHref  = $event[0].attributes[2].value;
+                console.log('首页轮播',$eventHref)
+                this.cmsSysStatistics(1)
+                window.open($eventHref)
+            },
+            handleRightStatistics:function($event,type){// banner点击统计
+                const $eventHref  = $event[0].attributes[3].value;
+                console.log('右侧模块',$eventHref)
+                this.cmsSysStatistics(type)
+                window.open($eventHref)
+            },
+            handleHotStatistics:function($event,type){// banner点击统计
+                const $eventHref  = $event[0].attributes[2].value;
+                console.log('新品橱窗',$eventHref)
+                this.cmsSysStatistics(5)
+                window.open($eventHref)
+            },
+            handleActivityStatistics:function($eventHref){// banner点击统计
+                this.cmsSysStatistics(6)
+                console.log('活动列表',$eventHref)
+                window.open($eventHref)
+            },
+            cmsSysStatistics :function (cmsSysType) {
+                ProductApi.getCommodityStatisticsType({typeId:cmsSysType},function (response) {
+                    if(response.code === 0){
+                        const map = {
+                            1: '首页轮播',
+                            2: '直播模块',
+                            3: '最新活动',
+                            4: '热门文章',
+                            5: '新品橱窗',
+                            6: '活动列表'
+                        }
+                        const sYsText = map[cmsSysType]
+                        console.log(`<-------${sYsText}统计数据成功------>`)
+                    }else{
+                        console.log('<-------统计数据异常------>')
+                    }
+                })
+            }
+        }
+    }
+}();
+

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

@@ -4,6 +4,7 @@ var productDetail = new Vue({
     data: {
         showProduct: false,
         productId: 0,
+        typeId:0,
         userId: 0,
         identity:0,
         number: 0,
@@ -172,7 +173,7 @@ var productDetail = new Vue({
         // },
         getProductDetails: function () {
             var _self = this;
-            ProductApi.GetProductDdtails({userId: GLOBAL_USER_ID, productId: _self.productId}, function (response) {
+            ProductApi.GetProductDdtails({userId: GLOBAL_USER_ID, productId: _self.productId,typeId:_self.typeId}, function (response) {
                 if (response.code == 0) {
                     var product = response.data;
                     _self.product = response.data;
@@ -802,6 +803,8 @@ var productDetail = new Vue({
     },
     created: function () {
         this.productId = this.couponParam.productId = this.listQuery.productId = $("#productId").val();
+        this.typeId = $("#typeId").val();
+        console.log('typeId', this.typeId)
         this.userId = this.couponParam.userId = this.listQuery.userId = GLOBAL_USER_ID;
         this.productStock = $("#productStock").val();
         // this.getImages();

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

@@ -1,5 +1,6 @@
 var promotionsList = new Vue({
     el: "#promotionsList",
+    mixins: [cmsMixins],
     data: {
         searchFlag: false,
         listLoading: true,

+ 13 - 11
src/main/resources/templates/index.html

@@ -23,7 +23,7 @@
     <div id="swiper-container" class="swiper-container">
         <ul class="swiper-wrapper swiper-wrapper-banner">
             <li class="swiper-slide mfc" th:each="img: ${bannerList}">
-                <a th:href="${img.link}"><img th:src="${img.image}" th:alt="${img.title}"></a>
+                <a href="javascript:void(0)" th:attr="data-href=${img.link}" onclick="handleBannerStatistics($(this))"><img th:src="${img.image}" th:alt="${img.title}"></a>
             </li>
         </ul>
         <div class="swiper-pagination swiper-pagination-banner mfc"><span v-if="isPC" th:each="img: ${bannerList}"></span></div>
@@ -62,7 +62,7 @@
                             </a>
                         </div>
                         <div class="right_item_main" th:each="live,stat : ${sideJson.get('liveList')}" th:object="${live}">
-                            <a th:if="${stat.index}==0" th:href="*{link}" th:title="*{liveTitle}" class="item_banner" target="_blank" rel="nofollow" onclick="_czc.push(['_trackEvent','商城首页','精彩直播','点击','','Um_Event_HomeLiveTemplateClick'])">
+                            <a th:if="${stat.index}==0" th:attr="data-href=*{link}" href="javascript:void(0)" onclick="handleRightStatistics($(this),2)" th:title="*{liveTitle}" class="item_banner">
                                 <img src="/img/base/placeholder.png" th:attr="data-original=*{homePageImage}" th:alt="*{liveTitle}">
                                 <div class="name" th:text="*{liveTitle}"></div>
                                 <div class="statu">
@@ -71,7 +71,7 @@
                                     <template th:if="*{liveStatus}==3"><i class="mIcon icon-end"></i><p>看回放</p></template>
                                 </div>
                             </a>
-                            <a th:if="${stat.index}>0" th:href="*{link}" th:title="*{liveTitle}" class="item_text" target="_blank" rel="nofollow" onclick="_czc.push(['_trackEvent','商城首页','精彩直播','点击','','Um_Event_HomeLiveTemplateClick'])">
+                            <a th:if="${stat.index}>0" th:attr="data-href=*{link}" href="javascript:void(0)" onclick="handleRightStatistics($(this),2)" th:title="*{liveTitle}" class="item_text">
                                 <p class="item_text_name" th:text="*{liveTitle}"></p>
                             </a>
                         </div>
@@ -84,11 +84,11 @@
                             </a>
                         </div>
                         <div class="right_item_main" th:each="image,stat : ${sideJson.get('cmImageList')}" th:object="${image}">
-                            <a th:if="${stat.index}==0" th:href="*{link}" th:title="*{title}" class="item_banner" target="_blank" onclick="_czc.push(['_trackEvent','商城首页','最新活动','点击','','Um_Event_HomeActivityTemplateClick'])">
+                            <a th:if="${stat.index}==0" th:attr="data-href=*{link}" onclick="handleRightStatistics($(this),3)" href="javascript:void(0)" th:title="*{title}" class="item_banner">
                                 <img src="/img/base/placeholder.png" th:attr="data-original=*{homePageImage}" th:alt="*{title}">
                                 <div class="name" th:text="*{title}"></div>
                             </a>
-                            <a th:if="${stat.index}>0" th:href="*{link}" th:title="*{title}" class="item_text" target="_blank" onclick="_czc.push(['_trackEvent','商城首页','最新活动','点击','','Um_Event_HomeActivityTemplateClick'])">
+                            <a th:if="${stat.index}>0" th:attr="data-href=*{link}" onclick="handleRightStatistics($(this),3)" href="javascript:void(0)"  th:title="*{title}" class="item_text">
                                 <p class="item_text_name" th:text="*{title}"></p>
                             </a>
                         </div>
@@ -101,11 +101,11 @@
                             </a>
                         </div>
                         <div class="right_item_main" th:each="info,stat : ${sideJson.get('infoList')}" th:object="${info}">
-                            <a th:if="${stat.index}==0" th:href="*{link}" th:title="*{title}" class="item_banner" target="_blank" onclick="_czc.push(['_trackEvent','商城首页','热门文章','点击','','Um_Event_HomeArticleTemplateClick'])">
+                            <a th:if="${stat.index}==0" th:attr="data-href=*{link}" onclick="handleRightStatistics($(this),4)" href="javascript:void(0)"  th:title="*{title}" class="item_banner">
                                 <img src="/img/base/placeholder.png" th:attr="data-original=*{homePageImage}" th:alt="*{title}">
                                 <div class="name" th:text="*{title}"></div>
                             </a>
-                            <a th:if="${stat.index}>0" th:href="*{link}" th:title="*{title}" class="item_text" target="_blank" onclick="_czc.push(['_trackEvent','商城首页','热门文章','点击','','Um_Event_HomeArticleTemplateClick'])">
+                            <a th:if="${stat.index}>0" th:attr="data-href=*{link}" onclick="handleRightStatistics($(this),4)" href="javascript:void(0)"  th:title="*{title}" class="item_text">
                                 <p class="item_text_name info" th:text="*{title}"></p>
                                 <p class="item_text_time" v-if="isPC" th:text="*{createDate}"></p>
                             </a>
@@ -119,11 +119,11 @@
                             </a>
                         </div>
                         <div class="right_item_main" th:each="info,stat : ${sideJson.get('baikeList')}" th:object="${info}">
-                            <a th:if="${stat.index}==0" th:href="*{link}" th:title="*{name}" class="item_banner" target="_blank" onclick="_czc.push(['_trackEvent','商城首页','热门百科','点击','','Um_Event_HomeBaikeTemplateClick'])">
+                            <a th:if="${stat.index}==0"  th:href="*{link}"  th:title="*{name}" class="item_banner">
                                 <img src="/img/base/placeholder.png" th:attr="data-original=*{image}" th:alt="*{name}">
                                 <div class="name" th:text="*{name}"></div>
                             </a>
-                            <a th:if="${stat.index}>0" th:href="*{link}" th:title="*{name}" class="item_text" target="_blank" onclick="_czc.push(['_trackEvent','商城首页','热门百科','点击','','Um_Event_HomeBaikeTemplateClick'])">
+                            <a th:if="${stat.index}>0" th:href="*{link}"  th:title="*{name}" class="item_text">
                                 <p class="item_text_name info" th:text="*{name}"></p>
                                 <!-- <p class="item_text_time" v-if="isPC" th:text="*{createDate}"></p> -->
                             </a>
@@ -143,7 +143,7 @@
                         <div class="swiper-container-floor hotList mySwiper" id="recommendBox">
                             <div class="swiper-wrapper section_page_main type_08  recommendBox-wrapperHot clear mfw section_8 max">
                                 <!-- 商品/图片 列表 -->
-                                <a :href="'/product-'+pros.product.productId+'.html'" class="swiper-slide page_main_item hot ad_04" target="_blank" v-for="pros in floor.floorImageList4">
+                                <a href="javascript:void(0)" :data-href="pros.link"  onclick="handleHotStatistics($(this))" class="swiper-slide page_main_item hot ad_04" v-for="pros in floor.floorImageList4">
                                     <img class="page_main_image" src="/img/base/placeholder.png" :data-original="pros.product.image" :alt="pros.product && pros.product.name">
                                     <div class="page_main_type" v-if="pros.product && pros.product.productType === 2">医疗器械</div>
                                     <div class="page_main_text">
@@ -391,7 +391,7 @@
                             <div class="section_page_main type_08 swiper-wrapper  recommendBox-wrapperHot clear mfw section_8">
                                 <!-- 商品/图片 列表 -->
                                 <th:block th:each="pros : ${floor.get('floorImageList4')}"  th:object="${pros}">
-                                    <a th:href="*{link}" class="swiper-slide page_main_item hot ad_04" target="_blank">
+                                    <a href="javascript:void(0)"  th:attr="data-href=*{link}" onclick="handleHotStatistics($(this))" class="swiper-slide page_main_item hot ad_04">
                                         <th:block th:if="${pros.get('product')}!=null" th:object="${pros.get('product')}">
                                             <img class="page_main_image" src="/img/base/placeholder.png" th:attr="data-original=*{image}" th:alt="*{name}">
                                         </th:block>
@@ -580,6 +580,8 @@
 <!-- 引入底部 -->
 <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/cmsMixins.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

@@ -19,6 +19,7 @@
 <!-- 商品详情 -->
 <div id="productDetail" v-show="showProduct" v-cloak>
     <input type="hidden" th:value="${productId}" id="productId">
+    <input type="hidden" th:value="${typeId}" id="typeId">
     <input type="hidden" th:value="${product?.stock}" id="productStock">
     <input type="hidden" th:value="${product?.visibility}" id="productVisibility">
     <div class="wrap">

+ 11 - 7
src/main/resources/templates/single-page/promotions.html

@@ -14,13 +14,15 @@
 <!-- 二级页面 -->
 <div id="promotionsList">
     <ul class="wrap">
-        <li class="promotions" v-for="item in listData"><a :href="item.link" :class="item.status==3?'noclick':''" >
-            <img :src="item.image">
-            <p v-text="item.title"></p>
-            <span v-if="item.status==1" class="time" v-text="''+item.detail">活动时间:活动即将开始</span>
-            <span v-if="item.status==2" class="time" v-text="'活动时间:'+item.detail"></span>
-            <span v-if="item.status==3" class="finish"></span>
-        </a></li>
+        <li class="promotions" v-for="item in listData" @click="handleActivityStatistics(item.link)">
+            <a href="javascript:void(0)" :class="item.status==3?'noclick':''" >
+                <img :src="item.image">
+                <p v-text="item.title"></p>
+                <span v-if="item.status==1" class="time" v-text="''+item.detail">活动时间:活动即将开始</span>
+                <span v-if="item.status==2" class="time" v-text="'活动时间:'+item.detail"></span>
+                <span v-if="item.status==3" class="finish"></span>
+            </a>
+        </li>
     </ul>
     <!--分页-->
     <div v-if="(!isPC) && noMore" class="noMore">---- 没有更多了 ----</div>
@@ -43,6 +45,8 @@
 <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/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/single-page/promotions.js(v=${version})}"></script>
 </body>
 </html>