Authored by lore-w

code review by liuyue

... ... @@ -53,7 +53,7 @@ exports.init = function(num) {
colorListStr +=
'<li>' +
'<a href="' + data[i * row + j].url + '">' +
'<img src="' + data[i * row + j].src + '" />' +
'<img src="' + data[i * row + j].src + '" data-cover="' + data[i * row + j].coverImg + '" />' +
'</a>' +
'</li>';
... ... @@ -94,9 +94,12 @@ exports.init = function(num) {
display: 'none'
});
$.ajax({
type: 'GET',
url: '/product/index/productColor',
dataType: 'json'
type: 'POST',
url: '/product/index/getProductPic',
dataType: 'json',
data: {
skn: event.target.attr('data-skn')
}
}).then(function(data) {
ulStr = createColorList(data).colorListStr; //ajax请求的颜色列表
... ... @@ -141,6 +144,14 @@ exports.init = function(num) {
});
});
//鼠标放在颜色列表上效果
$(document).on('hover', '.good-select-color li', function() {
var coverImg = $(this).find('img').attr('data-cover'),
$coverImg = $(this).closest('.good-item-wrapper').find('.good-detail-img').find('img');
$coverImg.attr('src', coverImg);
});
// 左侧导航
$productListNav.click(function() {
if ($(this).hasClass('active')) {
... ...
... ... @@ -322,7 +322,8 @@ class Index1Controller extends AbstractAction
'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋',
'salePrice' => '899',
'isFew' => true
'isFew' => true,
'skn' => 123
),
1 => array(
'tags' => array(
... ... @@ -333,7 +334,8 @@ class Index1Controller extends AbstractAction
'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋',
'salePrice' => '899',
'showColBtn' => true
'showColBtn' => true,
'skn' => 123
),
2 => array(
'tags' => array(
... ... @@ -343,13 +345,15 @@ class Index1Controller extends AbstractAction
'url' => 'http://adidas.yohobuy.com/?gender=1,3',
'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋',
'salePrice' => '899'
'salePrice' => '899',
'skn' => 123
),
3 => array(
'url' => 'http://adidas.yohobuy.com/?gender=1,3',
'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋',
'salePrice' => '899'
'salePrice' => '899',
'skn' => 123
),
4 => array(
'tags' => array(
... ... @@ -359,7 +363,8 @@ class Index1Controller extends AbstractAction
'url' => 'http://adidas.yohobuy.com/?gender=1,3',
'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋',
'salePrice' => '899'
'salePrice' => '899',
'skn' => 123
),
5 => array(
'tags' => array(
... ... @@ -369,7 +374,8 @@ class Index1Controller extends AbstractAction
'url' => 'http://adidas.yohobuy.com/?gender=1,3',
'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/11/22/03/02c17af44dc23aa5a62d61cb59a05380bc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'adidas Originals FORUM 中帮拼色休闲板鞋',
'salePrice' => '899'
'salePrice' => '899',
'skn' => 123
)
),
'hasNextPage' => array(
... ... @@ -1521,14 +1527,16 @@ class Index1Controller extends AbstractAction
/*
* 获取商品颜色
*/
public function productColorAction()
public function getProductPicAction()
{
$data = array(
array(
'coverImg' => 'http://img12.static.yhbimg.com/goodsimg/2015/09/24/09/028738fa8afcf5031733bcdfa83e397f0f.jpg?imageMogr2/thumbnail/75x100/extent/75x100/background/d2hpdGU=/position/center/quality/90',
'url' => 'http://item.yohobuy.com/product/pro_187471_252595/NIKEAIRMAX90ESSENTIAL537384126.html',
'src' => 'http://img12.static.yhbimg.com/goodsimg/2015/09/24/09/028738fa8afcf5031733bcdfa83e397f0f.jpg?imageMogr2/thumbnail/75x100/extent/75x100/background/d2hpdGU=/position/center/quality/90'
),
array(
'coverImg' => 'http://img12.static.yhbimg.com/goodsimg/2015/09/24/09/028738fa8afcf5031733bcdfa83e397f0f.jpg?imageMogr2/thumbnail/75x100/extent/75x100/background/d2hpdGU=/position/center/quality/90',
'url' => 'http://item.yohobuy.com/product/pro_187471_252595/NIKEAIRMAX90ESSENTIAL537384126.html',
'src' => 'http://img12.static.yhbimg.com/goodsimg/2015/09/24/09/028738fa8afcf5031733bcdfa83e397f0f.jpg?imageMogr2/thumbnail/75x100/extent/75x100/background/d2hpdGU=/position/center/quality/90'
),
... ...