Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
3 changed files
with
37 additions
and
31 deletions
@@ -94,12 +94,16 @@ | @@ -94,12 +94,16 @@ | ||
94 | 94 | ||
95 | {{#unless hideMore}} | 95 | {{#unless hideMore}} |
96 | <div class="brand-opt"> | 96 | <div class="brand-opt"> |
97 | - <span id="brand-more" class="brand-more"> | ||
98 | - <em>更多</em> | ||
99 | - <i class="iconfont"></i> | ||
100 | - </span> | 97 | + {{#if showMore}} |
98 | + <span id="brand-more" class="brand-more"> | ||
99 | + <em>更多</em> | ||
100 | + <i class="iconfont"></i> | ||
101 | + </span> | ||
102 | + {{/if}} | ||
101 | 103 | ||
102 | - <span id="brand-multi" class="multi-select">多选 +</span> | 104 | + {{#if showMulti}} |
105 | + <span id="brand-multi" class="multi-select">多选 +</span> | ||
106 | + {{/if}} | ||
103 | </div> | 107 | </div> |
104 | {{/unless}} | 108 | {{/unless}} |
105 | 109 | ||
@@ -179,7 +183,7 @@ | @@ -179,7 +183,7 @@ | ||
179 | </div> | 183 | </div> |
180 | {{/if}} | 184 | {{/if}} |
181 | 185 | ||
182 | - <div class="size section {{#unless size}}hide{{/unless}}"> | 186 | + <div class="size section {{#unless size}}hide{{/unless}}" {{#if size}}data-load="true"{{/if}}> |
183 | <span class="title">尺码:</span> | 187 | <span class="title">尺码:</span> |
184 | 188 | ||
185 | <div class="attr-content clearfix"> | 189 | <div class="attr-content clearfix"> |
@@ -111,26 +111,28 @@ $('.sort-pre').on('click', 'li', function() { | @@ -111,26 +111,28 @@ $('.sort-pre').on('click', 'li', function() { | ||
111 | $sortSub.children(':not(.hide)').addClass('hide'); | 111 | $sortSub.children(':not(.hide)').addClass('hide'); |
112 | $sortSub.children(':eq(' + index + ')').removeClass('hide'); | 112 | $sortSub.children(':eq(' + index + ')').removeClass('hide'); |
113 | 113 | ||
114 | - if (sizeCache[id]) { | ||
115 | - $sizeWrap.find('.attr-content').html(sizeCache[id]); | ||
116 | - $sizeWrap.removeClass('hide'); | ||
117 | - } else { | ||
118 | - $.ajax({ | ||
119 | - url: '/product/search/sortSize', | ||
120 | - data: { | ||
121 | - msort: id | ||
122 | - } | ||
123 | - }).then(function(res) { | ||
124 | - if ($.type(res) === 'array' && res.length) { | ||
125 | - sizeCache[id] = sizeTmpl({ | ||
126 | - size: res | ||
127 | - }); | ||
128 | - $sizeWrap.find('.attr-content').html(sizeCache[id]); | ||
129 | - $sizeWrap.removeClass('hide'); | ||
130 | - } else { | ||
131 | - $sizeWrap.addClass('hide'); | ||
132 | - } | ||
133 | - }); | 114 | + if (!$sizeWrap.data('load')) { |
115 | + if (sizeCache[id]) { | ||
116 | + $sizeWrap.find('.attr-content').html(sizeCache[id]); | ||
117 | + $sizeWrap.removeClass('hide'); | ||
118 | + } else { | ||
119 | + $.ajax({ | ||
120 | + url: '/product/search/sortSize', | ||
121 | + data: { | ||
122 | + msort: id | ||
123 | + } | ||
124 | + }).then(function(res) { | ||
125 | + if ($.type(res) === 'array' && res.length) { | ||
126 | + sizeCache[id] = sizeTmpl({ | ||
127 | + size: res | ||
128 | + }); | ||
129 | + $sizeWrap.find('.attr-content').html(sizeCache[id]); | ||
130 | + $sizeWrap.removeClass('hide'); | ||
131 | + } else { | ||
132 | + $sizeWrap.addClass('hide'); | ||
133 | + } | ||
134 | + }); | ||
135 | + } | ||
134 | } | 136 | } |
135 | }); | 137 | }); |
136 | 138 |
@@ -95,6 +95,11 @@ exports.init = function(num) { | @@ -95,6 +95,11 @@ exports.init = function(num) { | ||
95 | wrapperPt, //鼠标移入时弹层的上内边距 | 95 | wrapperPt, //鼠标移入时弹层的上内边距 |
96 | containerPt; //商品列表容器的上内边距 | 96 | containerPt; //商品列表容器的上内边距 |
97 | 97 | ||
98 | + // 获取图片之前,先把获取上一张图片的ajax请求取消。 网络差的时候会出现错误 | ||
99 | + // if (getProductAjax && getProductAjax.readyState!= 4) { | ||
100 | + // getProductAjax.abort(); | ||
101 | + // } | ||
102 | + | ||
98 | $.ajax({ | 103 | $.ajax({ |
99 | type: 'POST', | 104 | type: 'POST', |
100 | url: '/product/list/getProductPic', | 105 | url: '/product/list/getProductPic', |
@@ -104,11 +109,8 @@ exports.init = function(num) { | @@ -104,11 +109,8 @@ exports.init = function(num) { | ||
104 | } | 109 | } |
105 | }).then(function(data) { | 110 | }).then(function(data) { |
106 | 111 | ||
107 | - //setTimeout(function () { | ||
108 | - | ||
109 | removeHtmlFn(); | 112 | removeHtmlFn(); |
110 | 113 | ||
111 | - | ||
112 | ulStr = createColorList(data.pics).colorListStr; //ajax请求的颜色列表 | 114 | ulStr = createColorList(data.pics).colorListStr; //ajax请求的颜色列表 |
113 | ulNum = createColorList(data.pics).ulNum;//ajax请求的颜色的数量 | 115 | ulNum = createColorList(data.pics).ulNum;//ajax请求的颜色的数量 |
114 | 116 | ||
@@ -151,8 +153,6 @@ exports.init = function(num) { | @@ -151,8 +153,6 @@ exports.init = function(num) { | ||
151 | if (data.pics[0] && data.pics[0].src) { | 153 | if (data.pics[0] && data.pics[0].src) { |
152 | $goodInfoMain.find('.good-thumb img').attr('src', data.pics[0].src); | 154 | $goodInfoMain.find('.good-thumb img').attr('src', data.pics[0].src); |
153 | } | 155 | } |
154 | - | ||
155 | - //}, 1000); | ||
156 | }); | 156 | }); |
157 | }); | 157 | }); |
158 | 158 |
-
Please register or login to post a comment