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,38 +196,44 @@ @@ -196,38 +196,44 @@
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">  
200 - {{name}}  
201 - <span class="iconfont">&#xe600;</span> 199 + <li class="attr{{#unless sub}} no-sub{{/unless}}">
  200 + {{#if sub}}
  201 + {{name}}
  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}}
210 - <div class="senior-sub hide" data-attr="{{attr}}">  
211 - <div class="senior-content">  
212 - {{#if showMulti}}  
213 - <span class="multi-select">多选 +</span>  
214 - {{/if}}  
215 - <ul class="clearfix check-container">  
216 - {{#each sub}}  
217 - <li class="attr {{#if checked}}checked{{/if}}">  
218 - <a href="{{href}}">  
219 - <span class="iconfont checkbox" data-id="{{id}}">&#xe613;</span>  
220 - <span>{{name}}</span>  
221 - </a>  
222 - </li>  
223 - {{/each}}  
224 - </ul>  
225 - <div class="btns">  
226 - <button class="multi-select-ok dis">确定</button>  
227 - <button class="multi-select-cancel">取消</button> 214 + {{#if sub}}
  215 + <div class="senior-sub hide" data-attr="{{attr}}">
  216 + <div class="senior-content">
  217 + {{#if showMulti}}
  218 + <span class="multi-select">多选 +</span>
  219 + {{/if}}
  220 + <ul class="clearfix check-container">
  221 + {{#each sub}}
  222 + <li class="attr {{#if checked}}checked{{/if}}">
  223 + <a href="{{href}}">
  224 + <span class="iconfont checkbox" data-id="{{id}}">&#xe613;</span>
  225 + <span>{{name}}</span>
  226 + </a>
  227 + </li>
  228 + {{/each}}
  229 + </ul>
  230 + <div class="btns">
  231 + <button class="multi-select-ok dis">确定</button>
  232 + <button class="multi-select-cancel">取消</button>
  233 + </div>
228 </div> 234 </div>
229 </div> 235 </div>
230 - </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 ),