Authored by 阿达

搜索页面参数缺失

... ... @@ -31,6 +31,8 @@ var $input = $('#search-input input'),
$icon = $('.search-icon'),
$clear = $('#search-input .clear-input');
var shopId;
//默认筛选条件
var defaultOpt = require('./query-param');
... ... @@ -86,6 +88,21 @@ $('#search').on('touchend', function() {
});
/**
* 获取url参数
*/
function getQueryString(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return window.unescape(r[2]);
}
return null;
}
shopId = getQueryString('shop_id');
/**
* 筛选注册的回调,筛选子项点击后逻辑
* 需要执行search的场景:1.点选筛选项;2.relaod为true时切换导航;3.下拉加载
* @param opt {type, id}
... ... @@ -95,7 +112,7 @@ function search(opt) {
ext,
att,
nav, navType,
page;
page,params;
if (searching) {
return;
... ... @@ -175,11 +192,17 @@ function search(opt) {
return;
}
$.extend(setting, defaultOpt, {
params = {
type: navType,
order: nav.order,
page: page
});
};
if (shopId) {
params.shop_id = shopId;
}
$.extend(setting, defaultOpt, params);
searching = true;
loading.showLoadingMask();
... ...