Authored by ccbikai

为您优选优化

@@ -17,7 +17,7 @@ use Plugin\Cache; @@ -17,7 +17,7 @@ use Plugin\Cache;
17 class Yohobuy 17 class Yohobuy
18 { 18 {
19 19
20 -// /* 正式环境 */ 20 + /* 正式环境 */
21 // const API_URL = 'http://api2.open.yohobuy.com/'; 21 // const API_URL = 'http://api2.open.yohobuy.com/';
22 // const API_URL2 = 'http://api.open.yohobuy.com/'; 22 // const API_URL2 = 'http://api.open.yohobuy.com/';
23 // const SERVICE_URL = 'http://service.api.yohobuy.com/'; 23 // const SERVICE_URL = 'http://service.api.yohobuy.com/';
@@ -9,9 +9,10 @@ var Swiper = require('yoho.iswiper'); @@ -9,9 +9,10 @@ var Swiper = require('yoho.iswiper');
9 9
10 var recommendSwiper; 10 var recommendSwiper;
11 11
12 -recommendSwiper = new Swiper('.swiper-recommend', {  
13 -  
14 - // lazyLoading: true,  
15 - // lazyLoadingInPrevNext: true,  
16 - slidesPerView: 'auto' 12 +recommendSwiper = new Swiper('#swiper-recommend', {
  13 + slidesPerView: 'auto',
  14 + grabCursor: true,
  15 + slideElement: 'li',
  16 + lazyLoading: true,
  17 + watchSlidesVisibility: true
17 }); 18 });
@@ -12,25 +12,28 @@ @@ -12,25 +12,28 @@
12 font-weight: bold; 12 font-weight: bold;
13 } 13 }
14 14
15 - .swiper-recommend { 15 + .swiper-container {
16 padding: pxToRem(20px) 0; 16 padding: pxToRem(20px) 0;
17 width: 100%; 17 width: 100%;
  18 + height: pxToRem(252px);
18 overflow: hidden; 19 overflow: hidden;
19 20
20 - .swiper-slider {  
21 - margin: 0 pxToRem(10px); 21 + .swiper-slide {
  22 + padding: 0 pxToRem(10px);
  23 + float: left;
  24 + width: pxToRem(156px);
22 25
23 &:first-child { 26 &:first-child {
24 - margin-left: pxToRem(30px); 27 + padding-left: pxToRem(30px);
25 } 28 }
26 29
27 &:last-child { 30 &:last-child {
28 - margin-right: pxToRem(30px); 31 + padding-right: pxToRem(30px);
29 } 32 }
30 33
31 img { 34 img {
32 - width: pxToRem(156px);  
33 - max-width: none; 35 + width: 100%;
  36 + height: pxToRem(208px);
34 } 37 }
35 } 38 }
36 } 39 }
@@ -42,19 +45,21 @@ @@ -42,19 +45,21 @@
42 line-height: 1; 45 line-height: 1;
43 46
44 span { 47 span {
  48 + display: block;
45 // chrome 最小支持12px, 设计图是 10px ,用CSS3变换 49 // chrome 最小支持12px, 设计图是 10px ,用CSS3变换
46 @include transform(scale(0.875)); 50 @include transform(scale(0.875));
47 } 51 }
48 52
49 .sale-price { 53 .sale-price {
50 color: #d9134f; 54 color: #d9134f;
  55 + margin-left: pxToRem(-10px);
51 } 56 }
52 57
53 .old-price { 58 .old-price {
54 position: absolute; 59 position: absolute;
55 top: 0; 60 top: 0;
56 - right: 0;  
57 - color: #ededed; 61 + right: pxToRem(-6px);
  62 + color: #b0b0b0;
58 } 63 }
59 64
60 .no-price { 65 .no-price {
@@ -95,7 +95,9 @@ @@ -95,7 +95,9 @@
95 <span class="iconfont num">&#xe604;</span> 95 <span class="iconfont num">&#xe604;</span>
96 </a> 96 </a>
97 </div> 97 </div>
98 - 98 +
  99 + {{#isLogin}}
99 {{> product/recommend-for-you}} 100 {{> product/recommend-for-you}}
  101 + {{/isLogin}}
100 </div> 102 </div>
101 {{> layout/footer}} 103 {{> layout/footer}}
1 {{# recommendForYou}} 1 {{# recommendForYou}}
2 <div class="recommend-for-you"> 2 <div class="recommend-for-you">
3 <div class="title">为您优选新品</div> 3 <div class="title">为您优选新品</div>
4 - <div class="swiper-recommend">  
5 - <ul class="swiper-wrapper"> 4 + <div id="swiper-recommend" class="swiper-container">
  5 + <ul class="swiper-wrapper swiper-wrapper-recommend">
6 {{#recommendList}} 6 {{#recommendList}}
7 - <li class="swiper-slider">  
8 - <img class="img-box" src="{{thumb}}"> 7 + <li class="swiper-slide">
  8 + <img class="swiper-lazy img-box" data-src="{{thumb}}">
9 <div class="price"> 9 <div class="price">
10 <span class="sale-price {{^price}}no-price{{/price}}"{{salePrice}}</span> 10 <span class="sale-price {{^price}}no-price{{/price}}"{{salePrice}}</span>
11 {{#price}}<span class="old-price"{{.}}</span>{{/price}} 11 {{#price}}<span class="old-price"{{.}}</span>{{/price}}
12 </div> 12 </div>
  13 + <div class="swiper-lazy-preloader"></div>
13 </li> 14 </li>
14 {{/recommendList}} 15 {{/recommendList}}
15 </ul> 16 </ul>