Authored by xiaowei

H5修复分类不显示的bug

@@ -19,7 +19,13 @@ @@ -19,7 +19,13 @@
19 <div class="content {{#unless focus}}hide{{/if}}"> 19 <div class="content {{#unless focus}}hide{{/if}}">
20 <ul class="primary-level"> 20 <ul class="primary-level">
21 {{# ca}} 21 {{# ca}}
22 - <li class="p-level-item{{#if @first}} focus{{/if}}">{{name}}</li> 22 + <li class="p-level-item{{#if @first}} focus{{/if}}">
  23 + {{#if url}}
  24 + <a href={{url}}> {{name}}</a>
  25 + {{^}}
  26 + {{name}}
  27 + {{/if}}
  28 + </li>
23 {{/ ca}} 29 {{/ ca}}
24 </ul> 30 </ul>
25 <div class="sub-level-container"> 31 <div class="sub-level-container">
@@ -54,7 +54,17 @@ class ClassModel @@ -54,7 +54,17 @@ class ClassModel
54 $item['name'] = $val['category_name']; 54 $item['name'] = $val['category_name'];
55 $item['id'] = $val['relation_parameter']['sort']; 55 $item['id'] = $val['relation_parameter']['sort'];
56 56
57 - // 首先添加一级分类 57 + if (!isset($val['sub'])) {
  58 + //ficx-bug根节点没有子分类,直接跳转相应品类页面
  59 + $item['url'] = Helpers::url('/', array(
  60 + 'sort' => $item['id'],
  61 + 'sort_name' => $item['name'],
  62 + 'gender' => $genderArr[$k]), 'list');
  63 + $oneClass['ca'][] = $item;
  64 + continue;
  65 + }
  66 +
  67 + //有子分类的,首先添加一级分类
58 $item['sub'][] = array( 68 $item['sub'][] = array(
59 'name' => '全部' . $item['name'], 69 'name' => '全部' . $item['name'],
60 'id' => $item['id'], 70 'id' => $item['id'],
@@ -64,10 +74,6 @@ class ClassModel @@ -64,10 +74,6 @@ class ClassModel
64 'gender' => $genderArr[$k]), 'list') 74 'gender' => $genderArr[$k]), 'list')
65 ); 75 );
66 76
67 - if(!isset($val['sub'])) {  
68 - continue;  
69 - }  
70 -  
71 $subitem = array(); 77 $subitem = array();
72 foreach ($val['sub'] as $value) { 78 foreach ($val['sub'] as $value) {
73 $subitem = array(); 79 $subitem = array();
@@ -86,7 +92,8 @@ class ClassModel @@ -86,7 +92,8 @@ class ClassModel
86 92
87 $result[] = $oneClass; 93 $result[] = $oneClass;
88 } 94 }
89 - } while (false); 95 + }
  96 + while (false);
90 97
91 if (USE_CACHE) { 98 if (USE_CACHE) {
92 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. 99 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.