Authored by 徐炜

sale 优化

1 {{#data}} 1 {{#data}}
2 -{{#if ../discountActivity}}  
3 - {{> common/floor-header-more}}  
4 -{{/if}}  
5 -<ul class="discount-list">  
6 - {{#list}}  
7 - <li>  
8 - <a href="/product/sale/discount/detail?id={{id}}&channel={{@root.channel}}">  
9 - <img class="lazy" data-original="{{image2 cover_url w=640 h=250 q=60}}" />  
10 - <p class="discount-cont">  
11 - <span class="discount-title">{{title}}</span>  
12 - <span class="discount-time {{#if warn_color}}red-color{{/if}}">{{time}}</span>  
13 - </p>  
14 - </a>  
15 - </li>  
16 - {{/list}}  
17 -</ul> 2 + {{#if ../discountActivity}}
  3 + {{> common/floor-header-more}}
  4 + {{/if}}
  5 + <ul class="discount-list">
  6 + {{#list}}
  7 + <li>
  8 + <a href="/product/sale/discount/detail?id={{id}}&channel={{@root.channel}}">
  9 + {{#within @index 3}}
  10 + <img src="{{image2 cover_url w=640 h=250 q=60}}"/>
  11 + {{^}}
  12 + <img class="lazy" data-original="{{image2 cover_url w=640 h=250 q=60}}"/>
  13 + {{/within}}
  14 + <p class="discount-cont">
  15 + <span class="discount-title">{{title}}</span>
  16 + <span class="discount-time {{#if warn_color}}red-color{{/if}}">{{time}}</span>
  17 + </p>
  18 + </a>
  19 + </li>
  20 + {{/list}}
  21 + </ul>
18 {{/data}} 22 {{/data}}
@@ -60,5 +60,19 @@ module.exports = { @@ -60,5 +60,19 @@ module.exports = {
60 } else { 60 } else {
61 return opt.inverse(this); 61 return opt.inverse(this);
62 } 62 }
  63 + },
  64 +
  65 + /**
  66 + * 小于某zhi
  67 + *
  68 + * @param variable
  69 + * @param number
  70 + */
  71 + within: function(variable, number, opt) {
  72 + if (variable < number) {
  73 + return opt.fn(this);
  74 + } else {
  75 + return opt.inverse(this);
  76 + }
63 } 77 }
64 }; 78 };