Ver Fonte

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

zhijiezhao há 2 anos atrás
pai
commit
4f3d5a1f5e

+ 8 - 0
src/main/java/com/caimei/www/controller/unlimited/ProductController.java

@@ -3,7 +3,9 @@ package com.caimei.www.controller.unlimited;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.www.controller.BaseController;
+import com.caimei.www.pojo.page.Parameter;
 import com.caimei.www.pojo.page.ProductDetail;
+import com.caimei.www.pojo.page.ProductList;
 import com.caimei.www.service.page.ProductService;
 import com.caimei.www.service.page.SinglePageService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -105,6 +107,12 @@ public class ProductController extends BaseController {
         if (detail == null || detail.getValidFlag() == 0 || detail.getValidFlag() == 9) {
             return super.errorPath();
         }
+        List<String> images=productService.getImages(productId);
+        List<Parameter> params=productService.getParams(productId);
+        List<ProductList> productLists=productService.getProductLists(productId);
+        model.addAttribute("lists",productLists);
+        model.addAttribute("params",params);
+        model.addAttribute("images",images);
         model.addAttribute("productId", productId);
         model.addAttribute("product", detail);
         return PRODUCT_DETAIL_PATH;

+ 2 - 0
src/main/java/com/caimei/www/mapper/ProductDao.java

@@ -72,4 +72,6 @@ public interface ProductDao {
      * 修复商品图片(临时)
      */
     List<String> getProductInfo();
+
+    Integer getRecommendType(Integer productId);
 }

+ 9 - 0
src/main/java/com/caimei/www/service/page/ProductService.java

@@ -5,8 +5,11 @@ import com.alibaba.fastjson.JSONObject;
 import com.caimei.www.pojo.JsonModel;
 import com.caimei.www.pojo.baike.BaikeProduct;
 import com.caimei.www.pojo.baike.BaikeType;
+import com.caimei.www.pojo.page.Parameter;
 import com.caimei.www.pojo.page.ProductDetail;
+import com.caimei.www.pojo.page.ProductList;
 
+import java.util.List;
 import java.util.Map;
 
 
@@ -93,4 +96,10 @@ public interface ProductService {
      * @return
      */
     BaikeType getBaikeType(Integer typeId);
+
+    List<String> getImages(Integer productId);
+
+    List<Parameter> getParams(Integer productId);
+
+    List<ProductList> getProductLists(Integer productId);
 }

+ 52 - 14
src/main/java/com/caimei/www/service/page/impl/ProductServiceImpl.java

@@ -7,7 +7,9 @@ import com.caimei.www.mapper.BaikeDao;
 import com.caimei.www.mapper.ProductDao;
 import com.caimei.www.pojo.JsonModel;
 import com.caimei.www.pojo.baike.*;
+import com.caimei.www.pojo.page.Parameter;
 import com.caimei.www.pojo.page.ProductDetail;
+import com.caimei.www.pojo.page.ProductList;
 import com.caimei.www.service.page.ProductService;
 import com.caimei.www.utils.ImageUtil;
 import com.caimei.www.utils.PriceUtil;
@@ -69,14 +71,14 @@ public class ProductServiceImpl implements ProductService {
      */
     @Override
     public JSONArray getTypeClassifyJson(Integer typeSort) {
-        String dataUrl = coreServer+"/commodity/classify?typeSort="+typeSort+"&source=www";
+        String dataUrl = coreServer + "/commodity/classify?typeSort=" + typeSort + "&source=www";
         try {
             String classifyResult = RequestUtil.sendGet(dataUrl);
             log.debug(classifyResult);
             Map<String, Object> classifyMap = JSONObject.parseObject(classifyResult, Map.class);
             return (JSONArray) classifyMap.get("data");
         } catch (Exception e) {
-            log.error("try-catch:",e);
+            log.error("try-catch:", e);
             return null;
         }
     }
@@ -88,14 +90,14 @@ public class ProductServiceImpl implements ProductService {
      */
     @Override
     public Map<String, Object> getTypeFloorJson(Integer pageId) {
-        String dataUrl = coreServer+"/commodity/classify/product?pageId="+ pageId +"&source=1";
+        String dataUrl = coreServer + "/commodity/classify/product?pageId=" + pageId + "&source=1";
         try {
             String floorResult = RequestUtil.sendGet(dataUrl);
             log.debug(floorResult);
             Map<String, Object> floorMap = JSONObject.parseObject(floorResult, Map.class);
             return JSONObject.parseObject(String.valueOf(floorMap.get("data")), Map.class);
         } catch (Exception e) {
-            log.error("try-catch:",e);
+            log.error("try-catch:", e);
             return null;
         }
     }
@@ -107,14 +109,14 @@ public class ProductServiceImpl implements ProductService {
      */
     @Override
     public JSONArray getBigTypeJson(Integer typeSort) {
-        String dataUrl = coreServer+"/commodity/type/first?typeSort="+typeSort;
+        String dataUrl = coreServer + "/commodity/type/first?typeSort=" + typeSort;
         try {
             String classifyResult = RequestUtil.sendGet(dataUrl);
             log.debug(classifyResult);
             Map<String, Object> classifyMap = JSONObject.parseObject(classifyResult, Map.class);
             return (JSONArray) classifyMap.get("data");
         } catch (Exception e) {
-            log.error("try-catch:",e);
+            log.error("try-catch:", e);
             return null;
         }
     }
@@ -126,14 +128,14 @@ public class ProductServiceImpl implements ProductService {
      */
     @Override
     public JSONArray getSmallTypeJson(Integer bigTypeId) {
-        String dataUrl = coreServer+"/commodity/type/second?bigTypeId="+bigTypeId;
+        String dataUrl = coreServer + "/commodity/type/second?bigTypeId=" + bigTypeId;
         try {
             String classifyResult = RequestUtil.sendGet(dataUrl);
             log.debug(classifyResult);
             Map<String, Object> classifyMap = JSONObject.parseObject(classifyResult, Map.class);
             return (JSONArray) classifyMap.get("data");
         } catch (Exception e) {
-            log.error("try-catch:",e);
+            log.error("try-catch:", e);
             return null;
         }
     }
@@ -146,14 +148,14 @@ public class ProductServiceImpl implements ProductService {
      */
     @Override
     public JSONArray getTinyTypeJson(Integer smallTypeId) {
-        String dataUrl = coreServer+"/commodity/type/third?smallTypeId="+smallTypeId;
+        String dataUrl = coreServer + "/commodity/type/third?smallTypeId=" + smallTypeId;
         try {
             String classifyResult = RequestUtil.sendGet(dataUrl);
             log.debug(classifyResult);
             Map<String, Object> classifyMap = JSONObject.parseObject(classifyResult, Map.class);
             return (JSONArray) classifyMap.get("data");
         } catch (Exception e) {
-            log.error("try-catch:",e);
+            log.error("try-catch:", e);
             return null;
         }
     }
@@ -165,7 +167,7 @@ public class ProductServiceImpl implements ProductService {
      */
     @Override
     public JSONObject getProductListJson(String params) {
-        String dataUrl = coreServer+"/commodity/search/query/product/type"+params;
+        String dataUrl = coreServer + "/commodity/search/query/product/type" + params;
         try {
             String productResult = RequestUtil.sendGet(dataUrl);
             log.debug(productResult);
@@ -173,7 +175,7 @@ public class ProductServiceImpl implements ProductService {
             String data = (String) productMap.get("data");
             return JSONObject.parseObject(data);
         } catch (Exception e) {
-            log.error("try-catch:",e);
+            log.error("try-catch:", e);
             return null;
         }
     }
@@ -187,7 +189,7 @@ public class ProductServiceImpl implements ProductService {
             Map<String, Object> classifyMap = JSONObject.parseObject(classifyResult, Map.class);
             return (JSONArray) classifyMap.get("data");
         } catch (Exception e) {
-            log.error("try-catch:",e);
+            log.error("try-catch:", e);
             return null;
         }
     }
@@ -201,7 +203,7 @@ public class ProductServiceImpl implements ProductService {
             Map<String, Object> moreMap = JSONObject.parseObject(moreResult, Map.class);
             return JSONObject.parseObject(String.valueOf(moreMap.get("data")), Map.class);
         } catch (Exception e) {
-            log.error("try-catch:",e);
+            log.error("try-catch:", e);
             return null;
         }
     }
@@ -211,6 +213,42 @@ public class ProductServiceImpl implements ProductService {
         return baikeDao.getBaikeType(typeId);
     }
 
+    @Override
+    public List<String> getImages(Integer productId) {
+        List<String> productDetailImages = productDao.getProductDetailImages(productId);
+        List<String> strings = new ArrayList<>();
+        if (null != productDetailImages && productDetailImages.size() > 0) {
+            productDetailImages.forEach(p -> {
+                strings.add(ImageUtil.getImageURL("product", p, 0, domain));
+            });
+        }
+        return strings;
+    }
+
+    @Override
+    public List<Parameter> getParams(Integer productId) {
+        return productDao.getProductParameters(productId);
+    }
+
+    @Override
+    public List<ProductList> getProductLists(Integer productId) {
+        //取不到userId,默认游客 商品可见度默认所有人
+        Integer recommendType = productDao.getRecommendType(productId);
+        List<ProductList> list = null;
+        if (null != recommendType && 1 == recommendType) {
+            list = productDao.getProductRecommendsById(productId);
+        } else {
+            list = productDao.getAutoProductRecommends(productId);
+        }
+        if (null != list && list.size() > 0) {
+            list.forEach(product -> {
+                // 设置 图片路径
+                product.setImage(ImageUtil.getImageURL("product", product.getImage(), 0, domain));
+            });
+        }
+        return list;
+    }
+
     @Override
     public BaikeProduct getBaikeProductDetail(Integer productId) {
         BaikeProduct baikeProduct = baikeDao.getBaikeProductDetail(productId);

+ 16 - 9
src/main/resources/mapper/ProductMapper.xml

@@ -72,20 +72,24 @@
         from product as p
         left join cm_product_recommend as pr on pr.recommendProductID = p.productID
         where
-            pr.productID = #{productId} and p.validFlag  = 2
+            pr.productID = #{productId}
+          and p.validFlag  = 2
+          and p.visibility = 3
         order by pr.sort desc
 	</select>
 	<select id="getAutoProductRecommends" resultType="com.caimei.www.pojo.page.ProductList">
-        select
+		select
 			p.productID as id,
 			p.`name` as `name`,
-			p.productType,
-			p.mainImage as image
-        from product as p
-        where
-			p.validFlag  = 2 and
-			p.tinyTypeID = (select tinyTypeID from product as p1 where p1.productID = #{productId})
-        order by p.sellNumber desc limit 0,7
+			p.mainImage as image,
+			IFNULL(p.visibility,3) as visibility,
+			p.productType
+		from product as p
+		where p.validFlag  = 2
+		  and p.commodityType = (select commodityType from product as p1 where p1.productID = #{productId})
+		  and p.smallTypeID = (select smallTypeID from product as p2 where p2.productID = #{productId})
+		  and p.visibility = 3
+		order by p.sellNumber desc limit 0,7
 	</select>
 	<select id="getProductParameters" resultType="com.caimei.www.pojo.page.Parameter">
 		select id as id,
@@ -129,5 +133,8 @@
     <select id="getProductInfo" resultType="java.lang.String">
         select detailinfo from productdetailinfo where detailinfo like '%img-b.caimei365.com%'
 	</select>
+	<select id="getRecommendType" resultType="java.lang.Integer">
+		select recommendType from product where productId=#{productId}
+	</select>
 
 </mapper>

+ 5 - 3
src/main/resources/static/css/article/article.css

@@ -158,7 +158,7 @@ dl,dd,dt{zoom:1}
 	.new-list .search-tip{ font-size: 16px; color: #333; font-weight: bold; position: relative;line-height: 32px}
 	.new-list .search-tip b{color:#E15616;font-weight:bold;}
 	.new-list .search-tip a{ color:#E15616; text-decoration: underline; }
-	.new-list .search-tip::after {content: ""; display: inline-block;/* position: absolute; left: 0;top: 50%; transform: translateY(-50%);*/ width: 30px; height: 30px; background: url(/img/base/icon-pointer-right.png) no-repeat center; background-size: 30px; height: 30px;
+	.new-list .search-tip.pointer::after {content: ""; display: inline-block;/* position: absolute; left: 0;top: 50%; transform: translateY(-50%);*/ width: 30px; height: 30px; background: url(/img/base/icon-pointer-right.png) no-repeat center; background-size: 30px; height: 30px;
 		-webkit-animation: ease pointerFlashing infinite 0.3s;
 		animation: ease pointerFlashing infinite 0.3s; -webkit-transform: rotateY(180deg); transform: rotateY(180deg);vertical-align: -8px;
 		-webkit-filter: invert(54%) sepia(57%) saturate(5587%) hue-rotate(352deg) brightness(90%) contrast(96%);filter: invert(54%) sepia(57%) saturate(5587%) hue-rotate(352deg) brightness(90%) contrast(96%);
@@ -186,7 +186,7 @@ dl,dd,dt{zoom:1}
 
 }
 @media screen and (max-width:768px){
-	body{height: 100vh;overflow-y: scroll;}
+	body{height: 100vh;overflow-y: scroll;position: relative;}
 	.header .logo,.header .home{display:none}
 	.mIcon:before{content:'';display:inline-block;font-size:0;background:url(/img/base/icon_m.png) no-repeat;background-size:100vw auto;transition:all .5s}
 	#scrollTop{display:none;position:fixed;right:0;;z-index:9999;bottom:4vw;}
@@ -221,7 +221,7 @@ dl,dd,dt{zoom:1}
 	.classify.search-tip{ font-size: 3.2vw; font-weight: bold; }
 	.classify.search-tip em{color:#E15616;font-weight:bold;}
 	.classify.search-tip a{ color:#E15616; text-decoration: underline; }
-	.classify.search-tip::after {content: ""; display: inline-block;width: 6.2vw; height: 6.2vw;
+	.classify.search-tip.pointer::after {content: ""; display: inline-block;width: 6.2vw; height: 6.2vw;
 		background: url(/img/base/icon-pointer-right.png) no-repeat center; background-size: 6.2vw 6.2vw;
 		-webkit-animation: ease pointerFlashing infinite 0.3s;
 		animation: ease pointerFlashing infinite 0.3s; -webkit-transform: rotateY(180deg); transform: rotateY(180deg);vertical-align: -1.6vw;
@@ -270,4 +270,6 @@ dl,dd,dt{zoom:1}
 	.classify{height:10vw;line-height:10vw;border-left:solid 4px #e15616;font-size:3.7vw;color:#333;padding:0 3vw;background:#fff}
 	.article .like{color: #e15616;cursor: pointer;display: block;height: 18.4vw;width: 18.4vw;line-height: 27.4vw;margin: 5vw auto;border-radius: 50%;background: #fef6f3;text-align: center;position: relative}
 	.article .like:before{ width: 8vw;height: 8vw;background-position: -14vw -78.4vw;vertical-align: middle;border-radius: 50%;position: absolute;top: 3.2vw}
+
+	.no-result{text-align: center;padding: 3.2vw 0;}
 }

+ 2 - 2
src/main/resources/static/js/article/list.js

@@ -162,8 +162,8 @@ var articleList = new Vue({
                 var scrollTop =  $(this).scrollTop();
                 var documentHeight = $(document).height();
                 var windowHeight = $(this).height() ;
-                if( scrollTop + windowHeight == documentHeight ){
-                    console.log("到底部了!");
+                // alert(scrollTop + windowHeight == documentHeight)
+                if( scrollTop + windowHeight + 100 > documentHeight ){
                     //此处是滚动条到底部时候触发的事件,在这里写要加载的数据,或者是拉动滚动条的操作
                     var totalPage = Math.ceil(_self.listRecord / _self.params.size)?Math.ceil(_self.listRecord / _self.params.size):1;
                     var next = _self.params.num+1;

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

@@ -28,18 +28,18 @@ var ProductApi = {
                 callback(res);
             });
         },
-        GetProductDdtailsImages: function (params, callback) {//获取商品图片
-            Http.AjaxService({
-                url:'/commodity/product/detail/images',
-                type:'get',
-                data:params,
-                json:true,
-                isHost:true
-            })
-            .then(function(res){
-                callback(res);
-            });
-        },
+        // GetProductDdtailsImages: function (params, callback) {//获取商品图片
+        //     Http.AjaxService({
+        //         url:'/commodity/product/detail/images',
+        //         type:'get',
+        //         data:params,
+        //         json:true,
+        //         isHost:true
+        //     })
+        //     .then(function(res){
+        //         callback(res);
+        //     });
+        // },
         GetProductDdtailsPrice: function (params, callback) {//获取商品价格
             Http.AjaxService({
                 url:'/commodity/price/detail',

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

@@ -140,7 +140,7 @@ var beautyArchive = new Vue({
                 window.location.href = '/404.html'
             }
             if (product.redirectType === 1) {
-                url = '/product-' + product.productId + '.html?open=caimei365';
+                url = '/product-' + product.productId +'-'+globalUserData.userId+ '.html?open=caimei365';
             } else if (product.redirectType === 2) {
                 url = '/document/archive-detail.html' + '?id=' + product.archiveId;
             } else {

+ 99 - 49
src/main/resources/static/js/product/detail.js

@@ -135,41 +135,41 @@ var productDetail = new Vue({
                 }
             });
         },
-        getImages: function () {
-            var _self = this;
-            if (!this.productId) {
-                return;
-            }
-            ProductApi.GetProductDdtailsImages({productId: _self.productId}, function (response) {
-                if (response.code === 0 && response.data) {
-                    _self.images = response.data;
-                    setTimeout(function () {
-                        if (isPC) {
-                            var magnifier = new ImageMagnifier(
-                                '#imgShown .smallImage li',
-                                '#imgShown .bigImage',
-                                '#imgShown .zoomImage',
-                                '#imgShown .mask',
-                                '#imgShown .zoom',
-                                "on"
-                            ).init();
-                        } else {
-                            var swiper = new Swiper('#swiperImage', {
-                                loop: true,
-                                autoplay: {
-                                    delay: 2000,
-                                    disableOnInteraction: false
-                                },
-                                pagination: {
-                                    el: '.swiper-pagination',
-                                    type: 'fraction'
-                                }
-                            });
-                        }
-                    }, 500);
-                }
-            });
-        },
+        // getImages: function () {
+        //     var _self = this;
+        //     if (!this.productId) {
+        //         return;
+        //     }
+        //     ProductApi.GetProductDdtailsImages({productId: _self.productId}, function (response) {
+        //         if (response.code === 0 && response.data) {
+        //             _self.images = response.data;
+        //             setTimeout(function () {
+        //                 if (isPC) {
+        //                     var magnifier = new ImageMagnifier(
+        //                         '#imgShown .smallImage li',
+        //                         '#imgShown .bigImage',
+        //                         '#imgShown .zoomImage',
+        //                         '#imgShown .mask',
+        //                         '#imgShown .zoom',
+        //                         "on"
+        //                     ).init();
+        //                 } else {
+        //                     var swiper = new Swiper('#swiperImage', {
+        //                         loop: true,
+        //                         autoplay: {
+        //                             delay: 2000,
+        //                             disableOnInteraction: false
+        //                         },
+        //                         pagination: {
+        //                             el: '.swiper-pagination',
+        //                             type: 'fraction'
+        //                         }
+        //                     });
+        //                 }
+        //             }, 500);
+        //         }
+        //     });
+        // },
         getProductDetails: function () {
             var _self = this;
             ProductApi.GetProductDdtails({userId: GLOBAL_USER_ID, productId: _self.productId}, function (response) {
@@ -317,18 +317,18 @@ var productDetail = new Vue({
                 }
             });
         },
-        getParameters: function () {//获取商品参数
-            var _self = this;
-            if (!this.productId) {
-                return;
-            }
-            ProductApi.GetProductDdtailsParameter({productId: _self.productId}, function (response) {
-                if (response.code === 0 && response.data) {
-                    _self.parameters = response.data;
-                    console.log(_self.parameters)
-                }
-            });
-        },
+        // getParameters: function () {//获取商品参数
+        //     var _self = this;
+        //     if (!this.productId) {
+        //         return;
+        //     }
+        //     ProductApi.GetProductDdtailsParameter({productId: _self.productId}, function (response) {
+        //         if (response.code === 0 && response.data) {
+        //             _self.parameters = response.data;
+        //             console.log(_self.parameters)
+        //         }
+        //     });
+        // },
         toggleThisLadder: function (event) {
             var el = event.currentTarget;
             if ($(el).hasClass("on")) {
@@ -804,7 +804,7 @@ var productDetail = new Vue({
         this.productId = this.couponParam.productId = this.listQuery.productId = $("#productId").val();
         this.userId = this.couponParam.userId = this.listQuery.userId = GLOBAL_USER_ID;
         this.productStock = $("#productStock").val();
-        this.getImages();
+        // this.getImages();
         // identity: 0个人,1协销,2会员机构,3供应商,4普通机构
         // visibility:3:所有人可见,2:普通机构可见,1:会员机构可见 4:仅医美机构可见
         var visible = $("#productVisibility").val() * 1;
@@ -821,7 +821,7 @@ var productDetail = new Vue({
         this.userId = this.couponParam.userId = GLOBAL_USER_ID;
         this.getProductDetails();
         this.getProductPrice();
-        this.getParameters();
+        // this.getParameters();
         this.queryProductDetilsCoupons();
         this.getCommodityCombinationList();
         console.log('GLOBAL_CLUB_TYPE',GLOBAL_CLUB_TYPE)
@@ -830,5 +830,55 @@ var productDetail = new Vue({
         //     ,titCell:".tabTit span"
         //     ,trigger: "click"
         // });
+        setTimeout(function () {
+            if (isPC) {
+                var magnifier = new ImageMagnifier(
+                    '#imgShown .smallImage li',
+                    '#imgShown .bigImage',
+                    '#imgShown .zoomImage',
+                    '#imgShown .mask',
+                    '#imgShown .zoom',
+                    "on"
+                ).init();
+            } else {
+                var swiper = new Swiper('#swiperImage', {
+                    loop: true,
+                    autoplay: {
+                        delay: 2000,
+                        disableOnInteraction: false
+                    },
+                    pagination: {
+                        el: '.swiper-pagination',
+                        type: 'fraction'
+                    }
+                });
+            }
+        }, 500);
+        setTimeout(function () {
+            if (isPC) {
+                $('#productRecommend').slide({
+                    mainCell: ".swiper-wrapper",
+                    titCell: ".swiper-pagination span",
+                    effect: "leftLoop",
+                    interTime: 3000,
+                    autoPlay: true,
+                    scroll: 7,
+                    vis: 7,
+                    trigger: "mouseover"
+                });
+            } else {
+                var swiper = new Swiper('#productRecommend', {
+                    slidesPerView: 3,
+                    spaceBetween: 0,
+                    autoplay: {
+                        delay: 3000,
+                        disableOnInteraction: false
+                    },
+                    pagination: {
+                        el: '.swiper-pagination'
+                    }
+                });
+            }
+        }, 500);
     }
 });

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

@@ -26,19 +26,23 @@
                     <input class="keyword" type="text" :value="params.keyword" placeholder="请输入关键词" />
                     <a class="searchBtn" href="javascript:void(0);">搜索</a>
                 </div>
-                <p v-if="isPC" class="result search-tip">
-                    <span>为你找到相关文章<b v-text="listRecord"></b>条,</span>
-                    <span>同时为您找到相关产品<b v-text="productRecord"></b>个</span>
-                    <a target="_blank" :href="'/product/list.html?keyword=' + params.keyword" v-if="listRecord > 0">点击前往</a>
+                <p v-if="isPC" class="result search-tip" :class="{pointer:productRecord && productRecord > 0}">
+                    <span>为你找到相关文章<b v-text="listRecord"></b>条<template v-if="productRecord && productRecord > 0">,</template></span>
+                    <template  v-if="productRecord && productRecord > 0">
+                        <span>同时为您找到相关产品<b v-text="productRecord"></b>个</span>
+                        <a target="_blank" :href="'/product/list.html?keyword=' + params.keyword" v-if="listRecord > 0">点击前往</a>
+                    </template>
                 </p>
             </div>
             <p v-else-if="params.labelId" class="classify biaoqian">
                 <em id="labelTxt"></em>相关的文章
             </p>
-            <p v-if="params.keyword && !isPC" class="classify search-tip">
-                <span>为你找到相关文章<em v-text="listRecord"></em>条,</span>
-                <span>同时为您找到相关产品<em v-text="listRecord"></em>个</span>
-                <a target="_blank" :href="'/product/list.html?keyword=' + params.keyword" v-if="listRecord > 0">点击前往</a>
+            <p v-if="params.keyword && !isPC" class="classify search-tip" :class="{pointer:productRecord && productRecord > 0}">
+                <span>为你找到相关文章<em v-text="listRecord"></em>条<template v-if="productRecord && productRecord > 0">,</template></span>
+                <template v-if="productRecord && productRecord > 0">
+                    <span>同时为您找到相关产品<em v-text="productRecord"></em>个</span>
+                    <a target="_blank" :href="'/product/list.html?keyword=' + params.keyword" v-if="listRecord > 0">点击前往</a>
+                </template>
             </p>
             <div v-if="listData.length>0" class="dataRousce">
                 <!--<div class="search-tip">为你找到相关文章59条,同时为您找到相关产品59条<a href="/">点击前往</a></div>-->

+ 33 - 9
src/main/resources/templates/product/detail.html

@@ -27,14 +27,14 @@
                 <div class="cm-product-cover-tag"  v-if="pcActType === 1"></div>
                 <div class="page_main_type" th:if="*{productType}==2">医疗器械</div>
                 <div v-if="isPC" class="bigImage">
-                    <img :src="images[0]">
+                    <img th:src="${images[0]}">
                     <span class="mask"></span>
 <!--                    <span class="cm-product-cover-tag" v-if="isPC && pcActType === 1">云上美博会</span>-->
                 </div>
                 <div id="swiperImage" class="smallImage swiper-container">
                     <ul class="swiper-wrapper clear">
-                        <li class="swiper-slide mfc" v-for="img in images">
-                            <img :src="img">
+                        <li class="swiper-slide mfc" th:each="img : ${images}">
+                            <img th:src="${img}">
 <!--                            <span class="cm-product-cover-tag" v-if="!isPC && pcActType === 1">云上美博会</span>-->
 <!--                            <span class="cm-product-cover-tag" v-if="!isPC && pcActType === 1"></span>-->
                         </li>
@@ -43,7 +43,7 @@
                 </div>
                 <div v-if="isPC" class="zoomImage">
                     <div class="zoom">
-                        <img :src="images[0]">
+                        <img th:src="${images[0]}">
                     </div>
                 </div>
             </div>
@@ -417,7 +417,31 @@
             </div>
         </div>
         <!--相关推荐区域-->
-        <div class="recommendBox" v-if="recommends.length>0">
+        <div v-if="!GLOBAL_USER_ID" class="recommendBox" th:if="${lists.size()>0}">
+            <div class="hd">相关推荐</div>
+            <div id="productRecommend" class="swiper-container">
+                <ul class="swiper-wrapper" v-cloak>
+                    <li class="swiper-slide mfc" th:each="p : ${lists}">
+                        <div class="item">
+                            <a class="image" th:href="'/product-'+${p.id}+'.html'" target="_blank">
+                                <img th:src="${p.image}" th:alt="${p.name}"
+                                     onerror="javascript:this.src='/img/base/placeholder.png';">
+                                <span th:html="${p.name}"></span>
+                            </a>
+                        </div>
+                    </li>
+                    <!--<li class="swiper-slide  defaulImg" v-for="(item,index) in recommendIndex">
+                       <div class="item">
+                            <a href="javascript:0" class="image">
+                                <img src="/img/base/placeholder.png" alt="">
+                            </a>
+                     </div>
+                    </li>-->
+                </ul>
+                <div class="swiper-pagination mfc"><span v-if="isPC" v-for="i in recommendPage"></span></div>
+            </div>
+        </div>
+        <div class="recommendBox" v-if="GLOBAL_USER_ID && recommends.length>0">
             <div class="hd">相关推荐</div>
             <div id="productRecommend" class="swiper-container">
                 <ul class="swiper-wrapper" v-cloak>
@@ -454,7 +478,7 @@
         <div class="productInfo">
             <div class="tabTit">
                 <span :class="tabsIndex == 0 ? 'on' : ''" @click="detailsClicktab(0)">商品详情</span>
-                <span :class="tabsIndex == 1 ? 'on' : ''" v-if="parameters.length>0 && !isNoneDisabled" @click="detailsClicktab(1)">相关参数</span>
+                <span :class="tabsIndex == 1 ? 'on' : ''" th:if="${null!=params && params.size()>0}" v-if="!isNoneDisabled" @click="detailsClicktab(1)">相关参数</span>
                 <span :class="tabsIndex == 2 ? 'on' : ''" v-if="isServiceInfo && !isNoneDisabled" @click="detailsClicktab(2)">服务项目</span>
                 <span :class="tabsIndex == 3 ? 'on' : ''" v-if="isTrainingMethod" @click="detailsClicktab(3)">培训方案</span>
                 <span v-if="archiveId !== 0" :class="tabsIndex == 4 ? 'on' : ''" @click="detailsClicktab(4)">相关资料</span>
@@ -482,9 +506,9 @@
                 </div>
                 <div class="item" v-if="tabsIndex == 1">
                     <table>
-                        <tr v-for="pa in parameters">
-                            <td v-text="pa.paramsName"></td>
-                            <td v-text="pa.paramsContent"></td>
+                        <tr th:each="pa : ${params}">
+                            <td th:text="${pa.name}"></td>
+                            <td th:text="${pa.content}"></td>
                         </tr>
                     </table>
                 </div>