Showing
4 changed files
with
15 additions
and
16 deletions
@@ -7,8 +7,7 @@ const _getProductBySkns = function(productObj) { | @@ -7,8 +7,7 @@ const _getProductBySkns = function(productObj) { | ||
7 | productSkn: productObj.defaultSkns, | 7 | productSkn: productObj.defaultSkns, |
8 | method: 'h5.product.batch' | 8 | method: 'h5.product.batch' |
9 | }).then((result) => { | 9 | }).then((result) => { |
10 | - let nskns = []; | ||
11 | - | 10 | + productObj.defaultPros = []; |
12 | if (result && result.data && result.data.product_list && result.code === 200) { | 11 | if (result && result.data && result.data.product_list && result.code === 200) { |
13 | result.data.product_list.forEach(function(val) { | 12 | result.data.product_list.forEach(function(val) { |
14 | var goods_id = Array.isArray(val.goods_list) && val.goods_list.length ? val.goods_list[0].goods_id : null; | 13 | var goods_id = Array.isArray(val.goods_list) && val.goods_list.length ? val.goods_list[0].goods_id : null; |
@@ -27,11 +26,8 @@ const _getProductBySkns = function(productObj) { | @@ -27,11 +26,8 @@ const _getProductBySkns = function(productObj) { | ||
27 | obj.brandurl = `//m.yohobuy.com/product/index/brand?domain=${val.brand_domain}&openby:yohobuy={"action":"go.brand","params":{"brand_id":${val.brand_id}}}`; | 26 | obj.brandurl = `//m.yohobuy.com/product/index/brand?domain=${val.brand_domain}&openby:yohobuy={"action":"go.brand","params":{"brand_id":${val.brand_id}}}`; |
28 | } | 27 | } |
29 | 28 | ||
30 | - nskns.push(obj); | 29 | + productObj.defaultPros.push(obj); |
31 | }); | 30 | }); |
32 | - productObj.defaultSkns = nskns; | ||
33 | - } else { | ||
34 | - delete productObj.defaultSkns; | ||
35 | } | 31 | } |
36 | }); | 32 | }); |
37 | }; | 33 | }; |
@@ -66,10 +66,10 @@ | @@ -66,10 +66,10 @@ | ||
66 | {{#isEqualOr type 'productGroup'}} | 66 | {{#isEqualOr type 'productGroup'}} |
67 | {{! 商品池}} | 67 | {{! 商品池}} |
68 | <div class="product-container item{{numOfOneRow}}" {{#if proBgImg}}style="background:url({{proBgImg}})repeat;"{{/if}}> | 68 | <div class="product-container item{{numOfOneRow}}" {{#if proBgImg}}style="background:url({{proBgImg}})repeat;"{{/if}}> |
69 | - <div class="product-source" {{#if searchCondition}}cloneitem="{{searchCondition.limit}}" condition='{{stringify searchCondition}}'{{/if}} fp="{{getAnalysis ../this @index}}"> | 69 | + <div class="product-source" {{#unless defaultPros.length}} {{#if searchCondition }}cloneitem="{{searchCondition.limit}}"{{/if}}{{/unless}} condition='{{stringify searchCondition}}' fp="{{getAnalysis ../this @index}}"> |
70 | <input class="imgwh" type="hidden" value="193x257"> | 70 | <input class="imgwh" type="hidden" value="193x257"> |
71 | - {{#ifand defaultSkns defaultSkns.length}} | ||
72 | - {{#defaultSkns}} | 71 | + {{#if defaultPros.length}} |
72 | + {{#defaultPros}} | ||
73 | <div class="feature-product-info {{#if ../condition}}novisible{{/if}}"> | 73 | <div class="feature-product-info {{#if ../condition}}novisible{{/if}}"> |
74 | <a class="first-part product-detail" href='{{producturl}}'> | 74 | <a class="first-part product-detail" href='{{producturl}}'> |
75 | <div class="product-detail-imgbox"> | 75 | <div class="product-detail-imgbox"> |
@@ -94,7 +94,7 @@ | @@ -94,7 +94,7 @@ | ||
94 | </a> | 94 | </a> |
95 | {{/if}} | 95 | {{/if}} |
96 | </div> | 96 | </div> |
97 | - {{/defaultSkns}} | 97 | + {{/defaultPros}} |
98 | {{else}} | 98 | {{else}} |
99 | <div class="feature-product-info novisible"> | 99 | <div class="feature-product-info novisible"> |
100 | <a class="first-part product-detail" href=''> | 100 | <a class="first-part product-detail" href=''> |
@@ -103,7 +103,7 @@ | @@ -103,7 +103,7 @@ | ||
103 | {{#if rigTopImg}}<img class="rigtopimg" src="{{image2 rigTopImg q=60}}">{{/if}} | 103 | {{#if rigTopImg}}<img class="rigtopimg" src="{{image2 rigTopImg q=60}}">{{/if}} |
104 | <img class="product-detail-img" src=""> | 104 | <img class="product-detail-img" src=""> |
105 | </div> | 105 | </div> |
106 | - {{#isEqualOr showpname '1'}}<p class="product-name"></p>{{/isEqualOr}} | 106 | + {{#isEqualOr showPrdName '1'}}<p class="product-name"></p>{{/isEqualOr}} |
107 | <div class="product-detail-text"> | 107 | <div class="product-detail-text"> |
108 | <div class="price"> | 108 | <div class="price"> |
109 | <span class="sale-price"{{#if fontColor}}style="color:{{fontColor}};"{{/if}}></span> | 109 | <span class="sale-price"{{#if fontColor}}style="color:{{fontColor}};"{{/if}}></span> |
@@ -120,7 +120,7 @@ | @@ -120,7 +120,7 @@ | ||
120 | </a> | 120 | </a> |
121 | {{/if}} | 121 | {{/if}} |
122 | </div> | 122 | </div> |
123 | - {{/ifand}} | 123 | + {{/if}} |
124 | </div> | 124 | </div> |
125 | </div> | 125 | </div> |
126 | {{/isEqualOr}} | 126 | {{/isEqualOr}} |
@@ -9,7 +9,7 @@ var isWechat = /micromessenger/i.test(navigator.userAgent); | @@ -9,7 +9,7 @@ var isWechat = /micromessenger/i.test(navigator.userAgent); | ||
9 | function swiperInit() { | 9 | function swiperInit() { |
10 | $('.swiper-container').each(function() { | 10 | $('.swiper-container').each(function() { |
11 | var opt = { | 11 | var opt = { |
12 | - loop: $(this).data('loop') === '1' ? true : false, | 12 | + loop: $(this).data('loop') === 1 ? true : false, |
13 | slidesPerView: 'auto' | 13 | slidesPerView: 'auto' |
14 | }; | 14 | }; |
15 | var spacebetween = $(this).data('spacebetween'); | 15 | var spacebetween = $(this).data('spacebetween'); |
@@ -58,14 +58,17 @@ module.exports = { | @@ -58,14 +58,17 @@ module.exports = { | ||
58 | return style; | 58 | return style; |
59 | }, | 59 | }, |
60 | stringify: function(obj) { | 60 | stringify: function(obj) { |
61 | + if (!obj) { | ||
62 | + return ''; | ||
63 | + } | ||
61 | return JSON.stringify(obj); | 64 | return JSON.stringify(obj); |
62 | }, | 65 | }, |
63 | repeat: function(n, options) { | 66 | repeat: function(n, options) { |
64 | if (n) { | 67 | if (n) { |
65 | - var str = ''; | 68 | + let str = ''; |
66 | 69 | ||
67 | - for (var i = 0; i < n; i++) { | ||
68 | - var opt = { | 70 | + for (let i = 0; i < n; i++) { |
71 | + let opt = { | ||
69 | index: i, | 72 | index: i, |
70 | first: i === 0 | 73 | first: i === 0 |
71 | }; | 74 | }; |
-
Please register or login to post a comment