Authored by 陈峰

feature img lazyload

... ... @@ -31,9 +31,9 @@
{{#if id}} data-id="{{id}}" {{/if}} class="floor {{type}} {{#if hide}}hide{{/if}}" style="{{#if param.bgcolor}}background-color:{{param.bgcolor}}{{/if}}">
{{#if param.bgimg}}
{{#isLazyLoad type @index}}
<img class="lazy" data-original="{{image2 param.bgimg q=85}}">
<img class="lazy" data-original="{{imageslim param.bgimg}}">
{{else}}
<img src="{{image2 param.bgimg q=85}}">
<img src="{{imageslim param.bgimg}}">
{{/isLazyLoad}}
{{/if}}
{{#component}}
... ... @@ -44,7 +44,7 @@
{{#if modalImg}}
<div class="modal">
<span class="modal-close"></span>
<img class="modal-img lazy" data-original="{{image2 modalImg q=85}}">
<img class="modal-img lazy" data-original="{{imageslim modalImg}}">
</div>
{{/if}}
{{/isEqualOr}}
... ... @@ -79,7 +79,7 @@
<div class="swiper-wrapper">
{{#list}}
<div class="swiper-slide" style="{{styleFormat this percent=1}}">
<img src="{{image2 src q=85}}">
<img src="{{imageslim src}}">
<a class="anchor" href="{{#if link}}{{link}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../../this @index}}"></a>
</div>
{{/list}}
... ...
... ... @@ -49,12 +49,12 @@
<a class="first-part product-detail" href="{{producturl}}">
<div class="product-detail-imgbox">
{{#if lefTopImg}}
<img class="leftopimg" src="{{image2 lefTopImg q=85}}">
<img class="leftopimg lazy" data-original="{{image2 lefTopImg q=85}}">
{{/if}}
{{#if rigTopImg}}
<img class="rigtopimg" src="{{image2 rigTopImg q=85}}">
<img class="rigtopimg lazy" data-original="{{image2 rigTopImg q=85}}">
{{/if}}
<img class="product-detail-img product-detail-img-new" src="">
<img class="product-detail-img product-detail-img-new lazy" src="">
<a class="new-brand-name {{#isEqualOr showBrandUrl '1'}}product-brand{{else}}product-detail{{/isEqualOr}}" href="">
<span class="brand-name" {{#if fontColor}} style="color:{{fontColor}};" {{/if}}></span>
</a>
... ... @@ -76,7 +76,7 @@
</div>
{{/isEqualOr}}
</div>
<img class="brand-img" src="{{image2 brandImg q=85}}">
<img class="brand-img lazy" data-original="{{image2 brandImg q=85}}">
</a>
{{/if}}
</div>
... ...
... ... @@ -3,8 +3,8 @@
{{#isEqualOr ../numOfOneRow '2'}}
<a{{#isEqualOr ../jump2Shop '1'}} href="{{href}}"{{/isEqualOr}}class="pull-left shop-box">
<div class="shop-img">
<img class="left-icon" src="{{image2 ../lefTopImg q=85}}" alt="">
<img src="{{image2 picture w=284 h=320 q=85}}" alt="">
<img class="left-icon lazy" data-original="{{image2 ../lefTopImg q=85}}" alt="">
<img class="lazy" data-original="{{image2 picture w=284 h=320 q=85}}" alt="">
</div>
<div class="shop-bottom-bar" style="background-image: url({{image2 ../brandImg w=290 h=60 q=85}})">
<span class="shop-name">{{shop_name}}</span>
... ... @@ -13,8 +13,8 @@
{{^}}
<a{{#isEqualOr ../jump2Shop '1'}} href="{{href}}"{{/isEqualOr}}class="pull-left shop-box">
<div class="shop-img">
<img class="left-icon" src="{{image2 ../lefTopImg q=85}}" alt="">
<img src="{{image2 picture w=188 h=210 q=85}}" alt="">
<img class="left-icon lazy" data-original="{{image2 ../lefTopImg q=85}}" alt="">
<img class="lazy" data-original="{{image2 picture w=188 h=210 q=85}}" alt="">
</div>
<div class="shop-bottom-bar" style="background-image: url({{image2 ../brandImg w=290 h=60 q=85}});">
<span class="shop-name">{{shop_name}}</span>
... ...
... ... @@ -123,7 +123,7 @@ module.exports = {
notifyUrl: domains.service + 'payment/weixin_notify',
},
geetestJs: '//static.geetest.com/static/tools/gt.js',
jsSdk: '//cdn.yoho.cn/js-sdk/1.3.5/jssdk.js',
jsSdk: '//cdn.yoho.cn/js-sdk/1.3.6/jssdk.js',
redis: {
connect: {
host: '192.168.102.49',
... ...
... ... @@ -3,8 +3,8 @@
{{#is-equal-or ../numOfOneRow '2'}}
<a href="{{href}}" class="pull-left shop-box">
<div class="shop-img">
<img class="left-icon" src="{{image2 ../lefTopImg q=85}}" alt="">
<img src="{{image2 shop_logo w=187 h=275 q=85}}" alt="">
<img class="left-icon lazy" data-original="{{image2 ../lefTopImg q=85}}" alt="">
<img class="lazy" data-original="{{image2 shop_logo w=187 h=275 q=85}}" alt="">
</div>
<div class="shop-bottom-bar" style="background-image: url({{image2 ../brandImg w=290 h=60 q=85}})">
<span class="shop-name" style="{{#if ../shopNameFontColor}}color: {{../shopNameFontColor}}{{/if}}">{{shop_name}}</span>
... ... @@ -13,8 +13,8 @@
{{^}}
<a href="{{href}}" class="pull-left shop-box {{#is-equal-or ../displayStyle '0'}}shop-logo{{/is-equal-or}}">
<div class="shop-img">
<img class="left-icon" src="{{image2 ../lefTopImg q=85}}" alt="">
<img src="{{image2 shop_logo w=156 h=106 q=85}}" {{#is-equal-or ../displayStyle '0'}}class="shop-logo-img"{{/is-equal-or}} alt="">
<img class="left-icon lazy" data-original="{{image2 ../lefTopImg q=85}}" alt="">
<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="">
<span class="shop-name" style="{{#if ../shopNameFontColor}}color: {{../shopNameFontColor}}{{/if}}">{{shop_name}}</span>
</div>
<div class="shop-bottom-bar" style="background-image: url({{image2 ../brandImg w=290 h=60 q=85}});">
... ...
const $ = require('yoho-jquery');
const lazyLoad = require('yoho-jquery-lazyload');
const lazyLoad = require('plugin/lazyload');
const Swiper = require('yoho-swiper');
const yoho = require('yoho-app');
const qs = require('yoho-qs');
... ... @@ -11,7 +11,7 @@ global.jQuery = $;
let isAndroid = /(Android)/i.test(navigator.userAgent);
let isWechat = /micromessenger/i.test(navigator.userAgent);
lazyLoad($('img.lazy'), { q: 85 });
lazyLoad($('img.lazy'));
function swiperInit() {
$('.swiper-container').each(function() {
... ... @@ -297,6 +297,7 @@ function shopGroupInit() {
});
$this.replaceWith(shopTmpl(config));
lazyLoad($('img.lazy'));
} else {
$this.remove();
}
... ...