Authored by 姜敏

Merge branch 'release/1.0' of http://git.yoho.cn/fe/yoho-blk into release/1.0

... ... @@ -27,13 +27,16 @@ const list = {
title: '列表'
};
Search.queryProduct(q).then(result => {
Promise.all([Search.queryAllSort(), Search.queryProduct(q)]).then(allResult => {
let allSort = camelCase(allResult[0]);
let result = allResult[1];
if (result && result.code === 200 && result.data) {
let data = camelCase(result.data);
let nav = [DataHelper.getChannelNav()];
if (data.filter) {
data.filter.groupSort = DataHelper.sortConvert(allSort.data.sort);
retData.filter = DataHelper.filterHandle(data.filter, q);
retData.filter.showPrice = data.total > 10;
nav = _.concat(nav, retData.filter.nav);
... ... @@ -74,9 +77,10 @@ const list = {
title: '列表'
};
Promise.all([Resouces.newProductBanner(), Search.queryNewProduct(q)]).then(result => {
Promise.all([Resouces.newProductBanner(), Search.queryAllSort(), Search.queryNewProduct(q)]).then(result => {
let banner = result[0];
let listData = result[1];
let sortData = camelCase(result[1]);
let listData = result[2];
let nav = [DataHelper.getChannelNav(), {
name: '新品'
}];
... ... @@ -87,6 +91,7 @@ const list = {
let data = camelCase(listData.data);
if (data.filter) {
data.filter.groupSort = DataHelper.sortConvert(sortData.data.sort);
retData.filter = DataHelper.filterHandle(data.filter, q);
retData.filter.showPrice = data.total > 10;
}
... ...
... ... @@ -28,7 +28,9 @@ const Query = {
query: query
};
Search.queryProduct(q).then(result => {
Promise.all([Search.queryAllSort(), Search.queryProduct(q)]).then(allResult => {
let allSort = camelCase(allResult[0]);
let result = allResult[1];
if (result && result.code === 200 && result.data) {
let data = camelCase(result.data);
... ... @@ -39,6 +41,7 @@ const Query = {
});
if (data.filter) {
data.filter.groupSort = DataHelper.sortConvert(allSort.data.sort);
retData.filter = DataHelper.filterHandle(data.filter, q);
retData.filter.showPrice = data.total > 10;
}
... ...
... ... @@ -111,15 +111,23 @@ const shop = {
});
} else {
res.status(404);
return Promise.reject('brand not found');
return Promise.reject('brand-not-found');
}
}).then(() => {
return Search.queryProductOfBrand(q).then(result => {
return Promise.all([Search.queryAllSort({
brand: q.brand,
shop: q.shop_id,
small_sort: 1
}), Search.queryProductOfBrand(q)]).then(allResult => {
let allSort = camelCase(allResult[0]);
let result = allResult[1];
if (result && result.code === 200 && result.data) {
let ret = camelCase(result.data);
if (ret.filter) {
delete q.brand;
ret.filter.groupSort = DataHelper.sortConvert(allSort.data.sort);
data.filter = DataHelper.filterHandle(ret.filter, req.query);
data.filter.showPrice = ret.total > 10;
}
... ...
... ... @@ -96,27 +96,28 @@ const helpers = {
* @param sorts
* @returns {Array}
*/
getSortNav(sort, sorts) {
getSortNav(msort, misort, sorts) {
let nav = [];
let sortQuery = '?';
if (sort && sorts) {
if (msort && sorts) {
sorts.forEach(s => {
if (s.relationParameter.sort === sort) {
if (s.categoryId === msort) {
sortQuery += 'msort=' + msort;
s.checked = true;
nav.push({
link: '#',
link: sortQuery,
pathTitle: '',
name: s.categoryName
});
} else if (s.sub) {
}
if (s.sub && misort) {
s.sub.forEach(m => {
if (m.relationParameter.sort === sort) {
nav.push({
link: '#',
pathTitle: '',
name: s.categoryName
});
if (m.categoryId === misort) {
sortQuery += '&misort=' + misort;
m.checked = true;
nav.push({
link: '#',
link: sortQuery,
pathTitle: '',
name: m.categoryName
});
... ... @@ -143,6 +144,16 @@ const helpers = {
};
},
sortConvert(sorts) {
return _.map(sorts, s => {
return {
categoryId: s.sortId,
categoryName: s.sortName,
sub: helpers.sortConvert(s.sub)
};
});
},
/**
* 筛选器数据处理
* @param filter
... ... @@ -160,6 +171,7 @@ const helpers = {
let filters = [];
let customPriceLow = '';
let customPriceHigh = '';
let showSize = (!!q.sort || !!q.misort);
genders.forEach(g => {
if (g.value === q.gender) {
... ... @@ -222,6 +234,7 @@ const helpers = {
}
if (q.size) {
showSize = false;
sizeInfo.forEach(s => {
if (s.sizeId === parseInt(q.size, 10)) {
s.checked = true;
... ... @@ -270,9 +283,9 @@ const helpers = {
letters: this.brandLetters(),
customPriceLow: customPriceLow,
customPriceHigh: customPriceHigh,
showSize: !!q.sort,
showSize: showSize,
showPrice: true,
nav: this.getSortNav(q.sort, sorts)
nav: this.getSortNav(q.msort, q.misort, sorts)
};
},
... ...
... ... @@ -47,7 +47,7 @@ const Search = {
},
queryProductOfBrand(params) {
let finalParams = {
method: 'app.search.brand',
method: 'app.search.li',
limit: 45,
app_type: 1
};
... ... @@ -67,11 +67,11 @@ const Search = {
return api.get('', finalParams);
},
queryAllSort() {
return api.get('', {
method: 'app.sort.get',
queryAllSort(params) {
return api.get('', _.assign({
method: 'web.regular.groupsort',
app_type: 1
});
}, params), {code: 200});
}
};
... ...
... ... @@ -10,7 +10,7 @@
{{> list/banner-info }}
</div>
<div class="center-content clearfix">
<div class="yoho-product-list-content center-content clearfix">
<div class="left">
{{!-- 筛选区域 --}}
{{#filter}}
... ...
... ... @@ -34,7 +34,7 @@
<div class="title">全部品类</div>
<div class="yoho-ui-accordion no-active">
{{#each sortData}}
<h3>{{categoryName}}</h3>
<h3 {{#if checked}}class="active"{{/if}}>{{categoryName}}</h3>
<div class="body" data-value="{{categoryId}}">
<div class="list-body nano">
<div class="nano-content">
... ...
... ... @@ -19,8 +19,10 @@ module.exports = {
},
cookieDomain: 'yohobuy.com',
domains: {
api: 'http://testapi.yoho.cn:28078/', // devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
service: 'http://testservice.yoho.cn:28077/', // testservice.yoho.cn:28077 devservice.yoho.cn:58077
api: 'http://devapi.yoho.cn:58078/', // devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
service: 'http://devservice.yoho.cn:58077/', // testservice.yoho.cn:28077 devservice.yoho.cn:58077
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
search: 'http://192.168.102.216:8080/yohosearch/'
},
useOneapm: false,
... ...
... ... @@ -23,12 +23,18 @@ var YohoListPage = {
$('.yoho-ui-accordion', this.rootDoc).each(function() {
var opts = {
collapsible: true,
heightStyle: 'content'
heightStyle: 'content',
active: 0
};
if ($(this).hasClass('no-active')) {
opts.active = false;
}
$(this).find('h3').each(function(index) {
if ($(this).hasClass('active')) {
opts.active = index;
}
});
$(this).accordion(opts);
});
... ... @@ -45,14 +51,13 @@ var YohoListPage = {
$('.list-body .input-radio', this.rootDoc).check({
type: 'radio',
group: 'sort',
onChange: function(ele, checked, value) {
onChange: function(ele) {
var subCategoryId = $(ele).data('category');
var categoryId = $(ele).parents('.body').data('value');
YohoListPage.go({
categoryId: categoryId,
subCategoryId: subCategoryId,
sort: checked ? value : ''
msort: categoryId,
misort: subCategoryId
});
}
});
... ...
... ... @@ -340,6 +340,11 @@
text-align: center;
margin: 20px 0 40px;
li {
width: auto;
margin: 0 4px;
}
li:first-child,
li:last-child {
border-width: 2px;
... ...
.yoho-product-list,
.yoho-shop-index {
.yoho-product-list-content {
margin-top: 30px;
}
.brand-banner {
width: 100%;
height: 150px;
... ... @@ -37,7 +41,6 @@
.shop-menu {
border-bottom: 1px solid #eee;
margin-bottom: 30px;
li {
display: inline-block;
... ...