Showing
4 changed files
with
407 additions
and
404 deletions
@@ -682,7 +682,7 @@ function JsonPCallBack(data) { | @@ -682,7 +682,7 @@ function JsonPCallBack(data) { | ||
682 | if (data.data.url !== '') { | 682 | if (data.data.url !== '') { |
683 | topbanner = '<a target="_blank" href="' + data.data.url + '" class="page-top-banner"' + | 683 | topbanner = '<a target="_blank" href="' + data.data.url + '" class="page-top-banner"' + |
684 | 'style="height:36px;border:none;background-image:url(' + window.unescape(data.data.src) + ');' + | 684 | 'style="height:36px;border:none;background-image:url(' + window.unescape(data.data.src) + ');' + |
685 | - 'background-position: center;display:block;background-size:contain"> </a>'; | 685 | + 'background-position: center;display:block;"> </a>'; |
686 | } else { | 686 | } else { |
687 | topbanner = '<div class="noticewrapper">' + | 687 | topbanner = '<div class="noticewrapper">' + |
688 | '<div class="noticecontainer">' + | 688 | '<div class="noticecontainer">' + |
@@ -1824,7 +1824,8 @@ function init() { | @@ -1824,7 +1824,8 @@ function init() { | ||
1824 | actionCover(); //初次登录弹框 | 1824 | actionCover(); //初次登录弹框 |
1825 | actionAddKeyWords(); //增加关键字 | 1825 | actionAddKeyWords(); //增加关键字 |
1826 | } | 1826 | } |
1827 | -init(); | 1827 | +init(); |
1828 | + | ||
1828 | }); | 1829 | }); |
1829 | define("js/simple-header", ["jquery"], function(require, exports, module){ | 1830 | define("js/simple-header", ["jquery"], function(require, exports, module){ |
1830 | var $ = require("jquery"); | 1831 | var $ = require("jquery"); |
@@ -1960,364 +1961,366 @@ require("js/product/latest-walk"); | @@ -1960,364 +1961,366 @@ require("js/product/latest-walk"); | ||
1960 | require("js/product/product"); | 1961 | require("js/product/product"); |
1961 | }); | 1962 | }); |
1962 | define("js/product/filter", ["jquery","handlebars","source-map"], function(require, exports, module){ | 1963 | define("js/product/filter", ["jquery","handlebars","source-map"], function(require, exports, module){ |
1963 | -/** | ||
1964 | - * 商品筛选逻辑 | ||
1965 | - * @author: xuqi<qi.xu@yoho.cn> | ||
1966 | - * @date: 2015/12/4 | ||
1967 | - */ | ||
1968 | - | ||
1969 | -var $ = require("jquery"), | ||
1970 | - Handlebars = require("handlebars"); | ||
1971 | - | ||
1972 | -var checkUnicode = { | ||
1973 | - unchecked: '', | ||
1974 | - checked: '' | ||
1975 | -}, | ||
1976 | -moreUnicode = { | ||
1977 | - up: '', | ||
1978 | - down: '' | ||
1979 | -}; | ||
1980 | - | ||
1981 | -//品牌相关变量 | ||
1982 | -var $brandDefault = $('.brand .default'), | ||
1983 | - $brandPanel = $('.brand .brand-panel'), | ||
1984 | - $brandAttrs = $brandPanel.find('.attr'), | ||
1985 | - $brandMore = $('#brand-more'), | ||
1986 | - $brandMulti = $('#brand-multi'); | ||
1987 | - | ||
1988 | -var $brandMoreTxt, $brandMoreIcon; | ||
1989 | - | ||
1990 | -//价格相关变量 | ||
1991 | -var $udPrice = $('.ud-price-range'), | ||
1992 | - interReg = /^\d+$/, | ||
1993 | - $limit, $min, $max, $btn; | ||
1994 | - | ||
1995 | -//分类相关变量 | ||
1996 | -var $sortSub = $('.sort-sub-wrap'); | ||
1997 | - | ||
1998 | -//高级选项相关变量 | ||
1999 | -var $seniorSubWrap = $('.senior-sub-wrap'), | ||
2000 | - $seniorAttrWrap = $('.senior-attr-wrap'); | ||
2001 | - | ||
2002 | -var seniorHoverTime, hoveredIndex; | ||
2003 | - | ||
2004 | -// 尺寸 handlebars 模板 | ||
2005 | -var sizeTmpl = '{{# size}}<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">{{name}}</a>{{/ size}}', | ||
2006 | - sizeCache = {}, // 缓存一下尺寸信息 | ||
2007 | - $sizeWrap = $('.filter-box .size'); | ||
2008 | - | ||
2009 | -sizeTmpl = Handlebars.compile(sizeTmpl); | ||
2010 | - | ||
2011 | -//清除checkbox选中状态 | ||
2012 | -function clearChecked($checkbox) { | ||
2013 | - $checkbox.removeClass('checked').html(checkUnicode.unchecked); | ||
2014 | -} | ||
2015 | - | ||
2016 | -//显示更多品牌面板 | ||
2017 | -function brandShowMore() { | ||
2018 | - $brandDefault.addClass('hide'); | ||
2019 | - $brandPanel.removeClass('hide'); | ||
2020 | -} | ||
2021 | - | ||
2022 | -//隐藏更多品牌面板 | ||
2023 | -function brandHideMore() { | ||
2024 | - $brandPanel.addClass('hide'); | ||
2025 | - $brandDefault.removeClass('hide'); | ||
2026 | -} | ||
2027 | - | ||
2028 | -//url构造&跳转 | ||
2029 | -function uriLoc(attr, val) { | ||
2030 | - var href = decodeURIComponent(window.location.search), | ||
2031 | - query = attr + '=' + val, | ||
2032 | - newHref; | ||
2033 | - | ||
2034 | - if (href === '') { | ||
2035 | - newHref = '?' + query; | ||
2036 | - } else { | ||
2037 | - newHref = href + '&' + query; | ||
2038 | - } | ||
2039 | - | ||
2040 | - window.location.href = newHref; | ||
2041 | -} | ||
2042 | - | ||
2043 | -//隐藏高级选项面板 | ||
2044 | -function hideSeniorPanel(index) { | ||
2045 | - $seniorSubWrap.children('.senior-sub:eq(' + hoveredIndex + ')').addClass('hide'); | ||
2046 | - $seniorAttrWrap.children('.attr:eq(' + hoveredIndex + ')').removeClass('hover'); | ||
2047 | - hoveredIndex = -1; | ||
2048 | -} | ||
2049 | - | ||
2050 | -//屏蔽筛选项双击文字选中 | ||
2051 | -$('.filter-box').on('selectstart', '.attr, .brands-index span', function() { | ||
2052 | - return false; | ||
2053 | -}); | ||
2054 | - | ||
2055 | -//【分类】 | ||
2056 | -$('.sort-pre').on('click', 'li', function() { | ||
2057 | - var $this = $(this), | ||
2058 | - index = $this.index(), | ||
2059 | - id = $this.data('id'); | ||
2060 | - | ||
2061 | - if ($this.hasClass('active')) { | ||
2062 | - | ||
2063 | - // 选中时,再次点击取消选中 | ||
2064 | - $this.removeClass('active'); | ||
2065 | - $sortSub.children(':eq(' + index + ')').addClass('hide'); | ||
2066 | - $sizeWrap.addClass('hide'); | ||
2067 | - return; | ||
2068 | - } | ||
2069 | - | ||
2070 | - $this.siblings('.active').removeClass('active'); | ||
2071 | - $this.addClass('active'); | ||
2072 | - | ||
2073 | - $sortSub.children(':not(.hide)').addClass('hide'); | ||
2074 | - $sortSub.children(':eq(' + index + ')').removeClass('hide'); | ||
2075 | - | ||
2076 | - if (!$sizeWrap.data('load')) { | ||
2077 | - if (sizeCache[id]) { | ||
2078 | - $sizeWrap.find('.attr-content').html(sizeCache[id]); | ||
2079 | - $sizeWrap.removeClass('hide'); | ||
2080 | - } else { | ||
2081 | - $.ajax({ | ||
2082 | - url: '/product/search/sortSize', | ||
2083 | - data: { | ||
2084 | - msort: id | ||
2085 | - } | ||
2086 | - }).then(function(res) { | ||
2087 | - if ($.type(res) === 'array' && res.length) { | ||
2088 | - sizeCache[id] = sizeTmpl({ | ||
2089 | - size: res | ||
2090 | - }); | ||
2091 | - $sizeWrap.find('.attr-content').html(sizeCache[id]); | ||
2092 | - $sizeWrap.removeClass('hide'); | ||
2093 | - } else { | ||
2094 | - $sizeWrap.addClass('hide'); | ||
2095 | - } | ||
2096 | - }); | ||
2097 | - } | ||
2098 | - } | ||
2099 | -}); | ||
2100 | - | ||
2101 | -//【品牌】 | ||
2102 | -if ($brandMore.length > 0) { | ||
2103 | - $brandMoreTxt = $brandMore.children('em'); | ||
2104 | - $brandMoreIcon = $brandMore.children('.iconfont'); | ||
2105 | -} | ||
2106 | - | ||
2107 | -//【品牌】多选 | ||
2108 | -$brandMulti.click(function() { | ||
2109 | - if ($brandPanel.css('display') === 'none') { | ||
2110 | - | ||
2111 | - //显示品牌面板 | ||
2112 | - $brandMore.trigger('click'); | ||
2113 | - } | ||
2114 | - | ||
2115 | - $brandPanel.addClass('multi'); //显示出checkbox | ||
2116 | - $(this).addClass('hide'); | ||
2117 | -}); | ||
2118 | - | ||
2119 | -//【品牌】更多 | ||
2120 | -$brandMore.click(function() { | ||
2121 | - var $this = $(this); | ||
2122 | - | ||
2123 | - if ($this.hasClass('more')) { | ||
2124 | - brandHideMore(); | ||
2125 | - | ||
2126 | - $brandMoreTxt.text('更多'); | ||
2127 | - $brandMoreIcon.html(moreUnicode.down); | ||
2128 | - } else { | ||
2129 | - brandShowMore(); | ||
2130 | - | ||
2131 | - $brandMoreTxt.text('收起'); | ||
2132 | - $brandMoreIcon.html(moreUnicode.up); | ||
2133 | - } | ||
2134 | - | ||
2135 | - $(this).toggleClass('more'); | ||
2136 | -}); | ||
2137 | - | ||
2138 | -//【品牌】索引 | ||
2139 | -$('.brands-index').on('mouseenter', 'span', function() { | ||
2140 | - var $this = $(this), | ||
2141 | - index = $this.data('index'); | ||
2142 | - | ||
2143 | - if ($this.hasClass('hover')) { | ||
2144 | - return; | ||
2145 | - } | ||
2146 | - | ||
2147 | - $this.siblings('span.hover').removeClass('hover'); | ||
2148 | - $this.addClass('hover'); | ||
2149 | - | ||
2150 | - if ($this.index() === 0) { | ||
2151 | - | ||
2152 | - //全部 | ||
2153 | - $brandAttrs.removeClass('hide'); | ||
2154 | - } else { | ||
2155 | - $brandAttrs.addClass('hide').filter('[data-index=' + index + ']').removeClass('hide'); | ||
2156 | - } | ||
2157 | -}); | ||
2158 | - | ||
2159 | -//【品牌】搜索 | ||
2160 | -$('#brand-search-input').keyup(function() { | ||
2161 | - var val = $(this).val().toLowerCase(); | ||
2162 | - | ||
2163 | - if (val === '') { | ||
2164 | - $brandAttrs.removeClass('hide'); | ||
2165 | - } else { | ||
2166 | - $brandAttrs.addClass('hide').filter('[data-key*="' + val + '"]').removeClass('hide'); | ||
2167 | - } | ||
2168 | -}); | ||
2169 | - | ||
2170 | -//【品牌】多选确定 | ||
2171 | -$('#brand-multi-ok').click(function() { | ||
2172 | - var val = ''; | ||
2173 | - | ||
2174 | - if ($(this).hasClass('dis')) { | ||
2175 | - return; | ||
2176 | - } | ||
2177 | - | ||
2178 | - $brandPanel.find('.checked').each(function() { | ||
2179 | - var id = $(this).data('id'); | ||
2180 | - | ||
2181 | - val += (val === '') ? id : (',' + id); | ||
2182 | - }); | ||
2183 | - | ||
2184 | - uriLoc('brand', val); | ||
2185 | -}); | ||
2186 | - | ||
2187 | -//【品牌/高级选项】多选取消 | ||
2188 | -$('.multi-select-cancel').click(function() { | ||
2189 | - var $panel = $(this).closest('.multi'); | ||
2190 | - | ||
2191 | - if ($panel.hasClass('brand-panel')) { | ||
2192 | - | ||
2193 | - $brandMulti.removeClass('hide'); //显示多选按钮 | ||
2194 | - $brandMore.trigger('click'); | ||
2195 | - } | ||
2196 | - | ||
2197 | - $panel.removeClass('multi'); | ||
2198 | - clearChecked($panel.find('.checkbox.checked')); //清除选中状态 | ||
2199 | -}); | ||
2200 | - | ||
2201 | -//【品牌/高级选项】checkbox | ||
2202 | -$('.check-container').on('click', '.attr', function() { | ||
2203 | - var $this = $(this), | ||
2204 | - $check = $this.find('.checkbox'), | ||
2205 | - $btnOk = $this.closest('.brand-panel, .senior-sub').find('.multi-select-ok'); | ||
2206 | - | ||
2207 | - $check.toggleClass('checked'); | ||
2208 | - | ||
2209 | - if ($check.hasClass('checked')) { | ||
2210 | - $check.html(checkUnicode.checked); | ||
2211 | - } else { | ||
2212 | - $check.html(checkUnicode.unchecked); | ||
2213 | - } | ||
2214 | - | ||
2215 | - //更新按钮状态 | ||
2216 | - if ($check.hasClass('checked') || | ||
2217 | - $this.siblings('.attr').find('.checked').length > 0) { | ||
2218 | - $btnOk.removeClass('dis'); | ||
2219 | - } else { | ||
2220 | - $btnOk.addClass('dis'); | ||
2221 | - } | ||
2222 | -}); | ||
2223 | - | ||
2224 | -//【品牌/高级选项】当多选时阻止链接默认跳转 | ||
2225 | -$('.brand, .senior').on('click', '.attr > a', function(e) { | ||
2226 | - if ($(this).closest('.multi').length > 0) { | ||
2227 | - e.preventDefault(); | ||
2228 | - } | ||
2229 | -}); | ||
2230 | - | ||
2231 | -//【价格】用户定义价格处理 | ||
2232 | -if ($udPrice.length > 0) { | ||
2233 | - $limit = $udPrice.find('.limit'); | ||
2234 | - $min = $limit.filter('.min'); | ||
2235 | - $max = $limit.filter('.max'); | ||
2236 | - $btn = $udPrice.find('.price-sure'); | ||
2237 | - | ||
2238 | - //【价格】输入 | ||
2239 | - $limit.keyup(function() { | ||
2240 | - var min = $.trim($min.val()), | ||
2241 | - max = $.trim($max.val()), | ||
2242 | - isMinInt = interReg.test(min), | ||
2243 | - isMaxInt = interReg.test(max); | ||
2244 | - | ||
2245 | - if (isMaxInt && (min === '' || isMinInt) || | ||
2246 | - isMinInt && (max === '' || isMaxInt) | ||
2247 | - ) { | ||
2248 | - $btn.removeClass('hide'); | ||
2249 | - } else { | ||
2250 | - $btn.addClass('hide'); | ||
2251 | - } | ||
2252 | - }); | ||
2253 | - | ||
2254 | - //【价格】多项查询 | ||
2255 | - $btn.click(function() { | ||
2256 | - var min = $.trim($min.val()), | ||
2257 | - max = $.trim($max.val()), | ||
2258 | - tmp; | ||
2259 | - | ||
2260 | - //对于min大于max的情况,交换位置 | ||
2261 | - if (min !== '' && max !== '' && +min > +max) { | ||
2262 | - tmp = max; | ||
2263 | - max = min; | ||
2264 | - min = tmp; | ||
2265 | - } | ||
2266 | - | ||
2267 | - uriLoc('price', min + ',' + max); | ||
2268 | - }); | ||
2269 | -} | ||
2270 | - | ||
2271 | -//【高级选项】鼠标移入显示子项 | ||
2272 | -$seniorAttrWrap.on('mouseenter', '.attr', function() { | ||
2273 | - var $this = $(this); | ||
2274 | - var index = $this.index(); | ||
2275 | - | ||
2276 | - if ($this.hasClass('no-sub')) { | ||
2277 | - return; | ||
2278 | - } | ||
2279 | - $this.addClass('hover').siblings().removeClass('hover'); | ||
2280 | - | ||
2281 | - $seniorSubWrap.children('.senior-sub:eq(' + index + ')').removeClass('hide').siblings().addClass('hide'); | ||
2282 | -}).on('mouseleave', '.attr', function() { | ||
2283 | - var $this = $(this), | ||
2284 | - index = $this.index(); | ||
2285 | - | ||
2286 | - if ($this.hasClass('no-sub')) { | ||
2287 | - return; | ||
2288 | - } | ||
2289 | - | ||
2290 | - hoveredIndex = index; | ||
2291 | - | ||
2292 | - seniorHoverTime = setTimeout(function() { | ||
2293 | - hideSeniorPanel(); | ||
2294 | - }, 100); | ||
2295 | -}); | ||
2296 | - | ||
2297 | -//【高级选项】多选 | ||
2298 | -$('.senior-sub').on('click', '.multi-select', function() { | ||
2299 | - $(this).closest('.senior-sub').addClass('multi'); | ||
2300 | -}).on('click', '.multi-select-ok', function() { | ||
2301 | - var $btn = $(this), | ||
2302 | - $sub = $btn.closest('.senior-sub'), | ||
2303 | - val = ''; | ||
2304 | - | ||
2305 | - if ($btn.hasClass('dis')) { | ||
2306 | - return; | ||
2307 | - } | ||
2308 | - | ||
2309 | - $sub.find('.checked').each(function() { | ||
2310 | - var id = $(this).data('id'); | ||
2311 | - | ||
2312 | - val += (val === '') ? id : (',' + id); | ||
2313 | - }); | ||
2314 | - | ||
2315 | - uriLoc($sub.data('attr'), val); | ||
2316 | -}).on('mouseenter', function() { | ||
2317 | - clearTimeout(seniorHoverTime); | ||
2318 | -}).on('mouseleave', function() { | ||
2319 | - hideSeniorPanel(); | ||
2320 | -}); | 1964 | +/** |
1965 | + * 商品筛选逻辑 | ||
1966 | + * @author: xuqi<qi.xu@yoho.cn> | ||
1967 | + * @date: 2015/12/4 | ||
1968 | + */ | ||
1969 | + | ||
1970 | +var $ = require("jquery"), | ||
1971 | + Handlebars = require("handlebars"); | ||
1972 | + | ||
1973 | +var checkUnicode = { | ||
1974 | + unchecked: '', | ||
1975 | + checked: '' | ||
1976 | +}, | ||
1977 | +moreUnicode = { | ||
1978 | + up: '', | ||
1979 | + down: '' | ||
1980 | +}; | ||
1981 | + | ||
1982 | +//品牌相关变量 | ||
1983 | +var $brandDefault = $('.brand .default'), | ||
1984 | + $brandPanel = $('.brand .brand-panel'), | ||
1985 | + $brandAttrs = $brandPanel.find('.attr'), | ||
1986 | + $brandMore = $('#brand-more'), | ||
1987 | + $brandMulti = $('#brand-multi'); | ||
1988 | + | ||
1989 | +var $brandMoreTxt, $brandMoreIcon; | ||
1990 | + | ||
1991 | +//价格相关变量 | ||
1992 | +var $udPrice = $('.ud-price-range'), | ||
1993 | + interReg = /^\d+$/, | ||
1994 | + $limit, $min, $max, $btn; | ||
1995 | + | ||
1996 | +//分类相关变量 | ||
1997 | +var $sortSub = $('.sort-sub-wrap'); | ||
1998 | + | ||
1999 | +//高级选项相关变量 | ||
2000 | +var $seniorSubWrap = $('.senior-sub-wrap'), | ||
2001 | + $seniorAttrWrap = $('.senior-attr-wrap'); | ||
2002 | + | ||
2003 | +var seniorHoverTime, hoveredIndex; | ||
2004 | + | ||
2005 | +// 尺寸 handlebars 模板 | ||
2006 | +var sizeTmpl = '{{# size}}<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">{{name}}</a>{{/ size}}', | ||
2007 | + sizeCache = {}, // 缓存一下尺寸信息 | ||
2008 | + $sizeWrap = $('.filter-box .size'); | ||
2009 | + | ||
2010 | +sizeTmpl = Handlebars.compile(sizeTmpl); | ||
2011 | + | ||
2012 | +//清除checkbox选中状态 | ||
2013 | +function clearChecked($checkbox) { | ||
2014 | + $checkbox.removeClass('checked').html(checkUnicode.unchecked); | ||
2015 | +} | ||
2016 | + | ||
2017 | +//显示更多品牌面板 | ||
2018 | +function brandShowMore() { | ||
2019 | + $brandDefault.addClass('hide'); | ||
2020 | + $brandPanel.removeClass('hide'); | ||
2021 | +} | ||
2022 | + | ||
2023 | +//隐藏更多品牌面板 | ||
2024 | +function brandHideMore() { | ||
2025 | + $brandPanel.addClass('hide'); | ||
2026 | + $brandDefault.removeClass('hide'); | ||
2027 | +} | ||
2028 | + | ||
2029 | +//url构造&跳转 | ||
2030 | +function uriLoc(attr, val) { | ||
2031 | + var href = decodeURIComponent(window.location.search), | ||
2032 | + query = attr + '=' + val, | ||
2033 | + newHref; | ||
2034 | + | ||
2035 | + if (href === '') { | ||
2036 | + newHref = '?' + query; | ||
2037 | + } else { | ||
2038 | + newHref = href + '&' + query; | ||
2039 | + } | ||
2040 | + | ||
2041 | + window.location.href = newHref; | ||
2042 | +} | ||
2043 | + | ||
2044 | +//隐藏高级选项面板 | ||
2045 | +function hideSeniorPanel(index) { | ||
2046 | + $seniorSubWrap.children('.senior-sub:eq(' + hoveredIndex + ')').addClass('hide'); | ||
2047 | + $seniorAttrWrap.children('.attr:eq(' + hoveredIndex + ')').removeClass('hover'); | ||
2048 | + hoveredIndex = -1; | ||
2049 | +} | ||
2050 | + | ||
2051 | +//屏蔽筛选项双击文字选中 | ||
2052 | +$('.filter-box').on('selectstart', '.attr, .brands-index span', function() { | ||
2053 | + return false; | ||
2054 | +}); | ||
2055 | + | ||
2056 | +//【分类】 | ||
2057 | +$('.sort-pre').on('click', 'li', function() { | ||
2058 | + var $this = $(this), | ||
2059 | + index = $this.index(), | ||
2060 | + id = $this.data('id'); | ||
2061 | + | ||
2062 | + if ($this.hasClass('active')) { | ||
2063 | + | ||
2064 | + // 选中时,再次点击取消选中 | ||
2065 | + $this.removeClass('active'); | ||
2066 | + $sortSub.children(':eq(' + index + ')').addClass('hide'); | ||
2067 | + $sizeWrap.addClass('hide'); | ||
2068 | + return; | ||
2069 | + } | ||
2070 | + | ||
2071 | + $this.siblings('.active').removeClass('active'); | ||
2072 | + $this.addClass('active'); | ||
2073 | + | ||
2074 | + $sortSub.children(':not(.hide)').addClass('hide'); | ||
2075 | + $sortSub.children(':eq(' + index + ')').removeClass('hide'); | ||
2076 | + | ||
2077 | + if (!$sizeWrap.data('load')) { | ||
2078 | + if (sizeCache[id]) { | ||
2079 | + $sizeWrap.find('.attr-content').html(sizeCache[id]); | ||
2080 | + $sizeWrap.removeClass('hide'); | ||
2081 | + } else { | ||
2082 | + $.ajax({ | ||
2083 | + url: '/product/search/sortSize', | ||
2084 | + data: { | ||
2085 | + msort: id | ||
2086 | + } | ||
2087 | + }).then(function(res) { | ||
2088 | + if ($.type(res) === 'array' && res.length) { | ||
2089 | + sizeCache[id] = sizeTmpl({ | ||
2090 | + size: res | ||
2091 | + }); | ||
2092 | + $sizeWrap.find('.attr-content').html(sizeCache[id]); | ||
2093 | + $sizeWrap.removeClass('hide'); | ||
2094 | + } else { | ||
2095 | + $sizeWrap.addClass('hide'); | ||
2096 | + } | ||
2097 | + }); | ||
2098 | + } | ||
2099 | + } | ||
2100 | +}); | ||
2101 | + | ||
2102 | +//【品牌】 | ||
2103 | +if ($brandMore.length > 0) { | ||
2104 | + $brandMoreTxt = $brandMore.children('em'); | ||
2105 | + $brandMoreIcon = $brandMore.children('.iconfont'); | ||
2106 | +} | ||
2107 | + | ||
2108 | +//【品牌】多选 | ||
2109 | +$brandMulti.click(function() { | ||
2110 | + if ($brandPanel.css('display') === 'none') { | ||
2111 | + | ||
2112 | + //显示品牌面板 | ||
2113 | + $brandMore.trigger('click'); | ||
2114 | + } | ||
2115 | + | ||
2116 | + brandShowMore(); | ||
2117 | + $brandPanel.removeClass('hide').addClass('multi'); //显示出checkbox | ||
2118 | + $(this).addClass('hide'); | ||
2119 | +}); | ||
2120 | + | ||
2121 | +//【品牌】更多 | ||
2122 | +$brandMore.click(function() { | ||
2123 | + var $this = $(this); | ||
2124 | + | ||
2125 | + if ($this.hasClass('more')) { | ||
2126 | + brandHideMore(); | ||
2127 | + | ||
2128 | + $brandMoreTxt.text('更多'); | ||
2129 | + $brandMoreIcon.html(moreUnicode.down); | ||
2130 | + } else { | ||
2131 | + brandShowMore(); | ||
2132 | + | ||
2133 | + $brandMoreTxt.text('收起'); | ||
2134 | + $brandMoreIcon.html(moreUnicode.up); | ||
2135 | + } | ||
2136 | + | ||
2137 | + $(this).toggleClass('more'); | ||
2138 | +}); | ||
2139 | + | ||
2140 | +//【品牌】索引 | ||
2141 | +$('.brands-index').on('mouseenter', 'span', function() { | ||
2142 | + var $this = $(this), | ||
2143 | + index = $this.data('index'); | ||
2144 | + | ||
2145 | + if ($this.hasClass('hover')) { | ||
2146 | + return; | ||
2147 | + } | ||
2148 | + | ||
2149 | + $this.siblings('span.hover').removeClass('hover'); | ||
2150 | + $this.addClass('hover'); | ||
2151 | + | ||
2152 | + if ($this.index() === 0) { | ||
2153 | + | ||
2154 | + //全部 | ||
2155 | + $brandAttrs.removeClass('hide'); | ||
2156 | + } else { | ||
2157 | + $brandAttrs.addClass('hide').filter('[data-index=' + index + ']').removeClass('hide'); | ||
2158 | + } | ||
2159 | +}); | ||
2160 | + | ||
2161 | +//【品牌】搜索 | ||
2162 | +$('#brand-search-input').keyup(function() { | ||
2163 | + var val = $(this).val().toLowerCase(); | ||
2164 | + | ||
2165 | + if (val === '') { | ||
2166 | + $brandAttrs.removeClass('hide'); | ||
2167 | + } else { | ||
2168 | + $brandAttrs.addClass('hide').filter('[data-key*="' + val + '"]').removeClass('hide'); | ||
2169 | + } | ||
2170 | +}); | ||
2171 | + | ||
2172 | +//【品牌】多选确定 | ||
2173 | +$('#brand-multi-ok').click(function() { | ||
2174 | + var val = ''; | ||
2175 | + | ||
2176 | + if ($(this).hasClass('dis')) { | ||
2177 | + return; | ||
2178 | + } | ||
2179 | + | ||
2180 | + $brandPanel.find('.checked').each(function() { | ||
2181 | + var id = $(this).data('id'); | ||
2182 | + | ||
2183 | + val += (val === '') ? id : (',' + id); | ||
2184 | + }); | ||
2185 | + | ||
2186 | + uriLoc('brand', val); | ||
2187 | +}); | ||
2188 | + | ||
2189 | +//【品牌/高级选项】多选取消 | ||
2190 | +$('.multi-select-cancel').click(function() { | ||
2191 | + var $panel = $(this).closest('.multi'); | ||
2192 | + | ||
2193 | + if ($panel.hasClass('brand-panel')) { | ||
2194 | + | ||
2195 | + $brandMulti.removeClass('hide'); //显示多选按钮 | ||
2196 | + $brandMore.trigger('click'); | ||
2197 | + } | ||
2198 | + | ||
2199 | + $panel.addClass('hide').removeClass('multi'); | ||
2200 | + brandHideMore(); | ||
2201 | + clearChecked($panel.find('.checkbox.checked')); //清除选中状态 | ||
2202 | +}); | ||
2203 | + | ||
2204 | +//【品牌/高级选项】checkbox | ||
2205 | +$('.check-container').on('click', '.attr', function() { | ||
2206 | + var $this = $(this), | ||
2207 | + $check = $this.find('.checkbox'), | ||
2208 | + $btnOk = $this.closest('.brand-panel, .senior-sub').find('.multi-select-ok'); | ||
2209 | + | ||
2210 | + $check.toggleClass('checked'); | ||
2211 | + | ||
2212 | + if ($check.hasClass('checked')) { | ||
2213 | + $check.html(checkUnicode.checked); | ||
2214 | + } else { | ||
2215 | + $check.html(checkUnicode.unchecked); | ||
2216 | + } | ||
2217 | + | ||
2218 | + //更新按钮状态 | ||
2219 | + if ($check.hasClass('checked') || | ||
2220 | + $this.siblings('.attr').find('.checked').length > 0) { | ||
2221 | + $btnOk.removeClass('dis'); | ||
2222 | + } else { | ||
2223 | + $btnOk.addClass('dis'); | ||
2224 | + } | ||
2225 | +}); | ||
2226 | + | ||
2227 | +//【品牌/高级选项】当多选时阻止链接默认跳转 | ||
2228 | +$('.brand, .senior').on('click', '.attr > a', function(e) { | ||
2229 | + if ($(this).closest('.multi').length > 0) { | ||
2230 | + e.preventDefault(); | ||
2231 | + } | ||
2232 | +}); | ||
2233 | + | ||
2234 | +//【价格】用户定义价格处理 | ||
2235 | +if ($udPrice.length > 0) { | ||
2236 | + $limit = $udPrice.find('.limit'); | ||
2237 | + $min = $limit.filter('.min'); | ||
2238 | + $max = $limit.filter('.max'); | ||
2239 | + $btn = $udPrice.find('.price-sure'); | ||
2240 | + | ||
2241 | + //【价格】输入 | ||
2242 | + $limit.keyup(function() { | ||
2243 | + var min = $.trim($min.val()), | ||
2244 | + max = $.trim($max.val()), | ||
2245 | + isMinInt = interReg.test(min), | ||
2246 | + isMaxInt = interReg.test(max); | ||
2247 | + | ||
2248 | + if (isMaxInt && (min === '' || isMinInt) || | ||
2249 | + isMinInt && (max === '' || isMaxInt) | ||
2250 | + ) { | ||
2251 | + $btn.removeClass('hide'); | ||
2252 | + } else { | ||
2253 | + $btn.addClass('hide'); | ||
2254 | + } | ||
2255 | + }); | ||
2256 | + | ||
2257 | + //【价格】多项查询 | ||
2258 | + $btn.click(function() { | ||
2259 | + var min = $.trim($min.val()), | ||
2260 | + max = $.trim($max.val()), | ||
2261 | + tmp; | ||
2262 | + | ||
2263 | + //对于min大于max的情况,交换位置 | ||
2264 | + if (min !== '' && max !== '' && +min > +max) { | ||
2265 | + tmp = max; | ||
2266 | + max = min; | ||
2267 | + min = tmp; | ||
2268 | + } | ||
2269 | + | ||
2270 | + uriLoc('price', min + ',' + max); | ||
2271 | + }); | ||
2272 | +} | ||
2273 | + | ||
2274 | +//【高级选项】鼠标移入显示子项 | ||
2275 | +$seniorAttrWrap.on('mouseenter', '.attr', function() { | ||
2276 | + var $this = $(this); | ||
2277 | + var index = $this.index(); | ||
2278 | + | ||
2279 | + if ($this.hasClass('no-sub')) { | ||
2280 | + return; | ||
2281 | + } | ||
2282 | + $this.addClass('hover').siblings().removeClass('hover'); | ||
2283 | + | ||
2284 | + $seniorSubWrap.children('.senior-sub:eq(' + index + ')').removeClass('hide').siblings().addClass('hide'); | ||
2285 | +}).on('mouseleave', '.attr', function() { | ||
2286 | + var $this = $(this), | ||
2287 | + index = $this.index(); | ||
2288 | + | ||
2289 | + if ($this.hasClass('no-sub')) { | ||
2290 | + return; | ||
2291 | + } | ||
2292 | + | ||
2293 | + hoveredIndex = index; | ||
2294 | + | ||
2295 | + seniorHoverTime = setTimeout(function() { | ||
2296 | + hideSeniorPanel(); | ||
2297 | + }, 100); | ||
2298 | +}); | ||
2299 | + | ||
2300 | +//【高级选项】多选 | ||
2301 | +$('.senior-sub').on('click', '.multi-select', function() { | ||
2302 | + $(this).closest('.senior-sub').addClass('multi'); | ||
2303 | +}).on('click', '.multi-select-ok', function() { | ||
2304 | + var $btn = $(this), | ||
2305 | + $sub = $btn.closest('.senior-sub'), | ||
2306 | + val = ''; | ||
2307 | + | ||
2308 | + if ($btn.hasClass('dis')) { | ||
2309 | + return; | ||
2310 | + } | ||
2311 | + | ||
2312 | + $sub.find('.checked').each(function() { | ||
2313 | + var id = $(this).data('id'); | ||
2314 | + | ||
2315 | + val += (val === '') ? id : (',' + id); | ||
2316 | + }); | ||
2317 | + | ||
2318 | + uriLoc($sub.data('attr'), val); | ||
2319 | +}).on('mouseenter', function() { | ||
2320 | + clearTimeout(seniorHoverTime); | ||
2321 | +}).on('mouseleave', function() { | ||
2322 | + hideSeniorPanel(); | ||
2323 | +}); | ||
2321 | 2324 | ||
2322 | }); | 2325 | }); |
2323 | define("js/product/sort-pager", ["jquery"], function(require, exports, module){ | 2326 | define("js/product/sort-pager", ["jquery"], function(require, exports, module){ |
@@ -3501,49 +3504,49 @@ var $ = require("jquery"); | @@ -3501,49 +3504,49 @@ var $ = require("jquery"); | ||
3501 | }($)); | 3504 | }($)); |
3502 | }); | 3505 | }); |
3503 | define("js/common/accordion", ["jquery"], function(require, exports, module){ | 3506 | define("js/common/accordion", ["jquery"], function(require, exports, module){ |
3504 | -var Slide = require("js/common/yohoui/YH.slide"); | ||
3505 | -var $ = require("jquery"); | ||
3506 | - | ||
3507 | -var $contain = $('.slide-accordion'); | ||
3508 | -var $item = $contain.find('li'); | ||
3509 | - | ||
3510 | -var $width = $item.width(); | ||
3511 | -var $spn = parseInt($('.home-page').width()) === 1150 ? (120 + 5) : (102 + 5); | ||
3512 | -var slide; | ||
3513 | - | ||
3514 | -function switchfun(to) { | ||
3515 | - $item.each(function(index) { | ||
3516 | - $(this).css('zIndex', index); | ||
3517 | - if (index <= to) { | ||
3518 | - $(this).stop().animate({ | ||
3519 | - left: index * $spn | ||
3520 | - }, 400); | ||
3521 | - } else { | ||
3522 | - $(this).stop().animate({ | ||
3523 | - left: (to) * $spn + $width + $spn * (index - to - 1) | ||
3524 | - }, 400); | ||
3525 | - } | ||
3526 | - }); | ||
3527 | -} | ||
3528 | - | ||
3529 | -switchfun(0); | ||
3530 | - | ||
3531 | -slide = new Slide({ | ||
3532 | - length: 5, | ||
3533 | - loop: false, | ||
3534 | - auto: false, | ||
3535 | - timeout: 2, | ||
3536 | - index: 3 | ||
3537 | -}); | ||
3538 | - | ||
3539 | -slide.on('change', function(data) { | ||
3540 | - switchfun(data.to); | ||
3541 | -}); | ||
3542 | - | ||
3543 | -$item.mouseover(function() { | ||
3544 | - slide.go($(this).index()); | ||
3545 | -}); | ||
3546 | - | 3507 | +var Slide = require("js/common/yohoui/YH.slide"); |
3508 | +var $ = require("jquery"); | ||
3509 | + | ||
3510 | +var $contain = $('.slide-accordion'); | ||
3511 | +var $item = $contain.find('li'); | ||
3512 | + | ||
3513 | +var $width = $item.width(); | ||
3514 | +var $spn = parseInt($('.home-page').width()) === 1150 ? (120 + 5) : (102 + 5); | ||
3515 | +var slide; | ||
3516 | + | ||
3517 | +function switchfun(to) { | ||
3518 | + $item.each(function(index) { | ||
3519 | + $(this).css('zIndex', index); | ||
3520 | + if (index <= to) { | ||
3521 | + $(this).stop().animate({ | ||
3522 | + left: index * $spn | ||
3523 | + }, 400); | ||
3524 | + } else { | ||
3525 | + $(this).stop().animate({ | ||
3526 | + left: (to) * $spn + $width + $spn * (index - to - 1) | ||
3527 | + }, 400); | ||
3528 | + } | ||
3529 | + }); | ||
3530 | +} | ||
3531 | + | ||
3532 | +switchfun(0); | ||
3533 | + | ||
3534 | +slide = new Slide({ | ||
3535 | + length: 5, | ||
3536 | + loop: false, | ||
3537 | + auto: false, | ||
3538 | + timeout: 2, | ||
3539 | + index: 1 | ||
3540 | +}); | ||
3541 | + | ||
3542 | +slide.on('change', function(data) { | ||
3543 | + switchfun(data.to); | ||
3544 | +}); | ||
3545 | + | ||
3546 | +$item.mouseover(function() { | ||
3547 | + slide.go($(this).index()); | ||
3548 | +}); | ||
3549 | + | ||
3547 | slide.init(); | 3550 | slide.init(); |
3548 | }); | 3551 | }); |
3549 | define("js/common/yohoui/YH.slide", [], function(require, exports, module){ | 3552 | define("js/common/yohoui/YH.slide", [], function(require, exports, module){ |
@@ -5778,7 +5781,7 @@ $('#login-btn').on('click', function() { | @@ -5778,7 +5781,7 @@ $('#login-btn').on('click', function() { | ||
5778 | } | 5781 | } |
5779 | } else { | 5782 | } else { |
5780 | $passwordTip.removeClass('hide').children('em').html(data.message); | 5783 | $passwordTip.removeClass('hide').children('em').html(data.message); |
5781 | - $password.addClass('error'); | 5784 | + $password.addClass('error').val(''); |
5782 | } | 5785 | } |
5783 | }, | 5786 | }, |
5784 | complete: function() { | 5787 | complete: function() { |
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
-
Please register or login to post a comment