Showing
6 changed files
with
98 additions
and
123 deletions
@@ -32,7 +32,7 @@ export default { | @@ -32,7 +32,7 @@ export default { | ||
32 | simplevars(), | 32 | simplevars(), |
33 | nested(), | 33 | nested(), |
34 | cssnext({ warnForDuplicates: false, }), | 34 | cssnext({ warnForDuplicates: false, }), |
35 | - cssnano(), | 35 | + cssnano({zindex: false}), |
36 | ], | 36 | ], |
37 | extensions: ['.css'], | 37 | extensions: ['.css'], |
38 | }), | 38 | }), |
@@ -120,86 +120,68 @@ | @@ -120,86 +120,68 @@ | ||
120 | <img src="http://img02.yohoboys.com/staticimg/2016/04/22/14/02a8b1c09363f84c34aa56d11bb5cd7eb4.png"> | 120 | <img src="http://img02.yohoboys.com/staticimg/2016/04/22/14/02a8b1c09363f84c34aa56d11bb5cd7eb4.png"> |
121 | </a> | 121 | </a> |
122 | <a class="anchor" href='http://union.yoho.cn/union/downapp.html'></a> | 122 | <a class="anchor" href='http://union.yoho.cn/union/downapp.html'></a> |
123 | - <input id="imgwh" type="hidden" name="" value="200x300"> | ||
124 | - <div class="feature-product-info"> | ||
125 | - <a class="product-brand" href="xxx"> | ||
126 | - <span class="brand-name">xxx</span> | ||
127 | - <span class="brand-go">进入店铺</span> | ||
128 | - </a> | ||
129 | - <a class="product-detail" href="xxx"> | ||
130 | - <div> | ||
131 | - <img class="product-detail-img" src="xxx"> | ||
132 | - </div> | ||
133 | - <div class="product-detail-text"> | ||
134 | - <div class="name"> | ||
135 | - <span class="product-name">xxx</span> | 123 | + <div class="product-source" condition='{"sort":"123,3213,3123,3123","enum":1, "pid":1}'> |
124 | + <input id="imgwh" type="hidden" value="200x300"> | ||
125 | + <div class="feature-product-info"> | ||
126 | + <a class="product-brand" href="xxx"> | ||
127 | + <span class="brand-name">xxx</span> | ||
128 | + <span class="brand-go">进入店铺</span> | ||
129 | + </a> | ||
130 | + <a class="product-detail" href="xxx"> | ||
131 | + <div> | ||
132 | + <img class="product-detail-img" src="xxx"> | ||
136 | </div> | 133 | </div> |
137 | - <div class="price"> | ||
138 | - <span class="sale-price">xxx</span> | ||
139 | - <span class="market-price">xxx</span> | 134 | + <div class="product-detail-text"> |
135 | + <div class="name"> | ||
136 | + <span class="product-name">xxx</span> | ||
137 | + </div> | ||
138 | + <div class="price"> | ||
139 | + <span class="sale-price">xxx</span> | ||
140 | + <span class="market-price">xxx</span> | ||
141 | + </div> | ||
140 | </div> | 142 | </div> |
141 | - </div> | ||
142 | - </a> | ||
143 | - </div> | ||
144 | - <div class="feature-product-info"> | ||
145 | - <a class="product-brand" href=""> | ||
146 | - <span class="brand-name"></span> | ||
147 | - <span class="brand-go">进入店铺</span> | ||
148 | - </a> | ||
149 | - <a class="product-detail" href=""> | ||
150 | - <div> | ||
151 | - <img class="product-detail-img" src=""> | ||
152 | - </div> | ||
153 | - <div class="product-detail-text"> | ||
154 | - <div class="name"> | ||
155 | - <span class="product-name"></span> | ||
156 | - </div> | ||
157 | - <div class="price"> | ||
158 | - <span class="sale-price"></span> | ||
159 | - <span class="market-price"></span> | 143 | + </a> |
144 | + </div> | ||
145 | + <div class="feature-product-info"> | ||
146 | + <a class="product-brand" href=""> | ||
147 | + <span class="brand-name"></span> | ||
148 | + <span class="brand-go">进入店铺</span> | ||
149 | + </a> | ||
150 | + <a class="product-detail" href=""> | ||
151 | + <div> | ||
152 | + <img class="product-detail-img" src=""> | ||
160 | </div> | 153 | </div> |
161 | - </div> | ||
162 | - </a> | ||
163 | - </div> | ||
164 | - <div class="feature-product-info"> | ||
165 | - <a class="product-brand" href=""> | ||
166 | - <span class="brand-name"></span> | ||
167 | - <span class="brand-go">进入店铺</span> | ||
168 | - </a> | ||
169 | - <a class="product-detail" href=""> | ||
170 | - <div> | ||
171 | - <img class="product-detail-img" src=""> | ||
172 | - </div> | ||
173 | - <div class="product-detail-text"> | ||
174 | - <div class="name"> | ||
175 | - <span class="product-name"></span> | 154 | + <div class="product-detail-text"> |
155 | + <div class="name"> | ||
156 | + <span class="product-name"></span> | ||
157 | + </div> | ||
158 | + <div class="price"> | ||
159 | + <span class="sale-price"></span> | ||
160 | + <span class="market-price"></span> | ||
161 | + </div> | ||
176 | </div> | 162 | </div> |
177 | - <div class="price"> | ||
178 | - <span class="sale-price"></span> | ||
179 | - <span class="market-price"></span> | ||
180 | - </div> | ||
181 | - </div> | ||
182 | - </a> | ||
183 | - </div> | ||
184 | - <div class="feature-product-info"> | ||
185 | - <a class="product-brand" href=""> | ||
186 | - <span class="brand-name"></span> | ||
187 | - <span class="brand-go">进入店铺</span> | ||
188 | - </a> | ||
189 | - <a class="product-detail" href=""> | ||
190 | - <div> | ||
191 | - <img class="product-detail-img" src=""> | ||
192 | - </div> | ||
193 | - <div class="product-detail-text"> | ||
194 | - <div class="name"> | ||
195 | - <span class="product-name"></span> | 163 | + </a> |
164 | + </div> | ||
165 | + <div class="feature-product-info"> | ||
166 | + <a class="product-brand" href=""> | ||
167 | + <span class="brand-name"></span> | ||
168 | + <span class="brand-go">进入店铺</span> | ||
169 | + </a> | ||
170 | + <a class="product-detail" href=""> | ||
171 | + <div> | ||
172 | + <img class="product-detail-img" src=""> | ||
196 | </div> | 173 | </div> |
197 | - <div class="price"> | ||
198 | - <span class="sale-price"></span> | ||
199 | - <span class="market-price"></span> | 174 | + <div class="product-detail-text"> |
175 | + <div class="name"> | ||
176 | + <span class="product-name"></span> | ||
177 | + </div> | ||
178 | + <div class="price"> | ||
179 | + <span class="sale-price"></span> | ||
180 | + <span class="market-price"></span> | ||
181 | + </div> | ||
200 | </div> | 182 | </div> |
201 | - </div> | ||
202 | - </a> | 183 | + </a> |
184 | + </div> | ||
203 | </div> | 185 | </div> |
204 | <script src="//cdn.bootcss.com/jquery/1.8.3/jquery.min.js"></script> | 186 | <script src="//cdn.bootcss.com/jquery/1.8.3/jquery.min.js"></script> |
205 | <script src="../dist/js-sdk/1.0.0/jssdk.js"></script> | 187 | <script src="../dist/js-sdk/1.0.0/jssdk.js"></script> |
@@ -4,38 +4,46 @@ import utils from './utils'; | @@ -4,38 +4,46 @@ import utils from './utils'; | ||
4 | import cookies from './cookies'; | 4 | import cookies from './cookies'; |
5 | 5 | ||
6 | let _getProduct = function(param) { | 6 | let _getProduct = function(param) { |
7 | - jsonp({ | ||
8 | - url: '//m.yohobuy.com/activity/individuation?callback=?', | ||
9 | - data: param | ||
10 | - }).then((res)=> { | ||
11 | - if (res && res.length) { | ||
12 | - let data, | ||
13 | - goods = $('.feature-product-info'); | 7 | + $('.product-source').each(function(indx, el){ |
8 | + el = $(el); | ||
9 | + let cond = JSON.parse(el.attr('condition') || '{}'); | ||
14 | 10 | ||
15 | - if (!goods.length) { | ||
16 | - return; | ||
17 | - } | 11 | + jsonp({ |
12 | + url: '//m.yohobuy.com/activity/individuation?callback=?', | ||
13 | + data: Object.assign({}, param, cond) | ||
14 | + }).then((res)=> { | ||
15 | + if (res && res.length) { | ||
16 | + let data, | ||
17 | + goods = el.find('.feature-product-info'); | ||
18 | 18 | ||
19 | - // 获取图片宽x高 | ||
20 | - let imgwh = $('#imgwh').val() || ''; | ||
21 | - imgwh = imgwh.split('x') || []; | 19 | + if (!goods.length) { |
20 | + return; | ||
21 | + } | ||
22 | 22 | ||
23 | - let w = imgwh[0] || 450, | ||
24 | - h = imgwh[1] || 500; | 23 | + // 获取图片宽x高 |
24 | + let imgwh = el.find('#imgwh').val() || ''; | ||
25 | + imgwh = imgwh.split('x') || []; | ||
25 | 26 | ||
26 | - goods.each(function(idex, el) { | ||
27 | - data = res[idex]; | ||
28 | - el = $(el); | 27 | + let w = imgwh[0] || 450, |
28 | + h = imgwh[1] || 500; | ||
29 | 29 | ||
30 | - el.find('.brand-name').html(data.brand_name); | ||
31 | - el.find('a.product-brand').attr('href', `//m.yohobuy.com/product/index/brand?domain=${data.brand_domain}`); | ||
32 | - el.find('a.product-detail').attr('href', `//m.yohobuy.com/product/pro_${data.product_id}_${data.goods_id}/${data.cn_alphabet}.html?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${data.product_skn}}}`); | ||
33 | - el.find('.product-detail-img').attr('src', utils.image(data.default_images, w, h, 2, 60)); | ||
34 | - el.find('.product-name').html(data.product_name); | ||
35 | - el.find('.sale-price').html(`¥${data.sales_price}`); | ||
36 | - el.find('.market-price').html(`¥${data.market_price}`); | ||
37 | - }); | ||
38 | - } | 30 | + goods.each(function(indx, el) { |
31 | + data = res[indx]; | ||
32 | + if (!data) { | ||
33 | + return; | ||
34 | + } | ||
35 | + | ||
36 | + el = $(el); | ||
37 | + el.find('.brand-name').html(data.brand_name); | ||
38 | + el.find('a.product-brand').attr('href', `//m.yohobuy.com/product/index/brand?domain=${data.brand_domain}`); | ||
39 | + el.find('a.product-detail').attr('href', `//m.yohobuy.com/product/pro_${data.product_id}_${data.goods_id}/${data.cn_alphabet}.html?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${data.product_skn}}}`); | ||
40 | + el.find('.product-detail-img').attr('src', utils.image(data.default_images, w, h, 2, 60)); | ||
41 | + el.find('.product-name').html(data.product_name); | ||
42 | + el.find('.sale-price').html(`¥${data.sales_price}`); | ||
43 | + el.find('.market-price').html(`¥${data.market_price}`); | ||
44 | + }); | ||
45 | + } | ||
46 | + }); | ||
39 | }); | 47 | }); |
40 | }; | 48 | }; |
41 | 49 |
@@ -65,6 +65,9 @@ let _bindEvent = function() { | @@ -65,6 +65,9 @@ let _bindEvent = function() { | ||
65 | $tipTmpl.fadeOut(); | 65 | $tipTmpl.fadeOut(); |
66 | e.preventDefault(); | 66 | e.preventDefault(); |
67 | }); | 67 | }); |
68 | + $body.on('click', '.featuretip .refresh', function() { | ||
69 | + location.reload(); | ||
70 | + }); | ||
68 | $body.on('click', '.featuretip.tip-wrap', function(e) { | 71 | $body.on('click', '.featuretip.tip-wrap', function(e) { |
69 | if ('featuretip tip-wrap' === e.target.className) { | 72 | if ('featuretip tip-wrap' === e.target.className) { |
70 | $tipTmpl.fadeOut(); | 73 | $tipTmpl.fadeOut(); |
@@ -73,21 +76,6 @@ let _bindEvent = function() { | @@ -73,21 +76,6 @@ let _bindEvent = function() { | ||
73 | }); | 76 | }); |
74 | }; | 77 | }; |
75 | 78 | ||
76 | -let _bindUnionType = function() { | ||
77 | - let qs = _queryString(); | ||
78 | - let union_type = qs.mkt_code || qs.union_type; | ||
79 | - | ||
80 | - if (union_type) { | ||
81 | - $('a').each(function(indx, el) { | ||
82 | - el = $(el); | ||
83 | - let h = el.attr('href'); | ||
84 | - if (h.indexOf('union.yoho.cn/union/downapp.html') > -1) { | ||
85 | - el.attr('href', h + '?union_type=' + union_type); | ||
86 | - } | ||
87 | - }); | ||
88 | - } | ||
89 | -}; | ||
90 | - | ||
91 | export default { | 79 | export default { |
92 | queryString: _queryString, | 80 | queryString: _queryString, |
93 | init() { | 81 | init() { |
@@ -96,9 +84,6 @@ export default { | @@ -96,9 +84,6 @@ export default { | ||
96 | 84 | ||
97 | // 绑定事件 | 85 | // 绑定事件 |
98 | _bindEvent(); | 86 | _bindEvent(); |
99 | - | ||
100 | - // 下载链接绑定union_type | ||
101 | - _bindUnionType(); | ||
102 | }, | 87 | }, |
103 | isApp() { | 88 | isApp() { |
104 | let qs = _queryString(); | 89 | let qs = _queryString(); |
@@ -129,7 +114,7 @@ export default { | @@ -129,7 +114,7 @@ export default { | ||
129 | if (data.close) { | 114 | if (data.close) { |
130 | $tipTmpl.find('.button').addClass('close'); | 115 | $tipTmpl.find('.button').addClass('close'); |
131 | } else { | 116 | } else { |
132 | - $tipTmpl.find('.button').html('刷新'); | 117 | + $tipTmpl.find('.button').addClass('refresh').html('刷新'); |
133 | } | 118 | } |
134 | 119 | ||
135 | $('body').append($tipTmpl); | 120 | $('body').append($tipTmpl); |
-
Please register or login to post a comment