Authored by 郭成尧

ajax-params-handle

@@ -13,6 +13,7 @@ const _ = require('lodash'); @@ -13,6 +13,7 @@ const _ = require('lodash');
13 const helpers = global.yoho.helpers; 13 const helpers = global.yoho.helpers;
14 const searchProcess = require(`${utils}/search-process`); 14 const searchProcess = require(`${utils}/search-process`);
15 const productProcess = require(`${utils}/product-process`); 15 const productProcess = require(`${utils}/product-process`);
  16 +const listParamsProcess = require(`${utils}/list-params-process`);
16 const co = require('bluebird').coroutine; 17 const co = require('bluebird').coroutine;
17 18
18 /** 19 /**
@@ -218,7 +219,11 @@ exports.search = (req, res, next) => { @@ -218,7 +219,11 @@ exports.search = (req, res, next) => {
218 res.setHeader('Access-Control-Allow-Origin', allowOrigin); 219 res.setHeader('Access-Control-Allow-Origin', allowOrigin);
219 res.setHeader('Access-Control-Allow-Credentials', 'true'); 220 res.setHeader('Access-Control-Allow-Credentials', 'true');
220 221
221 - let params = Object.assign({}, req.query); 222 + let currentUrlParams = listParamsProcess.getParams(req.query.currentUrl);
  223 +
  224 + delete req.query.currentUrl;
  225 +
  226 + let params = Object.assign({}, req.query, currentUrlParams);
222 let uid = req.user.uid || 0; 227 let uid = req.user.uid || 0;
223 228
224 if (uid) { 229 if (uid) {
@@ -527,7 +527,9 @@ function search(opt) { @@ -527,7 +527,9 @@ function search(opt) {
527 params.categoryId = categoryId; 527 params.categoryId = categoryId;
528 } 528 }
529 529
530 - $.extend(setting, defaultOpt, params); 530 + $.extend(setting, defaultOpt, params, {
  531 + currentUrl: location.pathname
  532 + });
531 searching = true; 533 searching = true;
532 loading.showLoadingMask(); 534 loading.showLoadingMask();
533 535