Authored by ccbikai

Merge branch 'feature/sale' into release/1.0

... ... @@ -26,6 +26,7 @@
</li>
</ul>
<div class="sub-size">
{{log this}}
{{# sub}}
<div class="size-area">
<div class="swiper-size" id="size-swiper-{{key}}" {{#if @first}}style="display:block"{{/if}}>
... ...
... ... @@ -3,7 +3,9 @@
{{#content}}
{{! 头部banner}}
{{#if focus}}
<div class="focus-wrap">
{{> resources/banner-top}}
</div>
{{/if}}
{{! 两个小图}}
... ... @@ -23,12 +25,16 @@
{{!-- 会员专享 --}}
{{#if vipFloor}}
<div class="vip-floor-wrap">
{{> resources/vip-floor}}
</div>
{{/if}}
{{!-- 断码区 --}}
{{#if offCodeArea}}
<div class="off-code-area-wrap">
{{> resources/off-code-area}}
</div>
{{/if}}
{{!-- OUTLETS --}}
... ...
... ... @@ -15,8 +15,11 @@ module.exports = {
port: 6001,
siteUrl: '//m.yohobuy.com',
domains: {
api: 'http://devapi.yoho.cn:58078/',
service: 'http://devservice.yoho.cn:58077/'
api: 'http://testapi.yoho.cn:28078/',
service: 'http://testservice.yoho.cn:28077/'
// api: 'http://devapi.yoho.cn:58078/',
// service: 'http://devservice.yoho.cn:58077/'
},
subDomains: {
host: '.m.yohobuy.com',
... ... @@ -31,9 +34,9 @@ module.exports = {
useOneapm: false,
useCache: false,
memcache: {
master: ['192.168.102.161:11213'],
slave: ['192.168.102.161:11213'],
session: ['192.168.102.161:11213'],
master: ['192.168.102.222:12111'],
slave: ['192.168.102.222:12111'],
session: ['192.168.102.222:12111'],
timeout: 1000,
retries: 0
},
... ...
... ... @@ -113,6 +113,10 @@ $.each($listNav.find('li'), function(key, item) {
$(item).addClass(goodsType[key]);
});
$.each($swiperSize, function(key, item) {
$(item).addClass(goodsType[key]);
});
// 判断导航类型
function judgeType(dom) {
var navType;
... ... @@ -526,8 +530,10 @@ $(function() {
} else {
selector = '.coat';
}
$selectNav = $('#list-nav').find(selector);
$selectNav = $listNav.find(selector);
$selectNav.addClass('active').siblings().removeClass('active');
$swiperSize.hide();
$swiperSize.filter(selector).show();
search([{
type: 'breakSort',
id: $selectNav.data('id')
... ...
... ... @@ -72,6 +72,15 @@
max-height: 320px;
}
.focus-wrap,
.vip-floor-wrap,
.off-code-area-wrap {
.banner-top {
height: 200px;
overflow: hidden;
}
}
.vip-floor {
border-bottom: 1px solid #e0e0e0;
... ...
... ... @@ -19,6 +19,27 @@ const _procProductImg = (product, gender, yhChannel) => {
return product.cover1 || product.imagesUrl || product.cover2 || '';
};
const toArray = (obj) => {
if (_.isArray(obj)) {
return obj;
}
let arr = [];
_.forEach(obj, (v, k) => {
if (_.isObject(v)) {
v._key = k;
} else {
v = {
_key: k,
_value: v
};
}
arr.push(v);
});
return arr;
};
/**
* 按照数组中指定字段排序二维数组
*
... ... @@ -27,14 +48,27 @@ const _procProductImg = (product, gender, yhChannel) => {
* @param boolean 有 desc 时候降序排列,默认为false
*/
const _sortListByField = (list, key, desc) => {
list = _.toArray(list);
list = list.sort((a, b) => {
let array = toArray(list);
array = array.sort((a, b) => {
let matchNumber = /([\d]+)/g;
// 有键,使用键的值排序
if (a[key] && b[key]) {
return (desc ? a[key] > b[key] : a[key] < b[key]) ? -1 : 1;
let numA = +(_.toArray(a[key].match(matchNumber))[0] || 0); // 取第一个出现的数字排序,如果不存在,取0
let numB = +(_.toArray(b[key].match(matchNumber))[0] || 0);
return (desc ? numA > numB : numA < numB) ? -1 : 1;
}
return (desc ? a > b : a < b) ? -1 : 1;
// 无键, 使用本身
let numA = +(_.toArray(a._value.match(matchNumber))[0] || 0);
let numB = +(_.toArray(b._value.match(matchNumber))[0] || 0);
return numA < numB ? -1 : 1;
});
return list;
return array;
};
/**
... ... @@ -245,7 +279,11 @@ exports.processFilter = (list, options) => {
_.forEach(item, (sub, index) => {
let subs = {};
if (filtersType[key].dataId === 'key') {
if (key === 'discount') {
subs.dataId = sub._key;
} else if (key === 'priceRange') {
subs.dataId = sub._key;
} else if (filtersType[key].dataId === 'key') {
subs.dataId = index;
} else if (filtersType[key].dataId === 'relationParameter') {
subs.dataId = sub.relationParameter['sort']; // eslint-disable-line
... ... @@ -253,7 +291,9 @@ exports.processFilter = (list, options) => {
subs.dataId = sub[filtersType[key].dataId];
}
if (filtersType[key].subsName === 'flag') {
if (key === 'priceRange') {
subs.name = sub._value;
} else if (filtersType[key].subsName === 'flag') {
subs.name = sub;
} else {
subs.name = sub[filtersType[key].subsName];
... ...