Merge branch 'feature/sale' into release/1.0
Showing
7 changed files
with
79 additions
and
14 deletions
@@ -26,6 +26,7 @@ | @@ -26,6 +26,7 @@ | ||
26 | </li> | 26 | </li> |
27 | </ul> | 27 | </ul> |
28 | <div class="sub-size"> | 28 | <div class="sub-size"> |
29 | + {{log this}} | ||
29 | {{# sub}} | 30 | {{# sub}} |
30 | <div class="size-area"> | 31 | <div class="size-area"> |
31 | <div class="swiper-size" id="size-swiper-{{key}}" {{#if @first}}style="display:block"{{/if}}> | 32 | <div class="swiper-size" id="size-swiper-{{key}}" {{#if @first}}style="display:block"{{/if}}> |
@@ -3,7 +3,9 @@ | @@ -3,7 +3,9 @@ | ||
3 | {{#content}} | 3 | {{#content}} |
4 | {{! 头部banner}} | 4 | {{! 头部banner}} |
5 | {{#if focus}} | 5 | {{#if focus}} |
6 | + <div class="focus-wrap"> | ||
6 | {{> resources/banner-top}} | 7 | {{> resources/banner-top}} |
8 | + </div> | ||
7 | {{/if}} | 9 | {{/if}} |
8 | 10 | ||
9 | {{! 两个小图}} | 11 | {{! 两个小图}} |
@@ -23,12 +25,16 @@ | @@ -23,12 +25,16 @@ | ||
23 | 25 | ||
24 | {{!-- 会员专享 --}} | 26 | {{!-- 会员专享 --}} |
25 | {{#if vipFloor}} | 27 | {{#if vipFloor}} |
28 | + <div class="vip-floor-wrap"> | ||
26 | {{> resources/vip-floor}} | 29 | {{> resources/vip-floor}} |
30 | + </div> | ||
27 | {{/if}} | 31 | {{/if}} |
28 | 32 | ||
29 | {{!-- 断码区 --}} | 33 | {{!-- 断码区 --}} |
30 | {{#if offCodeArea}} | 34 | {{#if offCodeArea}} |
35 | + <div class="off-code-area-wrap"> | ||
31 | {{> resources/off-code-area}} | 36 | {{> resources/off-code-area}} |
37 | + </div> | ||
32 | {{/if}} | 38 | {{/if}} |
33 | 39 | ||
34 | {{!-- OUTLETS --}} | 40 | {{!-- OUTLETS --}} |
@@ -15,8 +15,11 @@ module.exports = { | @@ -15,8 +15,11 @@ module.exports = { | ||
15 | port: 6001, | 15 | port: 6001, |
16 | siteUrl: '//m.yohobuy.com', | 16 | siteUrl: '//m.yohobuy.com', |
17 | domains: { | 17 | domains: { |
18 | - api: 'http://devapi.yoho.cn:58078/', | ||
19 | - service: 'http://devservice.yoho.cn:58077/' | 18 | + api: 'http://testapi.yoho.cn:28078/', |
19 | + service: 'http://testservice.yoho.cn:28077/' | ||
20 | + | ||
21 | + // api: 'http://devapi.yoho.cn:58078/', | ||
22 | + // service: 'http://devservice.yoho.cn:58077/' | ||
20 | }, | 23 | }, |
21 | subDomains: { | 24 | subDomains: { |
22 | host: '.m.yohobuy.com', | 25 | host: '.m.yohobuy.com', |
@@ -31,9 +34,9 @@ module.exports = { | @@ -31,9 +34,9 @@ module.exports = { | ||
31 | useOneapm: false, | 34 | useOneapm: false, |
32 | useCache: false, | 35 | useCache: false, |
33 | memcache: { | 36 | memcache: { |
34 | - master: ['192.168.102.161:11213'], | ||
35 | - slave: ['192.168.102.161:11213'], | ||
36 | - session: ['192.168.102.161:11213'], | 37 | + master: ['192.168.102.222:12111'], |
38 | + slave: ['192.168.102.222:12111'], | ||
39 | + session: ['192.168.102.222:12111'], | ||
37 | timeout: 1000, | 40 | timeout: 1000, |
38 | retries: 0 | 41 | retries: 0 |
39 | }, | 42 | }, |
@@ -113,6 +113,10 @@ $.each($listNav.find('li'), function(key, item) { | @@ -113,6 +113,10 @@ $.each($listNav.find('li'), function(key, item) { | ||
113 | $(item).addClass(goodsType[key]); | 113 | $(item).addClass(goodsType[key]); |
114 | }); | 114 | }); |
115 | 115 | ||
116 | +$.each($swiperSize, function(key, item) { | ||
117 | + $(item).addClass(goodsType[key]); | ||
118 | +}); | ||
119 | + | ||
116 | // 判断导航类型 | 120 | // 判断导航类型 |
117 | function judgeType(dom) { | 121 | function judgeType(dom) { |
118 | var navType; | 122 | var navType; |
@@ -526,8 +530,10 @@ $(function() { | @@ -526,8 +530,10 @@ $(function() { | ||
526 | } else { | 530 | } else { |
527 | selector = '.coat'; | 531 | selector = '.coat'; |
528 | } | 532 | } |
529 | - $selectNav = $('#list-nav').find(selector); | 533 | + $selectNav = $listNav.find(selector); |
530 | $selectNav.addClass('active').siblings().removeClass('active'); | 534 | $selectNav.addClass('active').siblings().removeClass('active'); |
535 | + $swiperSize.hide(); | ||
536 | + $swiperSize.filter(selector).show(); | ||
531 | search([{ | 537 | search([{ |
532 | type: 'breakSort', | 538 | type: 'breakSort', |
533 | id: $selectNav.data('id') | 539 | id: $selectNav.data('id') |
@@ -72,6 +72,15 @@ | @@ -72,6 +72,15 @@ | ||
72 | max-height: 320px; | 72 | max-height: 320px; |
73 | } | 73 | } |
74 | 74 | ||
75 | + .focus-wrap, | ||
76 | + .vip-floor-wrap, | ||
77 | + .off-code-area-wrap { | ||
78 | + .banner-top { | ||
79 | + height: 200px; | ||
80 | + overflow: hidden; | ||
81 | + } | ||
82 | + } | ||
83 | + | ||
75 | .vip-floor { | 84 | .vip-floor { |
76 | border-bottom: 1px solid #e0e0e0; | 85 | border-bottom: 1px solid #e0e0e0; |
77 | 86 |
@@ -19,6 +19,27 @@ const _procProductImg = (product, gender, yhChannel) => { | @@ -19,6 +19,27 @@ const _procProductImg = (product, gender, yhChannel) => { | ||
19 | return product.cover1 || product.imagesUrl || product.cover2 || ''; | 19 | return product.cover1 || product.imagesUrl || product.cover2 || ''; |
20 | }; | 20 | }; |
21 | 21 | ||
22 | +const toArray = (obj) => { | ||
23 | + if (_.isArray(obj)) { | ||
24 | + return obj; | ||
25 | + } | ||
26 | + let arr = []; | ||
27 | + | ||
28 | + _.forEach(obj, (v, k) => { | ||
29 | + if (_.isObject(v)) { | ||
30 | + v._key = k; | ||
31 | + } else { | ||
32 | + v = { | ||
33 | + _key: k, | ||
34 | + _value: v | ||
35 | + }; | ||
36 | + } | ||
37 | + arr.push(v); | ||
38 | + }); | ||
39 | + | ||
40 | + return arr; | ||
41 | +}; | ||
42 | + | ||
22 | /** | 43 | /** |
23 | * 按照数组中指定字段排序二维数组 | 44 | * 按照数组中指定字段排序二维数组 |
24 | * | 45 | * |
@@ -27,14 +48,27 @@ const _procProductImg = (product, gender, yhChannel) => { | @@ -27,14 +48,27 @@ const _procProductImg = (product, gender, yhChannel) => { | ||
27 | * @param boolean 有 desc 时候降序排列,默认为false | 48 | * @param boolean 有 desc 时候降序排列,默认为false |
28 | */ | 49 | */ |
29 | const _sortListByField = (list, key, desc) => { | 50 | const _sortListByField = (list, key, desc) => { |
30 | - list = _.toArray(list); | ||
31 | - list = list.sort((a, b) => { | 51 | + let array = toArray(list); |
52 | + | ||
53 | + array = array.sort((a, b) => { | ||
54 | + let matchNumber = /([\d]+)/g; | ||
55 | + | ||
56 | + // 有键,使用键的值排序 | ||
32 | if (a[key] && b[key]) { | 57 | if (a[key] && b[key]) { |
33 | - return (desc ? a[key] > b[key] : a[key] < b[key]) ? -1 : 1; | 58 | + let numA = +(_.toArray(a[key].match(matchNumber))[0] || 0); // 取第一个出现的数字排序,如果不存在,取0 |
59 | + let numB = +(_.toArray(b[key].match(matchNumber))[0] || 0); | ||
60 | + | ||
61 | + return (desc ? numA > numB : numA < numB) ? -1 : 1; | ||
34 | } | 62 | } |
35 | - return (desc ? a > b : a < b) ? -1 : 1; | 63 | + |
64 | + // 无键, 使用本身 | ||
65 | + let numA = +(_.toArray(a._value.match(matchNumber))[0] || 0); | ||
66 | + let numB = +(_.toArray(b._value.match(matchNumber))[0] || 0); | ||
67 | + | ||
68 | + return numA < numB ? -1 : 1; | ||
36 | }); | 69 | }); |
37 | - return list; | 70 | + |
71 | + return array; | ||
38 | }; | 72 | }; |
39 | 73 | ||
40 | /** | 74 | /** |
@@ -245,7 +279,11 @@ exports.processFilter = (list, options) => { | @@ -245,7 +279,11 @@ exports.processFilter = (list, options) => { | ||
245 | _.forEach(item, (sub, index) => { | 279 | _.forEach(item, (sub, index) => { |
246 | let subs = {}; | 280 | let subs = {}; |
247 | 281 | ||
248 | - if (filtersType[key].dataId === 'key') { | 282 | + if (key === 'discount') { |
283 | + subs.dataId = sub._key; | ||
284 | + } else if (key === 'priceRange') { | ||
285 | + subs.dataId = sub._key; | ||
286 | + } else if (filtersType[key].dataId === 'key') { | ||
249 | subs.dataId = index; | 287 | subs.dataId = index; |
250 | } else if (filtersType[key].dataId === 'relationParameter') { | 288 | } else if (filtersType[key].dataId === 'relationParameter') { |
251 | subs.dataId = sub.relationParameter['sort']; // eslint-disable-line | 289 | subs.dataId = sub.relationParameter['sort']; // eslint-disable-line |
@@ -253,7 +291,9 @@ exports.processFilter = (list, options) => { | @@ -253,7 +291,9 @@ exports.processFilter = (list, options) => { | ||
253 | subs.dataId = sub[filtersType[key].dataId]; | 291 | subs.dataId = sub[filtersType[key].dataId]; |
254 | } | 292 | } |
255 | 293 | ||
256 | - if (filtersType[key].subsName === 'flag') { | 294 | + if (key === 'priceRange') { |
295 | + subs.name = sub._value; | ||
296 | + } else if (filtersType[key].subsName === 'flag') { | ||
257 | subs.name = sub; | 297 | subs.name = sub; |
258 | } else { | 298 | } else { |
259 | subs.name = sub[filtersType[key].subsName]; | 299 | subs.name = sub[filtersType[key].subsName]; |
-
Please register or login to post a comment