Authored by xuqi

senior sub without sub

@@ -513,6 +513,11 @@ @@ -513,6 +513,11 @@
513 { 513 {
514 attr: 'style', //查找的键值 514 attr: 'style', //查找的键值
515 name: '风格', 515 name: '风格',
  516 +
  517 + //若无子项,传url
  518 + url: '',
  519 +
  520 + //若有子项,传sub
516 showMulti: true, //是否显示多选按钮 521 showMulti: true, //是否显示多选按钮
517 sub: [ 522 sub: [
518 { 523 {
@@ -196,17 +196,22 @@ @@ -196,17 +196,22 @@
196 <div class="attr-content"> 196 <div class="attr-content">
197 <ul class="clearfix senior-attr-wrap"> 197 <ul class="clearfix senior-attr-wrap">
198 {{#each seniorChose}} 198 {{#each seniorChose}}
199 - <li class="attr"> 199 + <li class="attr{{#unless sub}} no-sub{{/unless}}">
  200 + {{#if sub}}
200 {{name}} 201 {{name}}
201 <span class="iconfont">&#xe600;</span> 202 <span class="iconfont">&#xe600;</span>
202 203
203 <div class="senior-up-icon"></div> 204 <div class="senior-up-icon"></div>
  205 + {{^}}
  206 + <a href="{{url}}">{{name}}</a>
  207 + {{/if}}
204 </li> 208 </li>
205 {{/each}} 209 {{/each}}
206 </ul> 210 </ul>
207 211
208 <div class="senior-sub-wrap"> 212 <div class="senior-sub-wrap">
209 {{#each seniorChose}} 213 {{#each seniorChose}}
  214 + {{#if sub}}
210 <div class="senior-sub hide" data-attr="{{attr}}"> 215 <div class="senior-sub hide" data-attr="{{attr}}">
211 <div class="senior-content"> 216 <div class="senior-content">
212 {{#if showMulti}} 217 {{#if showMulti}}
@@ -228,6 +233,7 @@ @@ -228,6 +233,7 @@
228 </div> 233 </div>
229 </div> 234 </div>
230 </div> 235 </div>
  236 + {{/if}}
231 {{/each}} 237 {{/each}}
232 </div> 238 </div>
233 </div> 239 </div>
@@ -309,6 +309,9 @@ $seniorAttrWrap.on('mouseenter', '.attr', function() { @@ -309,6 +309,9 @@ $seniorAttrWrap.on('mouseenter', '.attr', function() {
309 var $this = $(this); 309 var $this = $(this);
310 var index = $this.index(); 310 var index = $this.index();
311 311
  312 + if ($this.hasClass('no-sub')) {
  313 + return;
  314 + }
312 $this.addClass('hover').siblings().removeClass('hover'); 315 $this.addClass('hover').siblings().removeClass('hover');
313 316
314 $seniorSubWrap.children('.senior-sub:eq(' + index + ')').removeClass('hide').siblings().addClass('hide'); 317 $seniorSubWrap.children('.senior-sub:eq(' + index + ')').removeClass('hide').siblings().addClass('hide');
@@ -316,6 +319,10 @@ $seniorAttrWrap.on('mouseenter', '.attr', function() { @@ -316,6 +319,10 @@ $seniorAttrWrap.on('mouseenter', '.attr', function() {
316 var $this = $(this), 319 var $this = $(this),
317 index = $this.index(); 320 index = $this.index();
318 321
  322 + if ($this.hasClass('no-sub')) {
  323 + return;
  324 + }
  325 +
319 hoveredIndex = index; 326 hoveredIndex = index;
320 327
321 seniorHoverTime = setTimeout(function() { 328 seniorHoverTime = setTimeout(function() {
@@ -248,19 +248,7 @@ class Index1Controller extends AbstractAction @@ -248,19 +248,7 @@ class Index1Controller extends AbstractAction
248 array( 248 array(
249 'attr' => 'weather', 249 'attr' => 'weather',
250 'name' => '适用季节', 250 'name' => '适用季节',
251 - 'sub' => array(  
252 - array(  
253 - 'id' => '1',  
254 - 'href' => '',  
255 - 'name' => '春天',  
256 - 'checked' => true  
257 - ),  
258 - array(  
259 - 'id' => '2',  
260 - 'href' => '',  
261 - 'name' => '夏天'  
262 - )  
263 - ) 251 + 'url' => ''
264 ) 252 )
265 ) 253 )
266 ), 254 ),