Authored by 郭成尧

listview-name-change

1 -<div class="guang-detail-page guang-page yoho-page {{#if guangDetail}}guang-detail{{/if}} {{#if guangEzine}}guang-ezine{{/if}}"> 1 +<div class="guang-detail-page guang-page yoho-page {{#if guangDetail}}guang-detail{{/if}} {{#if guangEzine}}guang-ezine{{/if}}" id="guangDetail">
2 {{# guang}} 2 {{# guang}}
3 <div id="wrapper" > 3 <div id="wrapper" >
4 <div id="scroller" class="{{channel}}"> 4 <div id="scroller" class="{{channel}}">
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2017-04-26 17:19:19 3 * @Date: 2017-04-26 17:19:19
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2017-05-02 13:51:31 5 + * @Last Modified time: 2017-05-02 14:40:52
6 */ 6 */
7 'use strict'; 7 'use strict';
8 8
@@ -10,7 +10,7 @@ const lazyLoad = require('yoho-jquery-lazyload'); @@ -10,7 +10,7 @@ const lazyLoad = require('yoho-jquery-lazyload');
10 10
11 import {Controller} from 'yoho-mvc'; 11 import {Controller} from 'yoho-mvc';
12 import { 12 import {
13 - NavView 13 + ListView
14 } from './view'; 14 } from './view';
15 import { 15 import {
16 Guang 16 Guang
@@ -22,14 +22,14 @@ class IndexController extends Controller { @@ -22,14 +22,14 @@ class IndexController extends Controller {
22 22
23 lazyLoad($('img.lazy')); 23 lazyLoad($('img.lazy'));
24 24
25 - this.navView = new NavView(); 25 + this.listView = new ListView();
26 this.guangModel = new Guang(); 26 this.guangModel = new Guang();
27 27
28 this.page = 1; 28 this.page = 1;
29 this.onLoading = false; 29 this.onLoading = false;
30 30
31 - this.navView.on('tabchange', this.tabChange.bind(this));  
32 - this.navView.on('loadmore', this.loadMore.bind(this)); 31 + this.listView.on('tabchange', this.tabChange.bind(this));
  32 + this.listView.on('loadmore', this.loadMore.bind(this));
33 } 33 }
34 34
35 /** 35 /**
@@ -47,7 +47,7 @@ class IndexController extends Controller { @@ -47,7 +47,7 @@ class IndexController extends Controller {
47 let $result = $(result); 47 let $result = $(result);
48 48
49 lazyLoad($result.find('img.lazy')); 49 lazyLoad($result.find('img.lazy'));
50 - this.navView.listChange($result); 50 + this.listView.listChange($result);
51 }); 51 });
52 } 52 }
53 53
@@ -64,14 +64,14 @@ class IndexController extends Controller { @@ -64,14 +64,14 @@ class IndexController extends Controller {
64 let noResult = !result || result.length < 1 || (result.list && result.list.length < 1); 64 let noResult = !result || result.length < 1 || (result.list && result.list.length < 1);
65 65
66 if (noResult) { 66 if (noResult) {
67 - this.navView.listAppend('<div class="search-divide">没有更多内容了...</div>'); 67 + this.listView.listAppend('<div class="search-divide">没有更多内容了...</div>');
68 return false; 68 return false;
69 } 69 }
70 70
71 let $result = $(result); 71 let $result = $(result);
72 72
73 lazyLoad($result.find('img.lazy')); 73 lazyLoad($result.find('img.lazy'));
74 - this.navView.listAppend($result); 74 + this.listView.listAppend($result);
75 75
76 this.onLoading = false; 76 this.onLoading = false;
77 }); 77 });
@@ -2,17 +2,18 @@ @@ -2,17 +2,18 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2017-04-26 17:15:50 3 * @Date: 2017-04-26 17:15:50
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2017-05-02 13:44:16 5 + * @Last Modified time: 2017-05-02 14:43:23
6 */ 6 */
7 'use strict'; 7 'use strict';
8 import {View} from 'yoho-mvc'; 8 import {View} from 'yoho-mvc';
9 9
10 -class NavView extends View { 10 +class ListView extends View {
11 constructor() { 11 constructor() {
12 - super('#guang-nav'); 12 + super('#guangList');
13 13
14 this.list = $('#info-list'); 14 this.list = $('#info-list');
15 - this.navItem = $('.guang-nav-item'); 15 + this.nav = this.$base.find('#guang-nav');
  16 + this.navItem = this.nav.find('.guang-nav-item');
16 17
17 this.beforeScroll = document.body.scrollTop; // 滚动前位置记录 18 this.beforeScroll = document.body.scrollTop; // 滚动前位置记录
18 19
@@ -59,7 +60,7 @@ class NavView extends View { @@ -59,7 +60,7 @@ class NavView extends View {
59 * 获取默认 Type 60 * 获取默认 Type
60 */ 61 */
61 getType() { 62 getType() {
62 - return this.$base.find('li.focus').data('type'); 63 + return this.navItem.find('li.focus').data('type');
63 } 64 }
64 65
65 /** 66 /**
@@ -91,5 +92,5 @@ class NavView extends View { @@ -91,5 +92,5 @@ class NavView extends View {
91 } 92 }
92 93
93 module.exports = { 94 module.exports = {
94 - NavView 95 + ListView
95 }; 96 };