Authored by 陈峰

feature img lazyload

@@ -31,9 +31,9 @@ @@ -31,9 +31,9 @@
31 {{#if id}} data-id="{{id}}" {{/if}} class="floor {{type}} {{#if hide}}hide{{/if}}" style="{{#if param.bgcolor}}background-color:{{param.bgcolor}}{{/if}}"> 31 {{#if id}} data-id="{{id}}" {{/if}} class="floor {{type}} {{#if hide}}hide{{/if}}" style="{{#if param.bgcolor}}background-color:{{param.bgcolor}}{{/if}}">
32 {{#if param.bgimg}} 32 {{#if param.bgimg}}
33 {{#isLazyLoad type @index}} 33 {{#isLazyLoad type @index}}
34 - <img class="lazy" data-original="{{image2 param.bgimg q=85}}"> 34 + <img class="lazy" data-original="{{imageslim param.bgimg}}">
35 {{else}} 35 {{else}}
36 - <img src="{{image2 param.bgimg q=85}}"> 36 + <img src="{{imageslim param.bgimg}}">
37 {{/isLazyLoad}} 37 {{/isLazyLoad}}
38 {{/if}} 38 {{/if}}
39 {{#component}} 39 {{#component}}
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 {{#if modalImg}} 44 {{#if modalImg}}
45 <div class="modal"> 45 <div class="modal">
46 <span class="modal-close"></span> 46 <span class="modal-close"></span>
47 - <img class="modal-img lazy" data-original="{{image2 modalImg q=85}}"> 47 + <img class="modal-img lazy" data-original="{{imageslim modalImg}}">
48 </div> 48 </div>
49 {{/if}} 49 {{/if}}
50 {{/isEqualOr}} 50 {{/isEqualOr}}
@@ -79,7 +79,7 @@ @@ -79,7 +79,7 @@
79 <div class="swiper-wrapper"> 79 <div class="swiper-wrapper">
80 {{#list}} 80 {{#list}}
81 <div class="swiper-slide" style="{{styleFormat this percent=1}}"> 81 <div class="swiper-slide" style="{{styleFormat this percent=1}}">
82 - <img src="{{image2 src q=85}}"> 82 + <img src="{{imageslim src}}">
83 <a class="anchor" href="{{#if link}}{{link}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../../this @index}}"></a> 83 <a class="anchor" href="{{#if link}}{{link}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../../this @index}}"></a>
84 </div> 84 </div>
85 {{/list}} 85 {{/list}}
@@ -49,12 +49,12 @@ @@ -49,12 +49,12 @@
49 <a class="first-part product-detail" href="{{producturl}}"> 49 <a class="first-part product-detail" href="{{producturl}}">
50 <div class="product-detail-imgbox"> 50 <div class="product-detail-imgbox">
51 {{#if lefTopImg}} 51 {{#if lefTopImg}}
52 - <img class="leftopimg" src="{{image2 lefTopImg q=85}}"> 52 + <img class="leftopimg lazy" data-original="{{image2 lefTopImg q=85}}">
53 {{/if}} 53 {{/if}}
54 {{#if rigTopImg}} 54 {{#if rigTopImg}}
55 - <img class="rigtopimg" src="{{image2 rigTopImg q=85}}"> 55 + <img class="rigtopimg lazy" data-original="{{image2 rigTopImg q=85}}">
56 {{/if}} 56 {{/if}}
57 - <img class="product-detail-img product-detail-img-new" src=""> 57 + <img class="product-detail-img product-detail-img-new lazy" src="">
58 <a class="new-brand-name {{#isEqualOr showBrandUrl '1'}}product-brand{{else}}product-detail{{/isEqualOr}}" href=""> 58 <a class="new-brand-name {{#isEqualOr showBrandUrl '1'}}product-brand{{else}}product-detail{{/isEqualOr}}" href="">
59 <span class="brand-name" {{#if fontColor}} style="color:{{fontColor}};" {{/if}}></span> 59 <span class="brand-name" {{#if fontColor}} style="color:{{fontColor}};" {{/if}}></span>
60 </a> 60 </a>
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
76 </div> 76 </div>
77 {{/isEqualOr}} 77 {{/isEqualOr}}
78 </div> 78 </div>
79 - <img class="brand-img" src="{{image2 brandImg q=85}}"> 79 + <img class="brand-img lazy" data-original="{{image2 brandImg q=85}}">
80 </a> 80 </a>
81 {{/if}} 81 {{/if}}
82 </div> 82 </div>
@@ -3,8 +3,8 @@ @@ -3,8 +3,8 @@
3 {{#isEqualOr ../numOfOneRow '2'}} 3 {{#isEqualOr ../numOfOneRow '2'}}
4 <a{{#isEqualOr ../jump2Shop '1'}} href="{{href}}"{{/isEqualOr}}class="pull-left shop-box"> 4 <a{{#isEqualOr ../jump2Shop '1'}} href="{{href}}"{{/isEqualOr}}class="pull-left shop-box">
5 <div class="shop-img"> 5 <div class="shop-img">
6 - <img class="left-icon" src="{{image2 ../lefTopImg q=85}}" alt="">  
7 - <img src="{{image2 picture w=284 h=320 q=85}}" alt=""> 6 + <img class="left-icon lazy" data-original="{{image2 ../lefTopImg q=85}}" alt="">
  7 + <img class="lazy" data-original="{{image2 picture w=284 h=320 q=85}}" alt="">
8 </div> 8 </div>
9 <div class="shop-bottom-bar" style="background-image: url({{image2 ../brandImg w=290 h=60 q=85}})"> 9 <div class="shop-bottom-bar" style="background-image: url({{image2 ../brandImg w=290 h=60 q=85}})">
10 <span class="shop-name">{{shop_name}}</span> 10 <span class="shop-name">{{shop_name}}</span>
@@ -13,8 +13,8 @@ @@ -13,8 +13,8 @@
13 {{^}} 13 {{^}}
14 <a{{#isEqualOr ../jump2Shop '1'}} href="{{href}}"{{/isEqualOr}}class="pull-left shop-box"> 14 <a{{#isEqualOr ../jump2Shop '1'}} href="{{href}}"{{/isEqualOr}}class="pull-left shop-box">
15 <div class="shop-img"> 15 <div class="shop-img">
16 - <img class="left-icon" src="{{image2 ../lefTopImg q=85}}" alt="">  
17 - <img src="{{image2 picture w=188 h=210 q=85}}" alt=""> 16 + <img class="left-icon lazy" data-original="{{image2 ../lefTopImg q=85}}" alt="">
  17 + <img class="lazy" data-original="{{image2 picture w=188 h=210 q=85}}" alt="">
18 </div> 18 </div>
19 <div class="shop-bottom-bar" style="background-image: url({{image2 ../brandImg w=290 h=60 q=85}});"> 19 <div class="shop-bottom-bar" style="background-image: url({{image2 ../brandImg w=290 h=60 q=85}});">
20 <span class="shop-name">{{shop_name}}</span> 20 <span class="shop-name">{{shop_name}}</span>
@@ -123,7 +123,7 @@ module.exports = { @@ -123,7 +123,7 @@ module.exports = {
123 notifyUrl: domains.service + 'payment/weixin_notify', 123 notifyUrl: domains.service + 'payment/weixin_notify',
124 }, 124 },
125 geetestJs: '//static.geetest.com/static/tools/gt.js', 125 geetestJs: '//static.geetest.com/static/tools/gt.js',
126 - jsSdk: '//cdn.yoho.cn/js-sdk/1.3.5/jssdk.js', 126 + jsSdk: '//cdn.yoho.cn/js-sdk/1.3.6/jssdk.js',
127 redis: { 127 redis: {
128 connect: { 128 connect: {
129 host: '192.168.102.49', 129 host: '192.168.102.49',
@@ -3,8 +3,8 @@ @@ -3,8 +3,8 @@
3 {{#is-equal-or ../numOfOneRow '2'}} 3 {{#is-equal-or ../numOfOneRow '2'}}
4 <a href="{{href}}" class="pull-left shop-box"> 4 <a href="{{href}}" class="pull-left shop-box">
5 <div class="shop-img"> 5 <div class="shop-img">
6 - <img class="left-icon" src="{{image2 ../lefTopImg q=85}}" alt="">  
7 - <img src="{{image2 shop_logo w=187 h=275 q=85}}" alt=""> 6 + <img class="left-icon lazy" data-original="{{image2 ../lefTopImg q=85}}" alt="">
  7 + <img class="lazy" data-original="{{image2 shop_logo w=187 h=275 q=85}}" alt="">
8 </div> 8 </div>
9 <div class="shop-bottom-bar" style="background-image: url({{image2 ../brandImg w=290 h=60 q=85}})"> 9 <div class="shop-bottom-bar" style="background-image: url({{image2 ../brandImg w=290 h=60 q=85}})">
10 <span class="shop-name" style="{{#if ../shopNameFontColor}}color: {{../shopNameFontColor}}{{/if}}">{{shop_name}}</span> 10 <span class="shop-name" style="{{#if ../shopNameFontColor}}color: {{../shopNameFontColor}}{{/if}}">{{shop_name}}</span>
@@ -13,8 +13,8 @@ @@ -13,8 +13,8 @@
13 {{^}} 13 {{^}}
14 <a href="{{href}}" class="pull-left shop-box {{#is-equal-or ../displayStyle '0'}}shop-logo{{/is-equal-or}}"> 14 <a href="{{href}}" class="pull-left shop-box {{#is-equal-or ../displayStyle '0'}}shop-logo{{/is-equal-or}}">
15 <div class="shop-img"> 15 <div class="shop-img">
16 - <img class="left-icon" src="{{image2 ../lefTopImg q=85}}" alt="">  
17 - <img src="{{image2 shop_logo w=156 h=106 q=85}}" {{#is-equal-or ../displayStyle '0'}}class="shop-logo-img"{{/is-equal-or}} alt=""> 16 + <img class="left-icon lazy" data-original="{{image2 ../lefTopImg q=85}}" alt="">
  17 + <img class="lazy" data-original="{{image2 shop_logo w=156 h=106 q=85}}" {{#is-equal-or ../displayStyle '0'}}class="shop-logo-img lazy"{{/is-equal-or}} alt="">
18 <span class="shop-name" style="{{#if ../shopNameFontColor}}color: {{../shopNameFontColor}}{{/if}}">{{shop_name}}</span> 18 <span class="shop-name" style="{{#if ../shopNameFontColor}}color: {{../shopNameFontColor}}{{/if}}">{{shop_name}}</span>
19 </div> 19 </div>
20 <div class="shop-bottom-bar" style="background-image: url({{image2 ../brandImg w=290 h=60 q=85}});"> 20 <div class="shop-bottom-bar" style="background-image: url({{image2 ../brandImg w=290 h=60 q=85}});">
1 const $ = require('yoho-jquery'); 1 const $ = require('yoho-jquery');
2 -const lazyLoad = require('yoho-jquery-lazyload'); 2 +const lazyLoad = require('plugin/lazyload');
3 const Swiper = require('yoho-swiper'); 3 const Swiper = require('yoho-swiper');
4 const yoho = require('yoho-app'); 4 const yoho = require('yoho-app');
5 const qs = require('yoho-qs'); 5 const qs = require('yoho-qs');
@@ -11,7 +11,7 @@ global.jQuery = $; @@ -11,7 +11,7 @@ global.jQuery = $;
11 let isAndroid = /(Android)/i.test(navigator.userAgent); 11 let isAndroid = /(Android)/i.test(navigator.userAgent);
12 let isWechat = /micromessenger/i.test(navigator.userAgent); 12 let isWechat = /micromessenger/i.test(navigator.userAgent);
13 13
14 -lazyLoad($('img.lazy'), { q: 85 }); 14 +lazyLoad($('img.lazy'));
15 15
16 function swiperInit() { 16 function swiperInit() {
17 $('.swiper-container').each(function() { 17 $('.swiper-container').each(function() {
@@ -297,6 +297,7 @@ function shopGroupInit() { @@ -297,6 +297,7 @@ function shopGroupInit() {
297 }); 297 });
298 298
299 $this.replaceWith(shopTmpl(config)); 299 $this.replaceWith(shopTmpl(config));
  300 + lazyLoad($('img.lazy'));
300 } else { 301 } else {
301 $this.remove(); 302 $this.remove();
302 } 303 }