Authored by uedxwg

updata

@@ -244,6 +244,7 @@ function search(opt) { @@ -244,6 +244,7 @@ function search(opt) {
244 lazyLoad($('.lazy')); 244 lazyLoad($('.lazy'));
245 245
246 filter.registerCbFn(search); 246 filter.registerCbFn(search);
  247 +
247 // loading.initLoadingMask(); 248 // loading.initLoadingMask();
248 249
249 //导航栏点击逻辑说明: 250 //导航栏点击逻辑说明:
@@ -273,7 +274,6 @@ $listNav.delegate('li', 'tap', function() { @@ -273,7 +274,6 @@ $listNav.delegate('li', 'tap', function() {
273 274
274 $pre.removeClass('active'); 275 $pre.removeClass('active');
275 $this.addClass('active'); 276 $this.addClass('active');
276 -  
277 filter.showFilter(); 277 filter.showFilter();
278 } 278 }
279 } else { 279 } else {
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 23
24 .banner-top-single{ 24 .banner-top-single{
25 width: 100%; 25 width: 100%;
26 - height: 240rem / $pxConvertRem; 26 + height: 200rem / $pxConvertRem;
27 img { 27 img {
28 display: block; 28 display: block;
29 height: 100%; 29 height: 100%;
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 3
4 .swiper-container { 4 .swiper-container {
5 width: 100%; 5 width: 100%;
6 - height: 200rem / $pxConvertRem; 6 + height: 310rem / $pxConvertRem;
7 7
8 img { 8 img {
9 height: 100%; 9 height: 100%;
@@ -203,20 +203,9 @@ class SearchController extends AbstractAction @@ -203,20 +203,9 @@ class SearchController extends AbstractAction
203 203
204 // 转换排序方式 204 // 转换排序方式
205 $page = $this->get('page', 1); 205 $page = $this->get('page', 1);
206 - $order = $this->get('order', 0); 206 + $orderVal = $this->get('order', 0);
207 $type = $this->get('type', ''); 207 $type = $this->get('type', '');
208 - switch ($type) {  
209 - case 'price':  
210 - $order = ($order == 0) ? 's_p_desc' : 's_p_asc';  
211 - break;  
212 - case 'discount':  
213 - $order = ($order == 0) ? 'p_d_desc' : 'p_d_asc';  
214 - break;  
215 - case 'newest':  
216 - default:  
217 - $order = ($order == 0) ? 's_t_desc' : 's_t_asc';  
218 - break;  
219 - } 208 + $order = Helpers::transOrder($orderVal, $type);
220 209
221 $data = array(); 210 $data = array();
222 // 查询品类或品牌数据 211 // 查询品类或品牌数据
@@ -258,6 +247,56 @@ class SearchController extends AbstractAction @@ -258,6 +247,56 @@ class SearchController extends AbstractAction
258 } 247 }
259 248
260 /** 249 /**
  250 + * Ajax异步获取筛选数据
  251 + * @return array 筛选数据
  252 + */
  253 + public function filterAction()
  254 + {
  255 + if ($this->isAjax()) {
  256 + // 过滤请求参数
  257 + $condition = filter_input_array(INPUT_GET, array(
  258 + 'query' => FILTER_DEFAULT,
  259 + 'brand' => FILTER_VALIDATE_INT,
  260 + 'sort' => FILTER_DEFAULT,
  261 + 'msort' => FILTER_VALIDATE_INT,
  262 + 'misort' => FILTER_VALIDATE_INT,
  263 + 'color' => FILTER_VALIDATE_INT,
  264 + 'size' => FILTER_VALIDATE_INT,
  265 + 'price' => FILTER_VALIDATE_INT,
  266 + 'discount' => FILTER_DEFAULT,
  267 + 'gender' => FILTER_DEFAULT,
  268 + 'p_d' => FILTER_DEFAULT,), false);
  269 +
  270 + if (isset($condition['sort'])) {
  271 + $condition['sort'] = rawurldecode($condition['sort']);
  272 + }
  273 + if (isset($condition['discount'])) {
  274 + $condition['p_d'] = rawurldecode($condition['discount']);
  275 + unset($condition['discount']);
  276 + }
  277 + if (isset($condition['gender'])) {
  278 + $condition['gender'] = rawurldecode($condition['gender']);
  279 + }
  280 +
  281 + $data = array();
  282 + $listData = SearchData::searchByCondition($condition);
  283 + // 处理返回的数据
  284 + if (isset($listData['data']) && isset($listData['data']['filter'])) {
  285 + $data['filter'] = ListProcess::getFilterData($listData['data']['filter']);
  286 + }
  287 + $listData = array();
  288 +
  289 + if (empty($data)) {
  290 + echo ' ';
  291 + } else {
  292 + $this->_view->display('filter', $data);
  293 + }
  294 + } else {
  295 + echo ' ';
  296 + }
  297 + }
  298 +
  299 + /**
261 * 模糊搜索指定字符 300 * 模糊搜索指定字符
262 * 301 *
263 * @return array 模糊搜索的结果 302 * @return array 模糊搜索的结果