Authored by lore-w

code review by liuyue

@@ -53,7 +53,7 @@ exports.init = function(num) { @@ -53,7 +53,7 @@ exports.init = function(num) {
53 colorListStr += 53 colorListStr +=
54 '<li>' + 54 '<li>' +
55 '<a href="' + data[i * row + j].url + '">' + 55 '<a href="' + data[i * row + j].url + '">' +
56 - '<img src="' + data[i * row + j].src + '" />' + 56 + '<img src="' + data[i * row + j].src + '" data-cover="' + data[i * row + j].coverImg + '" />' +
57 '</a>' + 57 '</a>' +
58 '</li>'; 58 '</li>';
59 59
@@ -94,9 +94,12 @@ exports.init = function(num) { @@ -94,9 +94,12 @@ exports.init = function(num) {
94 display: 'none' 94 display: 'none'
95 }); 95 });
96 $.ajax({ 96 $.ajax({
97 - type: 'GET',  
98 - url: '/product/index/productColor',  
99 - dataType: 'json' 97 + type: 'POST',
  98 + url: '/product/index/getProductPic',
  99 + dataType: 'json',
  100 + data: {
  101 + skn: event.target.attr('data-skn')
  102 + }
100 }).then(function(data) { 103 }).then(function(data) {
101 104
102 ulStr = createColorList(data).colorListStr; //ajax请求的颜色列表 105 ulStr = createColorList(data).colorListStr; //ajax请求的颜色列表
@@ -141,6 +144,14 @@ exports.init = function(num) { @@ -141,6 +144,14 @@ exports.init = function(num) {
141 }); 144 });
142 }); 145 });
143 146
  147 + //鼠标放在颜色列表上效果
  148 + $(document).on('hover', '.good-select-color li', function() {
  149 + var coverImg = $(this).find('img').attr('data-cover'),
  150 + $coverImg = $(this).closest('.good-item-wrapper').find('.good-detail-img').find('img');
  151 +
  152 + $coverImg.attr('src', coverImg);
  153 + });
  154 +
144 // 左侧导航 155 // 左侧导航
145 $productListNav.click(function() { 156 $productListNav.click(function() {
146 if ($(this).hasClass('active')) { 157 if ($(this).hasClass('active')) {
@@ -322,7 +322,8 @@ class Index1Controller extends AbstractAction @@ -322,7 +322,8 @@ class Index1Controller extends AbstractAction
322 'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90', 322 'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
323 'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋', 323 'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋',
324 'salePrice' => '899', 324 'salePrice' => '899',
325 - 'isFew' => true 325 + 'isFew' => true,
  326 + 'skn' => 123
326 ), 327 ),
327 1 => array( 328 1 => array(
328 'tags' => array( 329 'tags' => array(
@@ -333,7 +334,8 @@ class Index1Controller extends AbstractAction @@ -333,7 +334,8 @@ class Index1Controller extends AbstractAction
333 'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90', 334 'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
334 'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋', 335 'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋',
335 'salePrice' => '899', 336 'salePrice' => '899',
336 - 'showColBtn' => true 337 + 'showColBtn' => true,
  338 + 'skn' => 123
337 ), 339 ),
338 2 => array( 340 2 => array(
339 'tags' => array( 341 'tags' => array(
@@ -343,13 +345,15 @@ class Index1Controller extends AbstractAction @@ -343,13 +345,15 @@ class Index1Controller extends AbstractAction
343 'url' => 'http://adidas.yohobuy.com/?gender=1,3', 345 'url' => 'http://adidas.yohobuy.com/?gender=1,3',
344 'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90', 346 'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
345 'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋', 347 'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋',
346 - 'salePrice' => '899' 348 + 'salePrice' => '899',
  349 + 'skn' => 123
347 ), 350 ),
348 3 => array( 351 3 => array(
349 'url' => 'http://adidas.yohobuy.com/?gender=1,3', 352 'url' => 'http://adidas.yohobuy.com/?gender=1,3',
350 'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90', 353 'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
351 'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋', 354 'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋',
352 - 'salePrice' => '899' 355 + 'salePrice' => '899',
  356 + 'skn' => 123
353 ), 357 ),
354 4 => array( 358 4 => array(
355 'tags' => array( 359 'tags' => array(
@@ -359,7 +363,8 @@ class Index1Controller extends AbstractAction @@ -359,7 +363,8 @@ class Index1Controller extends AbstractAction
359 'url' => 'http://adidas.yohobuy.com/?gender=1,3', 363 'url' => 'http://adidas.yohobuy.com/?gender=1,3',
360 'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90', 364 'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
361 'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋', 365 'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋',
362 - 'salePrice' => '899' 366 + 'salePrice' => '899',
  367 + 'skn' => 123
363 ), 368 ),
364 5 => array( 369 5 => array(
365 'tags' => array( 370 'tags' => array(
@@ -369,7 +374,8 @@ class Index1Controller extends AbstractAction @@ -369,7 +374,8 @@ class Index1Controller extends AbstractAction
369 'url' => 'http://adidas.yohobuy.com/?gender=1,3', 374 'url' => 'http://adidas.yohobuy.com/?gender=1,3',
370 'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90', 375 'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
371 'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋', 376 'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋',
372 - 'salePrice' => '899' 377 + 'salePrice' => '899',
  378 + 'skn' => 123
373 ) 379 )
374 ), 380 ),
375 'hasNextPage' => array( 381 'hasNextPage' => array(
@@ -1521,14 +1527,16 @@ class Index1Controller extends AbstractAction @@ -1521,14 +1527,16 @@ class Index1Controller extends AbstractAction
1521 /* 1527 /*
1522 * 获取商品颜色 1528 * 获取商品颜色
1523 */ 1529 */
1524 - public function productColorAction() 1530 + public function getProductPicAction()
1525 { 1531 {
1526 $data = array( 1532 $data = array(
1527 array( 1533 array(
  1534 + 'coverImg' => 'http://img12.static.yhbimg.com/goodsimg/2015/09/24/09/028738fa8afcf5031733bcdfa83e397f0f.jpg?imageMogr2/thumbnail/75x100/extent/75x100/background/d2hpdGU=/position/center/quality/90',
1528 'url' => 'http://item.yohobuy.com/product/pro_187471_252595/NIKEAIRMAX90ESSENTIAL537384126.html', 1535 'url' => 'http://item.yohobuy.com/product/pro_187471_252595/NIKEAIRMAX90ESSENTIAL537384126.html',
1529 'src' => 'http://img12.static.yhbimg.com/goodsimg/2015/09/24/09/028738fa8afcf5031733bcdfa83e397f0f.jpg?imageMogr2/thumbnail/75x100/extent/75x100/background/d2hpdGU=/position/center/quality/90' 1536 'src' => 'http://img12.static.yhbimg.com/goodsimg/2015/09/24/09/028738fa8afcf5031733bcdfa83e397f0f.jpg?imageMogr2/thumbnail/75x100/extent/75x100/background/d2hpdGU=/position/center/quality/90'
1530 ), 1537 ),
1531 array( 1538 array(
  1539 + 'coverImg' => 'http://img12.static.yhbimg.com/goodsimg/2015/09/24/09/028738fa8afcf5031733bcdfa83e397f0f.jpg?imageMogr2/thumbnail/75x100/extent/75x100/background/d2hpdGU=/position/center/quality/90',
1532 'url' => 'http://item.yohobuy.com/product/pro_187471_252595/NIKEAIRMAX90ESSENTIAL537384126.html', 1540 'url' => 'http://item.yohobuy.com/product/pro_187471_252595/NIKEAIRMAX90ESSENTIAL537384126.html',
1533 'src' => 'http://img12.static.yhbimg.com/goodsimg/2015/09/24/09/028738fa8afcf5031733bcdfa83e397f0f.jpg?imageMogr2/thumbnail/75x100/extent/75x100/background/d2hpdGU=/position/center/quality/90' 1541 'src' => 'http://img12.static.yhbimg.com/goodsimg/2015/09/24/09/028738fa8afcf5031733bcdfa83e397f0f.jpg?imageMogr2/thumbnail/75x100/extent/75x100/background/d2hpdGU=/position/center/quality/90'
1534 ), 1542 ),