Merge branch 'feature/new-product-detail' of http://git.yoho.cn/fe/yohobuy-node …
…into feature/new-product-detail
Showing
7 changed files
with
156 additions
and
12 deletions
@@ -308,7 +308,7 @@ const _getSkuDataByProductBaseInfo = (data) => { | @@ -308,7 +308,7 @@ const _getSkuDataByProductBaseInfo = (data) => { | ||
308 | if (good.image_url) { | 308 | if (good.image_url) { |
309 | goodsGroup.thumbs.push({ | 309 | goodsGroup.thumbs.push({ |
310 | url: '', | 310 | url: '', |
311 | - shower: helpers.image(good.image_url, 420, 560), | 311 | + shower: good.image_url, |
312 | img: helpers.image(good.image_url, 75, 100) | 312 | img: helpers.image(good.image_url, 75, 100) |
313 | }); | 313 | }); |
314 | } | 314 | } |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <div class="row activity-wrapper clearfix"> | 2 | <div class="row activity-wrapper clearfix"> |
3 | <span class="title pull-left">促 销: </span> | 3 | <span class="title pull-left">促 销: </span> |
4 | 4 | ||
5 | - {{#if_cond activity.length '>=' 3}} | 5 | + {{#if_cond activity.length '>' 3}} |
6 | <div class="activity-title">展开全部促销 <span class="iconfont index"></span> </div> | 6 | <div class="activity-title">展开全部促销 <span class="iconfont index"></span> </div> |
7 | <div class="activity-container"></div> | 7 | <div class="activity-container"></div> |
8 | {{/if_cond}} | 8 | {{/if_cond}} |
@@ -29,7 +29,16 @@ | @@ -29,7 +29,16 @@ | ||
29 | {{/ isPresell}} | 29 | {{/ isPresell}} |
30 | {{/ tags}} | 30 | {{/ tags}} |
31 | </div> | 31 | </div> |
32 | - <img id="img-show" class="img-show" src="{{img}}"> | 32 | + |
33 | + <div id="min-img" class="position:relation;z-index:1"> | ||
34 | + <img id="img-show" class="img-show" src="{{img}}"> | ||
35 | + <div class="move-object hide"></div> | ||
36 | + <div class="move-over"></div> | ||
37 | + <div id="max" class="max hide"> | ||
38 | + <img id='big' src=""> | ||
39 | + </div> | ||
40 | + </div> | ||
41 | + | ||
33 | <div class="share-row"><span class="title pull-left">分享:</span> {{> common/share }} </div> | 42 | <div class="share-row"><span class="title pull-left">分享:</span> {{> common/share }} </div> |
34 | </div> | 43 | </div> |
35 | <div id="thumbs" class="pull-right thumbs"> | 44 | <div id="thumbs" class="pull-right thumbs"> |
@@ -37,7 +46,8 @@ | @@ -37,7 +46,8 @@ | ||
37 | <div class="thumb-wrap{{#unless focus}} hide{{/unless}}"> | 46 | <div class="thumb-wrap{{#unless focus}} hide{{/unless}}"> |
38 | {{#if focus}} | 47 | {{#if focus}} |
39 | {{# thumbs}} | 48 | {{# thumbs}} |
40 | - <img class="thumb" src="{{img}}" data-shower="{{shower}}"> | 49 | + <img class="thumb" src="{{img}}" data-shower="{{image shower 420 560}}" |
50 | + data-origin="{{image shower 1001 1333}}"> | ||
41 | {{/ thumbs}} | 51 | {{/ thumbs}} |
42 | {{^}} | 52 | {{^}} |
43 | {{# thumbs}} | 53 | {{# thumbs}} |
@@ -24,8 +24,8 @@ module.exports = { | @@ -24,8 +24,8 @@ module.exports = { | ||
24 | api: 'http://api.yoho.cn/', | 24 | api: 'http://api.yoho.cn/', |
25 | service: 'http://service.yoho.cn/', | 25 | service: 'http://service.yoho.cn/', |
26 | 26 | ||
27 | - // api: 'http://dev-api.yohops.com:9999/', | ||
28 | - // service: 'http://dev-service.yohops.com:9999/', | 27 | + //api: 'http://dev-api.yohops.com:9999/', |
28 | + //service: 'http://dev-service.yohops.com:9999/', | ||
29 | 29 | ||
30 | search: 'http://192.168.102.216:8080/yohosearch/' | 30 | search: 'http://192.168.102.216:8080/yohosearch/' |
31 | }, | 31 | }, |
public/img/product/move.png
0 → 100644
1.33 KB
@@ -159,6 +159,96 @@ bindEvent.add(function() { | @@ -159,6 +159,96 @@ bindEvent.add(function() { | ||
159 | $imgShow.attr('src', src); | 159 | $imgShow.attr('src', src); |
160 | } | 160 | } |
161 | 161 | ||
162 | + function bigImgShow(src) { | ||
163 | + $('#big').attr('src', src); | ||
164 | + } | ||
165 | + | ||
166 | + // 查看详情功能 | ||
167 | + var moveWidth = 135; | ||
168 | + var w = 420; | ||
169 | + var h = 560; | ||
170 | + var _w = 1000; | ||
171 | + var radio = w / _w; | ||
172 | + var $moveObj = $('.move-object'); | ||
173 | + var $max = $('.max'); | ||
174 | + | ||
175 | + function move(e) { | ||
176 | + var x = e.pageX - $imgShow.offset().left; | ||
177 | + var y = e.pageY - $imgShow.offset().top; | ||
178 | + | ||
179 | + var _x = x - moveWidth / 2; | ||
180 | + var _y = y - moveWidth / 2; | ||
181 | + | ||
182 | + var _maxX = w - moveWidth; | ||
183 | + var _maxY = h - moveWidth; | ||
184 | + | ||
185 | + if (_x < 0) { | ||
186 | + _x = 0; | ||
187 | + } else if (_x >= _maxX) { | ||
188 | + _x = _maxX; | ||
189 | + } | ||
190 | + | ||
191 | + if (_y < 0) { | ||
192 | + _y = 0; | ||
193 | + } else if (_y >= _maxY) { | ||
194 | + _y = _maxY; | ||
195 | + } | ||
196 | + | ||
197 | + var offX = _x / radio; | ||
198 | + var offY = _y / radio; | ||
199 | + | ||
200 | + $moveObj.css({ | ||
201 | + left: _x, | ||
202 | + top: _y | ||
203 | + }); | ||
204 | + | ||
205 | + $max.get(0).scrollLeft = offX; | ||
206 | + $max.get(0).scrollTop = offY; | ||
207 | + } | ||
208 | + | ||
209 | + $('.move-over').mouseleave(function() { | ||
210 | + $('.move-object').addClass('hide'); | ||
211 | + $max.addClass('hide'); | ||
212 | + }); | ||
213 | + | ||
214 | + $('.move-over').mousemove(function(e) { | ||
215 | + if ($moveObj.hasClass('hide')) { | ||
216 | + $moveObj.removeClass('hide'); | ||
217 | + } | ||
218 | + | ||
219 | + if ($max.hasClass('hide')) { | ||
220 | + $max.removeClass('hide'); | ||
221 | + } | ||
222 | + | ||
223 | + move(e); | ||
224 | + }); | ||
225 | + | ||
226 | + //促销弹出框 | ||
227 | + var icon = { | ||
228 | + unfold: '', | ||
229 | + fold: '' | ||
230 | + }; | ||
231 | + | ||
232 | + $('.activity-title').click(function() { | ||
233 | + $(this).toggleClass('active'); | ||
234 | + $('.activity-container').empty(); | ||
235 | + | ||
236 | + if ($(this).hasClass('active')) { | ||
237 | + $(this).find('span').html(icon.fold); | ||
238 | + | ||
239 | + if (!$('.activity-container').html()) { | ||
240 | + $('.activity-container').append($('.activity').clone().find('li').each(function() { | ||
241 | + $(this).removeClass('hide'); | ||
242 | + }).end()); | ||
243 | + } | ||
244 | + | ||
245 | + $('.activity-container').slideDown(400); | ||
246 | + } else { | ||
247 | + $(this).find('span').html(icon.unfold); | ||
248 | + $('.activity-container').slideUp(400); | ||
249 | + } | ||
250 | + }); | ||
251 | + | ||
162 | function getCouponAsync(cid) { | 252 | function getCouponAsync(cid) { |
163 | var uid = getUid(); // eslint-disable-line | 253 | var uid = getUid(); // eslint-disable-line |
164 | 254 | ||
@@ -325,7 +415,14 @@ bindEvent.add(function() { | @@ -325,7 +415,14 @@ bindEvent.add(function() { | ||
325 | 415 | ||
326 | // 缩略图鼠标移入显示 | 416 | // 缩略图鼠标移入显示 |
327 | $('#thumbs').on('mouseenter', '.thumb', function() { | 417 | $('#thumbs').on('mouseenter', '.thumb', function() { |
328 | - imgShow($(this).data('shower')); | 418 | + var $this = $(this); |
419 | + | ||
420 | + imgShow($this.data('shower')); | ||
421 | + bigImgShow($this.data('origin')); | ||
422 | + | ||
423 | + if (!$this.hasClass('active')) { | ||
424 | + $this.siblings('.active').removeClass('active').end().addClass('active'); | ||
425 | + } | ||
329 | }); | 426 | }); |
330 | 427 | ||
331 | // 尺码 | 428 | // 尺码 |
@@ -145,9 +145,14 @@ | @@ -145,9 +145,14 @@ | ||
145 | 145 | ||
146 | .thumb { | 146 | .thumb { |
147 | display: block; | 147 | display: block; |
148 | - width: 75px; | 148 | + width: 71px; |
149 | cursor: pointer; | 149 | cursor: pointer; |
150 | - margin-bottom: 2px; | 150 | + margin-bottom: 15px; |
151 | + border: 2px solid white; | ||
152 | + | ||
153 | + &.active { | ||
154 | + border: 2px solid black; | ||
155 | + } | ||
151 | } | 156 | } |
152 | 157 | ||
153 | .name { | 158 | .name { |
@@ -332,10 +337,11 @@ | @@ -332,10 +337,11 @@ | ||
332 | 337 | ||
333 | .activity-container { | 338 | .activity-container { |
334 | position: absolute; | 339 | position: absolute; |
335 | - width: 100%; | ||
336 | - height: 10px; | ||
337 | - background: #b3b3b3; | 340 | + left: 72px; |
341 | + width: calc(585px - 72px); | ||
342 | + background: #f5f5f5; | ||
338 | z-index: 5; | 343 | z-index: 5; |
344 | + display: none; | ||
339 | } | 345 | } |
340 | } | 346 | } |
341 | 347 | ||
@@ -2180,6 +2186,37 @@ | @@ -2180,6 +2186,37 @@ | ||
2180 | } | 2186 | } |
2181 | } | 2187 | } |
2182 | 2188 | ||
2189 | +/****放大镜****/ | ||
2190 | +.move-object { | ||
2191 | + height: 135px; | ||
2192 | + width: 135px; | ||
2193 | + background: resolve("product/move.png") no-repeat; | ||
2194 | + top: 0; | ||
2195 | + right: 0; | ||
2196 | + position: absolute; | ||
2197 | +} | ||
2198 | + | ||
2199 | +.max { | ||
2200 | + width: 560px; | ||
2201 | + height: 560px; | ||
2202 | + border: 2px solid #b0b0b0; | ||
2203 | + display: block; | ||
2204 | + position: absolute; | ||
2205 | + overflow: hidden; | ||
2206 | + left: 515px; | ||
2207 | + top: 0; | ||
2208 | + z-index: 100; | ||
2209 | +} | ||
2210 | + | ||
2211 | +.move-over { | ||
2212 | + position: absolute; | ||
2213 | + width: 420px; | ||
2214 | + height: 560px; | ||
2215 | + z-index: 2; | ||
2216 | + top: 0; | ||
2217 | + left: 0; | ||
2218 | +} | ||
2219 | + | ||
2183 | /****套餐弹出框***/ | 2220 | /****套餐弹出框***/ |
2184 | .pkg-dialog { | 2221 | .pkg-dialog { |
2185 | width: 500px; | 2222 | width: 500px; |
-
Please register or login to post a comment