Authored by 毕凯

Merge branch 'feature/imgq' into 'master'

活动图片质量调整



See merge request !610
... ... @@ -22,9 +22,9 @@
style="{{#if param.bgcolor}}background-color:{{param.bgcolor}}{{/if}}">
{{#if param.bgimg}}
{{#isLazyLoad type @index}}
<img class="lazy" data-original="{{image2 param.bgimg q=75}}">
<img class="lazy" data-original="{{imageslim param.bgimg}}">
{{else}}
<img src="{{image2 param.bgimg q=75}}">
<img src="{{imageslim param.bgimg}}">
{{/isLazyLoad}}
{{/if}}
{{#component}}
... ... @@ -34,7 +34,7 @@
{{#if modalImg}}
<div class="modal">
<span class="modal-close"></span>
<img class="modal-img lazy" data-original="{{image2 modalImg q=75}}">
<img class="modal-img lazy" data-original="{{imageslim modalImg}}">
</div>
{{/if}}
{{/isEqualOr}}
... ... @@ -66,7 +66,7 @@
<div class="swiper-wrapper">
{{#list}}
<div class="swiper-slide" style="{{styleFormat this percent=1}}">
<img src="{{image2 src q=75}}">
<img src="{{imageslim src}}">
<a class="anchor" href="{{#if link}}{{link}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../../this @index}}"></a>
</div>
{{/list}}
... ... @@ -88,7 +88,7 @@
{{#isEqualOr type 'productGroup'}}
{{! 商品池}}
<div class="product-container item{{numOfOneRow}}" {{#if proBgImg}}style="background:url({{image2 proBgImg q=75}}) repeat;background-size:100%;"{{/if}}>
<div class="product-container item{{numOfOneRow}}" {{#if proBgImg}}style="background:url({{imageslim proBgImg}}) repeat;background-size:100%;"{{/if}}>
<div class="product-source" condition='{{stringify searchCondition}}' fp="{{getAnalysis ../this @index}}"
{{#unless defaultPros.length}}
{{#if searchCondition.item}}
... ... @@ -103,9 +103,9 @@
<div class="feature-product-info {{#if ../searchCondition}}novisible{{/if}}">
<a class="first-part product-detail" href='{{producturl}}'>
<div class="product-detail-imgbox">
{{#if ../lefTopImg}}<img class="leftopimg lazy" data-original="{{image2 ../lefTopImg q=75}}">{{/if}}
{{#if ../rigTopImg}}<img class="rigtopimg lazy" data-original="{{image2 ../rigTopImg q=75}}">{{/if}}
<img class="product-detail-img lazy" data-original="{{image2 productimg q=75}}">
{{#if ../lefTopImg}}<img class="leftopimg lazy" data-original="{{imageslim ../lefTopImg}}">{{/if}}
{{#if ../rigTopImg}}<img class="rigtopimg lazy" data-original="{{imageslim ../rigTopImg}}">{{/if}}
<img class="product-detail-img lazy" data-original="{{imageslim productimg}}">
</div>
{{#isEqualOr ../showPrdName '1'}}<p class="product-name">{{productname}}</p>{{/isEqualOr}}
<div class="product-detail-text">
... ... @@ -128,7 +128,7 @@
<div class="brand-div">
<span class="brand-name"{{#if ../fontColor}}style="color:{{../fontColor}};"{{/if}}>{{brandname}}</span>
</div>
<img class="brand-img lazy" data-original="{{image2 ../brandImg q=75}}">
<img class="brand-img lazy" data-original="{{imageslim ../brandImg}}">
</a>
{{/if}}
</div>
... ... @@ -137,8 +137,8 @@
<div class="feature-product-info novisible">
<a class="first-part product-detail" href=''>
<div class="product-detail-imgbox">
{{#if lefTopImg}}<img class="leftopimg" src="{{image2 lefTopImg q=75}}">{{/if}}
{{#if rigTopImg}}<img class="rigtopimg" src="{{image2 rigTopImg q=75}}">{{/if}}
{{#if lefTopImg}}<img class="leftopimg" src="{{imageslim lefTopImg}}">{{/if}}
{{#if rigTopImg}}<img class="rigtopimg" src="{{imageslim rigTopImg}}">{{/if}}
<img class="product-detail-img" src="">
</div>
{{#isEqualOr showPrdName '1'}}<p class="product-name"></p>{{/isEqualOr}}
... ... @@ -161,7 +161,7 @@
<div class="brand-div">
<span class="brand-name" {{#if fontColor}}style="color:{{fontColor}};"{{/if}}></span>
</div>
<img class="brand-img" src="{{image2 brandImg q=75}}">
<img class="brand-img" src="{{imageslim brandImg}}">
</a>
{{/if}}
</div>
... ...
... ... @@ -143,6 +143,24 @@ module.exports = {
return '';
}
},
/**
* 图片质量调整
*/
imageslim: function(imageUrl) {
if (imageUrl && _.isString(imageUrl)) {
let urls = imageUrl.split('?');
let uri = urls[0];
if (uri.indexOf('http:') === 0) {
uri = uri.replace('http:', '');
}
return uri + '?imageslim';
} else {
return '';
}
},
isEqualOr: function() {
let args = Array.prototype.slice.call(arguments);
let v1 = args[0];
... ...