소스 검색

Merge remote-tracking branch 'origin/developerB' into developerB

yuwenjun1997 2 년 전
부모
커밋
f79f537996

+ 13 - 5
src/main/resources/static/js/article/detail.js

@@ -23,7 +23,8 @@ var articleRelated = new Vue({
     data: {
         infoId: $("#articleId").val()?$("#articleId").val()*1:0,
         articleLabels: $("#articleLabels").val()?$("#articleLabels").val():"",
-        related: {}
+        related: {},
+        relatedLabels:''
     },
     methods: {
         // getRelatedList: function () {
@@ -42,13 +43,20 @@ 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 = this.handlearticleId = $("#articleId").val() ? $("#articleId").val()*1 : 0;
         this.articleLabels = $("#articleLabels").val()?$("#articleLabels").val():"";
+        this.relatedLabels = $("#relatedLabels").val()?$("#relatedLabels").val():"";
+        console.log('relatedLabels',this.relatedLabels)
+        if(this.relatedLabels){
+            this.cmSysParams.pageLabel =  this.relatedLabels
+        }else{
+            $('.dea-tag-li').each(function(){
+                pageLabelArray.push($(this).find('a').text());
+            })
+            this.cmSysParams.pageLabel =  pageLabelArray.join('/');
+        }
+        console.log('pageLabel', this.cmSysParams.pageLabel)
         // 获取相关阅读
         // this.getRelatedList();
     },

+ 1 - 1
src/main/resources/static/js/document/beauty-archive-detail.js

@@ -7,7 +7,7 @@ $(window).on('resize', function () {
 
 var beautyArchiveDetail = new Vue({
     el: '#beautyArchiveDetail',
-    mixins: [beautyArchiveDetailMixin],
+    mixins: [beautyArchiveDetailMixin,cmSysVitaMixins],
     created: function () {
         // 获取路由hash标识,设置默认展开tab
         this.archiveId = CAIMEI.getUrlParam('id');

+ 2 - 0
src/main/resources/static/js/document/beautyArchiveDetailMixin.js

@@ -237,6 +237,8 @@ var beautyArchiveDetailMixin = {
                 _self.archiveProductInfo.productType = res.data.productType;
                 _self.archiveProductInfo.shopName = res.data.shopName;
                 _self.listLoading = false;
+                _self.cmSysParams.pageLabel =  res.data.relatedLabels;
+                _self.cmSysParams.pageType = 20;
                 // 只有当前用户权限为0时初始化图片预览
                 if (_self.permission === 0) {
                     setTimeout(function () {

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

@@ -28,7 +28,71 @@ function directory(container, flag = true) {
         }
     })
 }
+/相关阅读
+var articleRelated = new Vue({
+    el: "#articleRelated",
+    mixins: [cmSysVitaMixins],
+    data: {
+        infoId: $("#articleId").val()?$("#articleId").val()*1:0,
+        articleLabels: $("#articleLabels").val()?$("#articleLabels").val():"",
+        related: {},
+        relatedLabels:''
+    },
+    methods: {
+        // getRelatedList: function () {
+        //     var _self = this;
+        //     if(this.infoId ===0){return;}
+        //     $.getJSON("/article/related",{
+        //         id: this.infoId,
+        //         labels: this.articleLabels
+        //     }).done(function (r) {
+        //         if (r.code === 0 && r.data) {
+        //             _self.related = r.data;
+        //         }
+        //     });
+        // },
 
+    },
+    created: function () {
+        const pageLabelArray = []
+        this.cmSysParams.pageType = 11;
+        this.infoId = this.handlearticleId = $("#articleId").val() ? $("#articleId").val()*1 : 0;
+        this.articleLabels = $("#articleLabels").val()?$("#articleLabels").val():"";
+        this.relatedLabels = $("#relatedLabels").val()?$("#relatedLabels").val():"";
+        console.log('relatedLabels',this.relatedLabels)
+        if(this.relatedLabels){
+            this.cmSysParams.pageLabel =  this.relatedLabels
+        }else{
+            $('.dea-tag-li').each(function(){
+                pageLabelArray.push($(this).find('a').text());
+            })
+            this.cmSysParams.pageLabel =  pageLabelArray.join('/');
+        }
+        console.log('pageLabel', this.cmSysParams.pageLabel)
+        // 获取相关阅读
+        // this.getRelatedList();
+    },
+    mounted: function () {
+        var _self = this;
+        var thisUri = window.location.href;
+        $('#qrcode').qrcode({
+            "render": "canvas",
+            "width": '120',
+            "height": '120',
+            "color": "#3a3",
+            "text": thisUri
+        });
+        // 文章浏览量+1
+        $.get("/article/pv", {id: this.infoId}, function(res){
+            if(res.code === 0){
+                // 更新文章索引
+                $.post(coreServer + "/commodity/search/index/update/article", {articleId: _self.infoId}, function(res){
+                    console.log(res.msg);
+                });
+            }
+        });
+    }
+});
 $(function () {
     directory('#bk-directory-pc', true)
     directory('#bk-directory-mobile', false)
@@ -67,3 +131,27 @@ $(function () {
         $(this).parents('#video-popup').hide();
     });
 })
+var bkPage = new Vue({
+    el: "#bk-page-container",
+    mixins: [cmSysVitaMixins],
+    data: {
+        relatedLabels:''
+    },
+    methods: {
+
+    },
+    created: function () {
+        this.cmSysParams.pageType = 68;
+        this.relatedLabels = $("#relatedLabels").val()?$("#relatedLabels").val():"";
+        console.log('relatedLabels',this.relatedLabels)
+        if(this.relatedLabels){
+            this.cmSysParams.pageLabel =  this.relatedLabels
+        }else{
+            this.cmSysParams.pageLabel =  $('.bk-name').text();
+        }
+        console.log('pageLabel',this.cmSysParams.pageLabel)
+    },
+    mounted: function () {
+
+    }
+});

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

@@ -11,6 +11,7 @@
 <body class="home detailData">
 <input type="hidden" th:value="${articleId}" id="articleId">
 <input type="hidden" th:value="${article?.label}" id="articleLabels">
+<input type="hidden" th:value="${relatedLabels}" id="relatedLabels">
 <div class="cm-modal"></div>
 <!--导航栏-->
 <template th:replace="article/components/article-header"></template>
@@ -18,6 +19,7 @@
     <!--<div class="tip">提示:产品详情请到采美商城搜索</div>-->
     <!--面包屑-->
     <div class="bar">
+        <p th:text="${relatedLabels}">31231231231</p>
         <a href="/" target="_blank">首页</a> &gt; <a  th:each="type: *{articleType}" th:if="${typeId}==${type.id}" th:text="${type.name}" href="javascript:void(0);" class="title newTitle"></a>&gt; 正文
     </div>
 </div>

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

@@ -15,7 +15,10 @@
 <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 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>

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

@@ -17,8 +17,9 @@
 <!-- 顶部公共区域 -->
 <template th:replace="encyclopedia/components/header"></template>
 <!-- 顶部公共区域 end -->
+<input type="hidden" th:value="${baikeproduct.relatedLabels}" id="relatedLabels">
 
-<main>
+<main id="bk-page-container">
     <div class="bk-banner">
         <img src="/img/encyclopedia/assets/pc-banner-detail.png" alt="采美百科" class="only-pc"/>
         <img src="/img/encyclopedia/assets/h5-banner-detail.png" alt="采美百科" class="only-mobile"/>