Sfoglia il codice sorgente

updated:搜索词统计

xiebaomin 1 anno fa
parent
commit
d514c64e1a

+ 1 - 1
src/main/resources/static/css/article/article.css

@@ -341,7 +341,7 @@ dl,dd,dt{zoom:1}
 	.article-right-ross.none{display: none;}
 	.article-right-ross.show{display: block;}
 	.article-right-ross a{width: 100%;height: 100%;display: block;border-radius: 2px;}
-	.article-right-ross a img{width: 100%;height: 100%;display: block;border-radius: 2px;}
+	.article-right-ross a img{width: 100%;height: 100%;display: block;border-radius: 2px;cursor: pointer}
 
 	/*ross宣传弹窗*/
 	.ross-banner-fiexd{width: 100%;height: 260px;position: fixed;z-index: 999;background: linear-gradient(90deg, #FF5B00, #FFA86E);left: 0;right: 0;bottom: -260px;box-sizing: border-box;opacity: 0;}

+ 1 - 1
src/main/resources/static/css/index/index_new.pc.css

@@ -167,7 +167,7 @@ li{list-style:none;}
 /*右边区域*/
 .section_right{width:284px;float:right;box-sizing:border-box;padding-top:40px}
 .section_right .section_right_item{width:284px;height:auto;background-color:#FFFFFF;float:left;margin-bottom:16px;padding:16px;box-sizing:border-box;border-radius:2px}
-.section_right .section_right_item.ross{width:284px;height:343px;color: #FFFFFF;padding:0;}
+.section_right .section_right_item.ross{width:284px;height:343px;color: #FFFFFF;padding:0;cursor: pointer}
 .section_right .section_right_item.ross.none{display: none;}
 .section_right .section_right_item.ross.show{display: block;}
 .section_right .section_right_item.ross>a{width: 100%;height: 100%;display: block;border-radius: 2px;}

+ 9 - 0
src/main/resources/static/js/article/list.js

@@ -399,6 +399,15 @@ const articleList = new Vue({
                     this.newsList = data.annlist.slice(0, 1)
                 }
             });
+        },
+        // 供应商广告图统计
+        setAdvStatistics ($event) {
+            BeautyArchiveApi.GetStatisticsAddPv({type: 5, authorId: $event.id}, () => {
+                console.log("供应商广告图点击统计成功")
+            })
+            if ($event.jumpLink) {
+                window.open($event.jumpLink)
+            }
         }
     }
 });

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

@@ -547,12 +547,24 @@ $(function(){
             // 文章
             window.location.href = '/info/search-1.html?keyword=' + encodeURIComponent(keyword);
         }
+        // 搜索词统计
+        BeautyArchiveApi.setSearchKeywords({keyword}, (res) => {
+            if (res.code === 0) {
+                console.log('搜索词统计成功')
+            }
+        })
     }).on('keyup', '.keyword', function (event) {
         // 搜索输入框 按回车键搜索
         var keyCode = event.keyCode || event.which;
         if (keyCode === 13) {
             $(this).parents('#topSearch').find('.searchBtn').trigger("click");
         }
+        // 搜索词统计
+        BeautyArchiveApi.setSearchKeywords({keyword}, (res) => {
+            if (res.code === 0) {
+                console.log('搜索词统计成功')
+            }
+        })
     }).on("click", '.hotKey .word', function () {
         // 点击热词 触发搜索
         $(this).parents('#topSearch').find('.keyword').val($(this).text());

+ 58 - 47
src/main/resources/static/js/common/serviceapi/beautyArchive.service.js

@@ -1,47 +1,58 @@
-// 美业资料库列表
-var BeautyArchiveApi = {
-    //获取资料库商品列表
-    GetArchiveProduct: function (params, callback) {
-        Http.AjaxService({
-            url: '/commodity/product/archive',
-            type: 'GET',
-            data: params,
-            json: false,
-        }).then(function (res) {
-            callback(res);
-        });
-    },
-    //资料库获取详情
-    GetProdcutArchiveDetails: function (params, callback) {
-        Http.AjaxService({
-            url: '/commodity/product/archive/detail',
-            type: 'GET',
-            data: params,
-            json: false,
-        }).then(function (res) {
-            callback(res);
-        });
-    },
-    //采美豆抵扣
-    SearchArchiveByBeans: function (params, callback) {
-        Http.AjaxService({
-            url: '/user/club/archive/deduction',
-            type: 'POST',
-            data: params,
-            json: false,
-        }).then(function (res) {
-            callback(res);
-        });
-    },
-    //用户浏览资料记录
-    GetStatisticsAddPv: function (params, callback) {
-        Http.AjaxService({
-            url: '/commodity/statistics/addPv',
-            type: 'GET',
-            data: params,
-            json: false,
-        }).then(function (res) {
-            callback(res);
-        });
-    }
-};
+// 美业资料库列表
+var BeautyArchiveApi = {
+    //获取资料库商品列表
+    GetArchiveProduct: function (params, callback) {
+        Http.AjaxService({
+            url: '/commodity/product/archive',
+            type: 'GET',
+            data: params,
+            json: false,
+        }).then(function (res) {
+            callback(res);
+        });
+    },
+    //资料库获取详情
+    GetProdcutArchiveDetails: function (params, callback) {
+        Http.AjaxService({
+            url: '/commodity/product/archive/detail',
+            type: 'GET',
+            data: params,
+            json: false,
+        }).then(function (res) {
+            callback(res);
+        });
+    },
+    //采美豆抵扣
+    SearchArchiveByBeans: function (params, callback) {
+        Http.AjaxService({
+            url: '/user/club/archive/deduction',
+            type: 'POST',
+            data: params,
+            json: false,
+        }).then(function (res) {
+            callback(res);
+        });
+    },
+    //用户浏览资料记录
+    GetStatisticsAddPv: function (params, callback) {
+        Http.AjaxService({
+            url: '/commodity/statistics/addPv',
+            type: 'GET',
+            data: params,
+            json: false,
+        }).then(function (res) {
+            callback(res);
+        });
+    },
+    // 用户搜索词统计
+    setSearchKeywords: function (params, callback) {
+        Http.AjaxService({
+            url: '/commodity/search/query/con/keyword',
+            type: 'GET',
+            data: params,
+            json: false,
+        }).then(function (res) {
+            callback(res);
+        })
+    }
+};

+ 66 - 60
src/main/resources/static/js/encyclopedia/search.js

@@ -1,60 +1,66 @@
-const searchList = new Vue({
-    el: '#searchList',
-    data: {
-        listQuery: {
-            shopId: '',
-            id: '', //词条id,
-            name: '', //词条名称
-            typeId: '', //分类id
-            auditStatus: 2, //百科审核状态:1待审核,2审核通过,3审核失败
-            onlineStatus: 2, //百科上线状态:1待上线,2已上线,3已下线
-            status: '', //状态:0保存草稿箱,1已发布
-            pageNum: 1, //页数
-            pageSize: 10 //条数
-        },
-        totalPage: 0,
-        totalRecord: 0,
-        hasNextPage: false,
-        list: [],
-    },
-    created() {
-        this.listQuery.name = decodeURIComponent(CAIMEI.getUrlParam('keyword'))
-        this.$nextTick(() => {
-            $('#searchInput').val(this.listQuery.name)
-        })
-        this.getList()
-    },
-    mounted() {
-        const self = this
-        window.addEventListener('scroll', debounce(function () {
-            const scrollTop = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset
-            if (document.body.scrollHeight <= window.screen.height + scrollTop) {
-                console.log('已经滚动到底部了')
-                if (!self.hasNextPage) return
-                self.getList()
-            }
-        }))
-    },
-    methods: {
-        filterList() {
-            this.listQuery.pageNum = 1
-            this.getList()
-        },
-        getList() {
-            const self = this
-            if (this.listQuery.pageNum > this.totalPage) {
-                this.listQuery.pageNum = this.totalPage
-            }
-            if (this.listQuery.pageNum < 1) {
-                this.listQuery.pageNum = 1
-            }
-            shopBikeApi.FetchEntryList(this.listQuery, function (res) {
-                self.list = [...self.list, ...res.data.results]
-                self.totalPage = res.data.totalPage
-                self.hasNextPage = res.data.hasNextPage
-                self.totalRecord = res.data.totalRecord
-                self.listQuery.pageNum++
-            })
-        }
-    }
-})
+const searchList = new Vue({
+    el: '#searchList',
+    data: {
+        listQuery: {
+            shopId: '',
+            id: '', //词条id,
+            name: '', //词条名称
+            typeId: '', //分类id
+            auditStatus: 2, //百科审核状态:1待审核,2审核通过,3审核失败
+            onlineStatus: 2, //百科上线状态:1待上线,2已上线,3已下线
+            status: '', //状态:0保存草稿箱,1已发布
+            pageNum: 1, //页数
+            pageSize: 10 //条数
+        },
+        totalPage: 0,
+        totalRecord: 0,
+        hasNextPage: false,
+        list: [],
+    },
+    created() {
+        this.listQuery.name = decodeURIComponent(CAIMEI.getUrlParam('keyword'))
+        this.$nextTick(() => {
+            $('#searchInput').val(this.listQuery.name)
+            // 搜索词统计
+            BeautyArchiveApi.setSearchKeywords({keyword: this.listQuery.name}, (res) => {
+                if (res.code === 0) {
+                    console.log('搜索词统计成功')
+                }
+            })
+        })
+        this.getList()
+    },
+    mounted() {
+        const self = this
+        window.addEventListener('scroll', debounce(function () {
+            const scrollTop = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset
+            if (document.body.scrollHeight <= window.screen.height + scrollTop) {
+                console.log('已经滚动到底部了')
+                if (!self.hasNextPage) return
+                self.getList()
+            }
+        }))
+    },
+    methods: {
+        filterList() {
+            this.listQuery.pageNum = 1
+            this.getList()
+        },
+        getList() {
+            const self = this
+            if (this.listQuery.pageNum > this.totalPage) {
+                this.listQuery.pageNum = this.totalPage
+            }
+            if (this.listQuery.pageNum < 1) {
+                this.listQuery.pageNum = 1
+            }
+            shopBikeApi.FetchEntryList(this.listQuery, function (res) {
+                self.list = [...self.list, ...res.data.results]
+                self.totalPage = res.data.totalPage
+                self.hasNextPage = res.data.hasNextPage
+                self.totalRecord = res.data.totalRecord
+                self.listQuery.pageNum++
+            })
+        }
+    }
+})

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

@@ -387,7 +387,15 @@ var homeData = new Vue({
                 console.log("浏览记录成功")
             })
         },
-
+        // 供应商广告图统计
+        setAdvStatistics ($event) {
+            BeautyArchiveApi.GetStatisticsAddPv({type: 5, authorId: $event.id}, () => {
+                console.log("供应商广告图点击统计成功")
+            })
+            if ($event.jumpLink) {
+                window.open($event.jumpLink)
+            }
+        }
     },
     created: function() {
         if(GLOBAL_TOKEN){

+ 12 - 1
src/main/resources/static/js/mixins/cmsMixins.js

@@ -27,7 +27,8 @@ var cmsMixins = function () {
             },
             handleActivityStatistics:function($eventHref){// 活动列表
                 this.cmsSysStatistics(6)
-                window.open($eventHref)
+                this.cmsSetActivityStatistics($eventHref)
+                window.open($eventHref.link)
             },
             cmsSysStatistics :function (cmsSysType,bannerId) {
                 ProductApi.getCommodityStatisticsType({typeId:cmsSysType,bannerId:bannerId},function (response) {
@@ -46,6 +47,16 @@ var cmsMixins = function () {
                         console.log('<-------统计数据异常------>')
                     }
                 })
+            },
+            // 活动专区首页点击量统计
+            cmsSetActivityStatistics($eventHref) {
+                BeautyArchiveApi.GetStatisticsAddPv({type: 3, authorId: $eventHref.id}, (response) => {
+                    if(response.code === 0){
+                        console.log(`<-------活动专区首页点击量统计数据成功------>`)
+                    } else {
+                        console.log('<-------统计数据异常------>')
+                    }
+                })
             }
         }
     }

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

@@ -252,7 +252,7 @@
     <div v-if="isPC && shopAdvert.length > 0 " class="article-right-ross article-PC" :class="shopAdvert.length > 0 ? 'show' : 'none'" id="advertisement" v-cloak>
         <el-carousel :autoplay="true" show-indicators="false" :height="isPC ? '343px' : '61.6vw'">
             <el-carousel-item v-for="(item, index) in shopAdvert" :key="item.id">
-                <a :href="item.jumpLink" target="_blank">
+                <a @click="setAdvStatistics(item)">
                     <img :src="item.pcImage" alt="">
                 </a>
             </el-carousel-item>
@@ -279,5 +279,6 @@
 <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/article/mixins/searchMixins.js(v=${version})}"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/article/list.js(v=${version})}"></script>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/beautyArchive.service.js(v=${version})}"></script>
 </body>
 </html>

+ 26 - 25
src/main/resources/templates/encyclopedia/components/footer.html

@@ -1,25 +1,26 @@
-<footer>
-    <div class="bk-footer">
-        <h2><span>友情链接:</span><a href="https://www.caimei365.com/" target="_blank">采美商城</a></h2>
-        <p class="beian"><i></i><span>粤B1-20160129</span><span>备案号</span><a href="http://www.acebelleshenzhen.com/">粤ICP备14019824号</a><br
-                class="only-mobile"><span>互联网药品信息服务资格证编号(粤)-非经营性-2021-0339</span><br
-                class="only-mobile"><span>中华人民共和国增值电信业务经营许可证</span>
-        </p>
-        <p class="copyright">Copyright © 2015-2022 CAIMEI365.com All Rights Reserved <br
-                class="only-mobile">深圳市采美信息技术有限公司</p>
-    </div>
-</footer>
-
-<div class="bk-mask" style="display: none"></div>
-
-<script type="text/javascript" src="/lib/jquery-3.6.0.min.js"></script>
-<script type="text/javascript" src="/lib/slideVerify.js"></script>
-<script charset="utf-8" type="text/javascript" src="/lib/jquery-confirm.min.js"></script>
-<script charset="utf-8" type="text/javascript" src="/lib/vue2.6.12.min.js"></script>
-<script th:src="@{/js/common/ajax.service.js(v=${version})}" xmlns:th="https://www.thymeleaf.org"></script>
-<script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/utils.service.js(v=${version})}"></script>
-<script th:src="@{/js/common/serviceapi/user.service.js(v=${version})}" xmlns:th="https://www.thymeleaf.org"></script>
-<script th:src="@{/js/utils.js(v=${version})}" xmlns:th="https://www.thymeleaf.org"></script>
-<script charset="utf-8" type="text/javascript" th:src="@{/js/mixins/router.config.js(v=${version})}"></script>
-<script charset="utf-8" type="text/javascript" th:src="@{/js/mixins/cmSysMixins.js(v=${version})}"></script>
-<script th:src="@{/js/encyclopedia/common.js(v=${version})}" xmlns:th="https://www.thymeleaf.org"></script>
+<footer>
+    <div class="bk-footer">
+        <h2><span>友情链接:</span><a href="https://www.caimei365.com/" target="_blank">采美商城</a></h2>
+        <p class="beian"><i></i><span>粤B1-20160129</span><span>备案号</span><a href="http://www.acebelleshenzhen.com/">粤ICP备14019824号</a><br
+                class="only-mobile"><span>互联网药品信息服务资格证编号(粤)-非经营性-2021-0339</span><br
+                class="only-mobile"><span>中华人民共和国增值电信业务经营许可证</span>
+        </p>
+        <p class="copyright">Copyright © 2015-2022 CAIMEI365.com All Rights Reserved <br
+                class="only-mobile">深圳市采美信息技术有限公司</p>
+    </div>
+</footer>
+
+<div class="bk-mask" style="display: none"></div>
+
+<script type="text/javascript" src="/lib/jquery-3.6.0.min.js"></script>
+<script type="text/javascript" src="/lib/slideVerify.js"></script>
+<script charset="utf-8" type="text/javascript" src="/lib/jquery-confirm.min.js"></script>
+<script charset="utf-8" type="text/javascript" src="/lib/vue2.6.12.min.js"></script>
+<script th:src="@{/js/common/ajax.service.js(v=${version})}" xmlns:th="https://www.thymeleaf.org"></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/beautyArchive.service.js(v=${version})}"></script>
+<script th:src="@{/js/common/serviceapi/user.service.js(v=${version})}" xmlns:th="https://www.thymeleaf.org"></script>
+<script th:src="@{/js/utils.js(v=${version})}" xmlns:th="https://www.thymeleaf.org"></script>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/mixins/router.config.js(v=${version})}"></script>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/mixins/cmSysMixins.js(v=${version})}"></script>
+<script th:src="@{/js/encyclopedia/common.js(v=${version})}" xmlns:th="https://www.thymeleaf.org"></script>

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

@@ -112,7 +112,7 @@
                     <div class="section_right_item ross" v-if="shopAdvert.length > 0">
                         <el-carousel :autoplay="true" show-indicators="false" :height="isPC ? '343px' : '61.6vw'">
                             <el-carousel-item v-for="(item, index) in shopAdvert" :key="item.id">
-                                <a :href="item.jumpLink" target="_blank">
+                                <a @click="setAdvStatistics(item)">
                                     <img :src="item.pcImage" alt="">
                                 </a>
                             </el-carousel-item>

+ 53 - 52
src/main/resources/templates/single-page/promotions.html

@@ -1,52 +1,53 @@
-<!DOCTYPE html>
-<html lang="zh-CN" xmlns:th="https://www.thymeleaf.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-      xsi:schemaLocation="https://www.thymeleaf.org ">
-<head>
-    <title>采美365网-商品专题</title>
-    <template th:replace="components/head-link"></template>
-    <link th:href="@{/css/single-page/promotions.css(v=${version})}" rel="stylesheet" type="text/css">
-    <template th:replace="components/analysis"></template>
-</head>
-<body>
-<!-- 引用头部 -->
-<template th:replace="components/header"></template>
-
-<!-- 二级页面 -->
-<div id="promotionsList">
-    <ul class="wrap">
-        <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>
-    <div v-if="isPC && pageTotal>1" class="pageWrap clear">
-        <a v-if="params.num>1" class="prev" @click="toPagination(params.num*1-1)" href="javascript:void(0);"></a>
-        <template v-for="n in showPageBtn">
-            <a v-if="n" :class="{'on':(n==params.num)}" @click="toPagination(n)" href="javascript:void(0);" v-text="n"></a>
-            <span v-else>···</span>
-        </template>
-        <a v-if="params.num<pageTotal" class="next" @click="toPagination(params.num*1+1)" href="javascript:void(0);"></a>
-        <span>共<b v-text="pageTotal>1?pageTotal:1"></b>页</span>
-        <span>跳至</span>
-        <input v-model="pageInput" @blur="checkNum()"/>
-        <span>页</span>&nbsp;
-        <a class="btn" href="javascript:void(0);" @click="toPagination(pageInput)">点击跳转</a>
-    </div>
-</div>
-
-<!-- 引入底部 -->
-<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>
+<!DOCTYPE html>
+<html lang="zh-CN" xmlns:th="https://www.thymeleaf.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xsi:schemaLocation="https://www.thymeleaf.org ">
+<head>
+    <title>采美365网-商品专题</title>
+    <template th:replace="components/head-link"></template>
+    <link th:href="@{/css/single-page/promotions.css(v=${version})}" rel="stylesheet" type="text/css">
+    <template th:replace="components/analysis"></template>
+</head>
+<body>
+<!-- 引用头部 -->
+<template th:replace="components/header"></template>
+
+<!-- 二级页面 -->
+<div id="promotionsList">
+    <ul class="wrap">
+        <li class="promotions" v-for="item in listData" @click="handleActivityStatistics(item)">
+            <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>
+    <div v-if="isPC && pageTotal>1" class="pageWrap clear">
+        <a v-if="params.num>1" class="prev" @click="toPagination(params.num*1-1)" href="javascript:void(0);"></a>
+        <template v-for="n in showPageBtn">
+            <a v-if="n" :class="{'on':(n==params.num)}" @click="toPagination(n)" href="javascript:void(0);" v-text="n"></a>
+            <span v-else>···</span>
+        </template>
+        <a v-if="params.num<pageTotal" class="next" @click="toPagination(params.num*1+1)" href="javascript:void(0);"></a>
+        <span>共<b v-text="pageTotal>1?pageTotal:1"></b>页</span>
+        <span>跳至</span>
+        <input v-model="pageInput" @blur="checkNum()"/>
+        <span>页</span>&nbsp;
+        <a class="btn" href="javascript:void(0);" @click="toPagination(pageInput)">点击跳转</a>
+    </div>
+</div>
+
+<!-- 引入底部 -->
+<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>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/beautyArchive.service.js(v=${version})}"></script>
+</body>
+</html>