Explorar el Código

优化图片点击和浏览量

xiebaomin hace 1 año
padre
commit
aaba0aab1d

+ 1 - 0
src/main/java/com/caimei/www/controller/unlimited/ArticleController.java

@@ -80,6 +80,7 @@ public class ArticleController extends BaseController {
         model.addAttribute("pageNum", pageNum);
         model.addAttribute("isSearch", true);
         model.addAttribute("isSelectInfo", true);
+        System.out.println("articleImages" + cmBrandLandingList);
         //model.addAttribute("pagePath", String.format("/info/center-%s-1.html", id));
         return ARTICLE_LIST_PATH;
     }

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

@@ -61,21 +61,22 @@ var articleRelated = new Vue({
     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){
+                console.log('浏览量+1')
                 // 更新文章索引
                 $.post(coreServer + "/commodity/search/index/update/article", {articleId: _self.infoId}, function(res){
                     console.log(res.msg);
                 });
             }
         });
+        $('#qrcode').qrcode({
+            "render": "canvas",
+            "width": '120',
+            "height": '120',
+            "color": "#3a3",
+            "text": thisUri
+        });
     }
 });

+ 5 - 2
src/main/resources/static/js/supplier-center/article/article-edit.js

@@ -128,13 +128,11 @@ var articleEdit = new Vue({
     methods: {
         onFocused() {
             this.validTime = null
-            console.log(111)
             clearTimeout(this.validTime)
         },
         onBlured() {
             this.isFocus = true
             this.validFormRule()
-            console.log(222)
         },
         // 页面初始化
         init: function init() {
@@ -404,6 +402,11 @@ var articleEdit = new Vue({
                 if (res.code === 0) {
                     CAIMEI.dialog('自动保存成功');
                     _this.onFocused()
+                    setTimeout(function () {
+                        if (_this.formData.articleId === 0) {
+                            _this.handleBack()
+                        }
+                    }, 2000);
                 } else {
                     CAIMEI.Alert(res.msg, '确定', false);
                 }

+ 8 - 4
src/main/resources/templates/article/list.html

@@ -54,15 +54,17 @@
 <!--</div>-->
 <div class="info-banner AppBanner" th:if="${isSearch} and ${articleImages}">
     <div class="banner" th:each="type: ${articleImages}" th:if="${type.levelType} == 1 and ${type.headAppBanner}" >
-        <a th:href="${type.jumpLink}">
+        <a th:href="${type.jumpLink}" th:if="${type.jumpLink}">
             <img th:src="${type.headAppBanner}" style="width: 100%;height: 100%;" />
         </a>
+        <img th:src="${type.headAppBanner}" style="width: 100%;height: 100%;" th:if="${type.jumpLink} == null"/>
     </div>
     <div class="sider-banner">
         <div th:each="type: ${articleImages}" th:if="${type.levelType} == 2 and ${type.headAppBanner}" >
-            <a th:href="${type.jumpLink}">
+            <a th:href="${type.jumpLink}" th:if="${type.jumpLink}">
                 <img th:src="${type.headAppBanner}" style="width: 100%;height: 100%;" />
             </a>
+            <img th:src="${type.headAppBanner}" style="width: 100%;height: 100%;" th:if="${type.jumpLink} == null"/>
         </div>
     </div>
 </div>
@@ -83,15 +85,17 @@
             </div>
             <div class="info-banner PcBanner" th:if="${isSearch} and ${articleImages}">
                 <div class="banner" th:each="type: ${articleImages}" th:if="${type.levelType} == 1 and ${type.headPcBanner}" >
-                    <a th:href="${type.jumpLink}">
+                    <a th:href="${type.jumpLink}" th:if="${type.jumpLink}">
                         <img th:src="${type.headPcBanner}" style="width: 100%;height: 100%;" />
                     </a>
+                    <img th:src="${type.headPcBanner}" style="width: 100%;height: 100%;" th:if="${type.jumpLink} == null"/>
                 </div>
                 <div class="sider-banner">
                     <div th:each="type: ${articleImages}" th:if="${type.levelType} == 2 and ${type.headPcBanner}">
-                        <a th:href="${type.jumpLink}">
+                        <a th:href="${type.jumpLink}" th:if="${type.jumpLink}">
                             <img th:src="${type.headPcBanner}" style="width: 100%;height: 100%;" />
                         </a>
+                        <img th:src="${type.headPcBanner}" style="width: 100%;height: 100%;" th:if="${type.jumpLink} == null"/>
                     </div>
                 </div>
             </div>