Authored by ccbikai

增强搜索

@@ -182,6 +182,14 @@ let search = (req, res, next) => { @@ -182,6 +182,14 @@ let search = (req, res, next) => {
182 let params = Object.assign({}, req.query); 182 let params = Object.assign({}, req.query);
183 let uid = req.user.uid || 0; 183 let uid = req.user.uid || 0;
184 184
  185 + // 断码区域必须传尺码
  186 + if (params.saleType === '1' && (!params.breakSort || !params.breakSize)) {
  187 + return res.render('sale/product', {
  188 + layout: false,
  189 + params: params
  190 + });
  191 + }
  192 +
185 saleModel.getSearchData(params, uid).then((result) => { 193 saleModel.getSearchData(params, uid).then((result) => {
186 let vipLevel = result[1].curLevel; 194 let vipLevel = result[1].curLevel;
187 let vipObj = {}; 195 let vipObj = {};
@@ -518,6 +518,7 @@ $(window).scroll(function() { @@ -518,6 +518,7 @@ $(window).scroll(function() {
518 $(function() { 518 $(function() {
519 var type = window.queryString.type; 519 var type = window.queryString.type;
520 var selector; 520 var selector;
  521 + var $selectNav;
521 522
522 // type 1: 上装, 3:下装, 6: 鞋装 523 // type 1: 上装, 3:下装, 6: 鞋装
523 if (type && type !== '1') { 524 if (type && type !== '1') {
@@ -525,13 +526,14 @@ $(function() { @@ -525,13 +526,14 @@ $(function() {
525 } else { 526 } else {
526 selector = '.coat'; 527 selector = '.coat';
527 } 528 }
528 - $('#list-nav').find(selector).addClass('active').siblings().removeClass('active'); 529 + $selectNav = $('#list-nav').find(selector);
  530 + $selectNav.addClass('active').siblings().removeClass('active');
529 search([{ 531 search([{
530 type: 'breakSort', 532 type: 'breakSort',
531 - id: $(selector).data('id') 533 + id: $selectNav.data('id')
532 }, { 534 }, {
533 type: 'breakSize', 535 type: 'breakSize',
534 - id: $(selector).data('allsub') 536 + id: $selectNav.data('allsub')
535 }]); 537 }]);
536 }); 538 });
537 539