Authored by 姜枫

fix bugs

... ... @@ -61,6 +61,10 @@ const shop = {
data.showEditorial = editorial && editorial.length === 3;
data.editorial = editorial;
_.forEach(editorial, (e) => {
e.title = e.title.length > 40 ? (e.title.substring(0, 40) + '...') : e.title;
});
if (productData && productData.code === 200 && productData.data) {
let ret = camelCase(productData.data);
... ... @@ -89,9 +93,9 @@ const shop = {
};
let nav = [DataHelper.getChannelNav()];
let domain = req.params.domain;
let uid = req.user.uid;
let q = req.query;
let hasBrand = !!q.brand;
q.order = q.order || 's_n_desc';
q.page = parseInt(q.page || 1, 10);
... ... @@ -125,9 +129,11 @@ const shop = {
let ret = camelCase(result.data);
if (ret.filter) {
delete q.brand;
if (!hasBrand) {
delete q.brand;
}
ret.filter.groupSort = DataHelper.sortConvert(allSort.data.sort);
data.filter = DataHelper.filterHandle(ret.filter, req.query);
data.filter = DataHelper.filterHandle(ret.filter, q);
data.filter.showPrice = ret.total > 10;
}
... ...
... ... @@ -233,23 +233,29 @@ const helpers = {
}
});
if (sorts && sorts.length === 1) {
singleSort = true;
if (sorts) {
// singleSort = true;
//
// if (sorts[0].sub && sorts[0].sub.length === 1) {
// sorts[0].sub[0].checked = true;
// }
//
// if (q.misort) {
// sorts[0].sub.forEach(s => {
// s.checked = s.categoryId === q.misort;
// });
// }
//
// sorts = sorts[0].sub;
// } else if (sorts && sorts.length > 1) {
if (sorts[0].sub && sorts[0].sub.length === 1) {
sorts[0].sub[0].checked = true;
}
if (q.misort) {
sorts[0].sub.forEach(s => {
s.checked = s.categoryId === q.misort;
_.forEach(sorts, s => {
s.sub.unshift({
categoryName: '全部' + s.categoryName,
categoryId: '',
checked: q.msort && q.msort === s.categoryId && !q.misort
});
}
sorts = sorts[0].sub;
} else if (sorts && sorts.length > 1) {
_.forEach(sorts, s => {
_.forEach(s.sub, ss => {
if (q.misort && q.misort === ss.categoryId) {
ss.checked = true;
... ... @@ -317,7 +323,7 @@ const helpers = {
return (',' + q.brand + ',').indexOf(',' + b.id + ',') >= 0;
}).map(b => {
b.checked = true;
return b.brandName;
return b.brandNameEn || b.brandName;
}).join('、');
if (brandNames) {
... ...
... ... @@ -120,7 +120,6 @@
</a>
<div class="desc">
<a class="name" href="{{url}}" target="_blank">{{title}}</a>
<p class="intro">{{intro}}</p>
</div>
</div>
{{/each}}
... ...
... ... @@ -74,7 +74,7 @@
<div class="brand-list nano">
<div class="nano-content">
{{#each brandData}}
<div class="input-radio" data-value="{{id}}">
<div class="input-radio {{#if checked}}default-check{{/if}}" data-value="{{id}}">
{{> icon/radio}}
{{#if brandNameEn}}
<label>{{brandNameEn}}</label>
... ...
... ... @@ -24,7 +24,7 @@ var jQuery = require('yoho-jquery');
init: function(options) {
var type = options.type || defaults.type;
var ele = this;
var _checked = $('.iconfont', this).hasClass('checked');
var _checked = options.checked || $('.iconfont', this).hasClass('checked');
options = $.extend({}, defaults, $(this).data('options'), defaultsHtml[type], options);
... ...
... ... @@ -60,6 +60,7 @@ var YohoListPage = {
YohoListPage.go({
msort: categoryId,
misort: subCategoryId,
size: '',
page: 1
});
}
... ... @@ -301,6 +302,11 @@ var YohoListPage = {
$('.input-radio', this.brandsDoc).check({
type: 'radio'
});
$('.input-radio.default-check', this.brandsDoc).check({
type: 'radio',
checked: true
});
},
openStyleMulit: function() {
... ...
... ... @@ -17,6 +17,9 @@
.input-radio {
padding: 10px 1px;
cursor: pointer;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
.round-color {
width: 22px;
... ... @@ -41,11 +44,8 @@
font-size: 14px;
font-weight: 700;
margin-left: 10px;
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 200px;
}
.input-radio label.round-color {
margin-left: 0;
}
... ... @@ -369,6 +369,7 @@
.blk-pagination {
text-align: center;
margin: 20px 0 40px;
width: auto;
li {
width: auto;
... ...
... ... @@ -182,18 +182,14 @@
border-width: 1px;
.desc {
margin-top: 20px;
margin-top: 10px;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 25px;
}
.name,
.intro {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 10px 0;
}
}
... ...