Showing
2 changed files
with
28 additions
and
4 deletions
@@ -101,12 +101,18 @@ exports.init = function(num) { | @@ -101,12 +101,18 @@ exports.init = function(num) { | ||
101 | removeHtmlFn(); | 101 | removeHtmlFn(); |
102 | 102 | ||
103 | 103 | ||
104 | - ulStr = createColorList(data).colorListStr; //ajax请求的颜色列表 | ||
105 | - ulNum = createColorList(data).ulNum;//ajax请求的颜色的数量 | 104 | + ulStr = createColorList(data.pics).colorListStr; //ajax请求的颜色列表 |
105 | + ulNum = createColorList(data.pics).ulNum;//ajax请求的颜色的数量 | ||
106 | 106 | ||
107 | $goodInfoMain.append(event.targetDuplicate); | 107 | $goodInfoMain.append(event.targetDuplicate); |
108 | $goodSelectColor.append($(ulStr)); | 108 | $goodSelectColor.append($(ulStr)); |
109 | 109 | ||
110 | + if (data.isFavorite) { | ||
111 | + $goodInfoMain.find('.col-btn').addClass('coled'); | ||
112 | + } else { | ||
113 | + $goodInfoMain.find('.col-btn').removeClass('coled'); | ||
114 | + } | ||
115 | + | ||
110 | wrapperPl = $goodItemWrapper.css('paddingLeft'); | 116 | wrapperPl = $goodItemWrapper.css('paddingLeft'); |
111 | wrapperPt = $goodItemWrapper.css('paddingTop'); | 117 | wrapperPt = $goodItemWrapper.css('paddingTop'); |
112 | containerPt = $goodsContainer.css('paddingTop'); | 118 | containerPt = $goodsContainer.css('paddingTop'); |
@@ -134,8 +140,8 @@ exports.init = function(num) { | @@ -134,8 +140,8 @@ exports.init = function(num) { | ||
134 | }); | 140 | }); |
135 | 141 | ||
136 | // 鼠标悬浮获取到商品信息后显示第一张图片 | 142 | // 鼠标悬浮获取到商品信息后显示第一张图片 |
137 | - if (data[0] && data[0].src) { | ||
138 | - $goodInfoMain.find('.good-thumb img').attr('src', data[0].src); | 143 | + if (data.pics[0] && data.pics[0].src) { |
144 | + $goodInfoMain.find('.good-thumb img').attr('src', data.pics[0].src); | ||
139 | } | 145 | } |
140 | 146 | ||
141 | //}, 1000); | 147 | //}, 1000); |
@@ -143,6 +149,7 @@ exports.init = function(num) { | @@ -143,6 +149,7 @@ exports.init = function(num) { | ||
143 | }); | 149 | }); |
144 | 150 | ||
145 | $goodItemWrapper.mouseleave(function() { | 151 | $goodItemWrapper.mouseleave(function() { |
152 | + | ||
146 | removeHtmlFn(); | 153 | removeHtmlFn(); |
147 | }); | 154 | }); |
148 | 155 | ||
@@ -163,6 +170,19 @@ $(document).on('hover', '.good-select-color li', function() { | @@ -163,6 +170,19 @@ $(document).on('hover', '.good-select-color li', function() { | ||
163 | $coverImg.attr('src', coverImg); | 170 | $coverImg.attr('src', coverImg); |
164 | }); | 171 | }); |
165 | 172 | ||
173 | +$goodInfoMain.on('click', '.col-btn', function() { | ||
174 | + $.ajax({ | ||
175 | + type: 'POST', | ||
176 | + url: '/product/list/changeFavorite', | ||
177 | + data: { | ||
178 | + skn: $(this).closest('.good-info').data('skn'), | ||
179 | + isFavorite: !$(this).hasClass('coled') | ||
180 | + } | ||
181 | + }).then(function(res) { | ||
182 | + console.log(res); | ||
183 | + }); | ||
184 | +}); | ||
185 | + | ||
166 | // 左侧导航 | 186 | // 左侧导航 |
167 | $productListNav.click(function() { | 187 | $productListNav.click(function() { |
168 | if ($(this).hasClass('active')) { | 188 | if ($(this).hasClass('active')) { |
-
Please register or login to post a comment