Merge branch 'feature/outlet' of http://git.yoho.cn/fe/yohobuywap-node into feature/outlet
Showing
17 changed files
with
140 additions
and
74 deletions
@@ -14,10 +14,11 @@ const renderData = { | @@ -14,10 +14,11 @@ const renderData = { | ||
14 | }; | 14 | }; |
15 | 15 | ||
16 | exports.index = (req, res) => { | 16 | exports.index = (req, res) => { |
17 | - let channel = req.query.channel || req.cookies._Channel || 'boys'; | 17 | + let channel = req.query.yh_channel || req.cookies._Channel || 'boys'; |
18 | let headerData = headerModel.setNavHeader('OUTLET', channel, true, '', null); | 18 | let headerData = headerModel.setNavHeader('OUTLET', channel, true, '', null); |
19 | + let categoryId = req.query.category_id; | ||
19 | 20 | ||
20 | - outletModel.getContent(channel).then(result => { | 21 | + outletModel.getContent(categoryId, channel).then(result => { |
21 | res.render('outlet', Object.assign({ | 22 | res.render('outlet', Object.assign({ |
22 | pageHeader: headerData, | 23 | pageHeader: headerData, |
23 | pageFooter: true | 24 | pageFooter: true |
1 | /** | 1 | /** |
2 | * 频道页面 model | 2 | * 频道页面 model |
3 | - * @author: Bi Kai<kai.bi@yoho.cn> | 3 | +G* @author: Bi Kai<kai.bi@yoho.cn> |
4 | * @date: 2016/05/09 | 4 | * @date: 2016/05/09 |
5 | */ | 5 | */ |
6 | 'use strict'; | 6 | 'use strict'; |
@@ -22,10 +22,11 @@ const serviceApi = new ServiceAPI(); | @@ -22,10 +22,11 @@ const serviceApi = new ServiceAPI(); | ||
22 | const api = new API(); | 22 | const api = new API(); |
23 | 23 | ||
24 | 24 | ||
25 | -const getOutletResource = () => { | 25 | +const getOutletResource = (channel) => { |
26 | const params = { | 26 | const params = { |
27 | content_code: 'c19ffa03f053f4cac3690b22c8da26b7', | 27 | content_code: 'c19ffa03f053f4cac3690b22c8da26b7', |
28 | limit: 25, | 28 | limit: 25, |
29 | + yh_channel: channel || '', | ||
29 | debug: 'XYZ' | 30 | debug: 'XYZ' |
30 | }; | 31 | }; |
31 | 32 | ||
@@ -54,18 +55,18 @@ const convertNavData = (list) => { | @@ -54,18 +55,18 @@ const convertNavData = (list) => { | ||
54 | return {data: formatData}; | 55 | return {data: formatData}; |
55 | }; | 56 | }; |
56 | 57 | ||
57 | -const getNavData = () => { | 58 | +const getNavData = (categoryId) => { |
58 | const params = { | 59 | const params = { |
59 | // client_type: 'iphone', | 60 | // client_type: 'iphone', |
60 | // os_version: 8.4, | 61 | // os_version: 8.4, |
61 | // screen_size: '320x568', | 62 | // screen_size: '320x568', |
62 | v: 7, | 63 | v: 7, |
63 | 64 | ||
64 | - // parent_id: 1107, | 65 | + parent_id: categoryId, |
65 | debug: 'XYZ' | 66 | debug: 'XYZ' |
66 | }; | 67 | }; |
67 | 68 | ||
68 | - return api.get('operations/api/v6/category/getCategory', sign.apiSign(params)).then(result => { | 69 | + return serviceApi.get('operations/api/v6/category/getCategory', sign.apiSign(params)).then(result => { |
69 | if (result && result.code === 200) { | 70 | if (result && result.code === 200) { |
70 | return convertNavData(result.data); | 71 | return convertNavData(result.data); |
71 | } else { | 72 | } else { |
@@ -147,7 +148,7 @@ const getHomeActivity = (data) => { | @@ -147,7 +148,7 @@ const getHomeActivity = (data) => { | ||
147 | }); | 148 | }); |
148 | }; | 149 | }; |
149 | 150 | ||
150 | -exports.getContent = (channel) => { | 151 | +exports.getContent = (categoryId, channel) => { |
151 | let floorsData = {}, | 152 | let floorsData = {}, |
152 | params = { | 153 | params = { |
153 | type: 0, | 154 | type: 0, |
@@ -157,8 +158,9 @@ exports.getContent = (channel) => { | @@ -157,8 +158,9 @@ exports.getContent = (channel) => { | ||
157 | if (channel === 'boys') { | 158 | if (channel === 'boys') { |
158 | params.yh_channel = 1; | 159 | params.yh_channel = 1; |
159 | } | 160 | } |
161 | + const promises = [getNavData(categoryId), getOutletResource(channel), getHomeActivity(params), getGoodsList()]; | ||
160 | 162 | ||
161 | - return Promise.all([getNavData(), getOutletResource(), getHomeActivity(params), getGoodsList()]).then(data => { | 163 | + return Promise.all(promises).then(data => { |
162 | floorsData.nav = data[0] || []; | 164 | floorsData.nav = data[0] || []; |
163 | floorsData.content = data[1] || []; | 165 | floorsData.content = data[1] || []; |
164 | floorsData.activity = {data: data[2]}; | 166 | floorsData.activity = {data: data[2]}; |
@@ -135,6 +135,7 @@ const processBreakingSort = (list) => { | @@ -135,6 +135,7 @@ const processBreakingSort = (list) => { | ||
135 | * @return {[array]} | 135 | * @return {[array]} |
136 | */ | 136 | */ |
137 | const searchSales = (params) => { | 137 | const searchSales = (params) => { |
138 | + let method = 'app.search.sales'; | ||
138 | 139 | ||
139 | // 排除基本筛选项默认值为0的对象 | 140 | // 排除基本筛选项默认值为0的对象 |
140 | for (let str in params) { | 141 | for (let str in params) { |
@@ -143,6 +144,10 @@ const searchSales = (params) => { | @@ -143,6 +144,10 @@ const searchSales = (params) => { | ||
143 | } | 144 | } |
144 | } | 145 | } |
145 | 146 | ||
147 | + if (params.outlets) { | ||
148 | + method = 'app.search.li'; | ||
149 | + } | ||
150 | + | ||
146 | params = Object.assign({ | 151 | params = Object.assign({ |
147 | limit: '50' | 152 | limit: '50' |
148 | }, params); | 153 | }, params); |
@@ -152,7 +157,7 @@ const searchSales = (params) => { | @@ -152,7 +157,7 @@ const searchSales = (params) => { | ||
152 | } | 157 | } |
153 | 158 | ||
154 | return api.get('', sign.apiSign(Object.assign({ | 159 | return api.get('', sign.apiSign(Object.assign({ |
155 | - method: 'app.search.sales' | 160 | + method: method |
156 | }, params)), true); | 161 | }, params)), true); |
157 | }; | 162 | }; |
158 | 163 |
1 | +<div class="banner"> | ||
2 | + | ||
3 | + {{# outletActivity}} | ||
4 | + <img src="{{image webUrl 640 250}}"/> | ||
5 | + <p class="outlet-activity-time" data-time-ms="{{endLeftTime}}"><i class="iconfont time-ico"></i><span></span></p> | ||
6 | + <p class="outlet-discount">{{promotionName}}</p> | ||
7 | + {{/ outletActivity}} | ||
8 | + | ||
9 | +</div> |
1 | -<nav id="list-nav" class="outlet-nav outlet-category-nav"> | 1 | +<nav class="outlet-nav outlet-category-nav"> |
2 | <ul> | 2 | <ul> |
3 | - <li><a href="?gender=1,3">全部</a></li> | 3 | + {{! |
4 | + <li class='cartegory'><a href="?gender=1,3">全部</a></li> | ||
5 | + }} | ||
4 | {{#data}} | 6 | {{#data}} |
5 | - <li><a href="{{url}}">{{categoryName}}</a></li> | 7 | + <li class='cartegory'><a href="{{url}}">{{categoryName}}</a></li> |
6 | {{/data}} | 8 | {{/data}} |
7 | </ul> | 9 | </ul> |
8 | </nav> | 10 | </nav> |
1 | {{# nav}} | 1 | {{# nav}} |
2 | -<nav class="outlet-nav"> | 2 | +<nav class="outlet-nav" id="index_nav"> |
3 | <ul> | 3 | <ul> |
4 | {{#each data}} | 4 | {{#each data}} |
5 | <li><a href="{{url}}">{{name}}</a></li> | 5 | <li><a href="{{url}}">{{name}}</a></li> |
6 | {{/each}} | 6 | {{/each}} |
7 | - <li><a href="outlet/willBeEnd">即将结束</a></li> | ||
8 | - <li><a href="outlet/willBeCome">上线预告</a></li> | 7 | + <li><a href="outlet/willStart">即将结束</a></li> |
8 | + <li><a href="outlet/willEnd">即将开始</a></li> | ||
9 | </ul> | 9 | </ul> |
10 | </nav> | 10 | </nav> |
11 | {{/nav}} | 11 | {{/nav}} |
@@ -12,10 +12,4 @@ | @@ -12,10 +12,4 @@ | ||
12 | <p class="activity-time" data-time-ms="{{leftTime}}"><i class="iconfont time-ico"></i><span>{{time}}</span></p> | 12 | <p class="activity-time" data-time-ms="{{leftTime}}"><i class="iconfont time-ico"></i><span>{{time}}</span></p> |
13 | {{/ activity}} | 13 | {{/ activity}} |
14 | 14 | ||
15 | - {{# outletActivity}} | ||
16 | - <img src="{{image webUrl 640 250}}"/> | ||
17 | - <p class="outlet-activity-time" data-time-ms="{{endLeftTime}}"><i class="iconfont time-ico"></i><span></span></p> | ||
18 | - <p class="outlet-discount">{{promotionName}}</p> | ||
19 | - {{/ outletActivity}} | ||
20 | - | ||
21 | </div> | 15 | </div> |
@@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
8 | <div class="discount-goods container hide clearfix"></div> | 8 | <div class="discount-goods container hide clearfix"></div> |
9 | <div class="all-goods container hide clearfix"></div> | 9 | <div class="all-goods container hide clearfix"></div> |
10 | <div class="sale-goods container hide clearfix"></div> | 10 | <div class="sale-goods container hide clearfix"></div> |
11 | + <div class="categroy-goods container hide clearfix"></div> | ||
11 | 12 | ||
12 | {{> common/filter}} | 13 | {{> common/filter}} |
13 | </div> | 14 | </div> |
@@ -6,9 +6,10 @@ | @@ -6,9 +6,10 @@ | ||
6 | var $ = require('yoho-jquery'), | 6 | var $ = require('yoho-jquery'), |
7 | lazyLoad = require('yoho-jquery-lazyload'); | 7 | lazyLoad = require('yoho-jquery-lazyload'); |
8 | 8 | ||
9 | -var countDown = require('../plugin/countdown'); | 9 | +var countDown = require('../plugin/countdown'), |
10 | + search = require('./sale/search'); | ||
10 | 11 | ||
11 | -require('./sale/search'); | 12 | +search.start(); |
12 | 13 | ||
13 | lazyLoad($('img.lazy')); | 14 | lazyLoad($('img.lazy')); |
14 | 15 |
@@ -4,7 +4,9 @@ var $ = require('yoho-jquery'), | @@ -4,7 +4,9 @@ var $ = require('yoho-jquery'), | ||
4 | var $time = $('.outlet-activity-time'), | 4 | var $time = $('.outlet-activity-time'), |
5 | endTime = $time.data('time-ms'); | 5 | endTime = $time.data('time-ms'); |
6 | 6 | ||
7 | -require('./sale/search'); | 7 | +var search = require('./sale/search'); |
8 | + | ||
9 | +search.start(); | ||
8 | 10 | ||
9 | countDown({ | 11 | countDown({ |
10 | timeDom: $time, | 12 | timeDom: $time, |
1 | -var $ = require('yoho-jquery'), | 1 | +var $ = require('yoho-jquery'), |
2 | Swiper = require('yoho-swiper'), | 2 | Swiper = require('yoho-swiper'), |
3 | lazyLoad = require('yoho-jquery-lazyload'), | 3 | lazyLoad = require('yoho-jquery-lazyload'), |
4 | Countdown = require('./outlet/countdown'); | 4 | Countdown = require('./outlet/countdown'); |
5 | 5 | ||
6 | var el = $('.cd-lite'); | 6 | var el = $('.cd-lite'); |
7 | 7 | ||
8 | -// var nav = require('./outlet/nav'); | 8 | +var search = require('./sale/search'); |
9 | + | ||
10 | +var iscroll = require('./outlet/nav'); | ||
9 | 11 | ||
10 | require('./sale/search'); | 12 | require('./sale/search'); |
11 | 13 | ||
@@ -32,7 +34,7 @@ if ($('.swiper-container .swiper-slide').length > 1) { | @@ -32,7 +34,7 @@ if ($('.swiper-container .swiper-slide').length > 1) { | ||
32 | } | 34 | } |
33 | 35 | ||
34 | 36 | ||
35 | -$('.outlet-category-nav').on('click', 'a', function(e) { | 37 | +$('.outlet-category-nav a').on('click', function(e) { |
36 | var href = $(this).attr('href'), // eslint-disable-line | 38 | var href = $(this).attr('href'), // eslint-disable-line |
37 | querys = href.split('?')[1].split('&'); | 39 | querys = href.split('?')[1].split('&'); |
38 | 40 | ||
@@ -48,9 +50,14 @@ $('.outlet-category-nav').on('click', 'a', function(e) { | @@ -48,9 +50,14 @@ $('.outlet-category-nav').on('click', 'a', function(e) { | ||
48 | query[key] = val; | 50 | query[key] = val; |
49 | }); | 51 | }); |
50 | 52 | ||
51 | - // search(null, query); | 53 | + search.start({ |
54 | + type: 'category' | ||
55 | + }, query); | ||
52 | }); | 56 | }); |
53 | 57 | ||
58 | +// 触发第一个search | ||
59 | +$('.outlet-category-nav a').eq(0).trigger('click'); | ||
60 | + | ||
54 | if (('.outlet-page').length > 0) { | 61 | if (('.outlet-page').length > 0) { |
55 | $('.more-activity').on('click', function() { | 62 | $('.more-activity').on('click', function() { |
56 | $('.more-activity').addClass('hidden'); | 63 | $('.more-activity').addClass('hidden'); |
@@ -69,3 +76,12 @@ if (('.outlet-page').length > 0) { | @@ -69,3 +76,12 @@ if (('.outlet-page').length > 0) { | ||
69 | 76 | ||
70 | 77 | ||
71 | } | 78 | } |
79 | + | ||
80 | +// 导航滚动 | ||
81 | +iscroll({ | ||
82 | + el: '#index_nav' | ||
83 | +}).goto($('#index_nav').find('.active').index()); | ||
84 | + | ||
85 | +iscroll({ | ||
86 | + el: '#list-nav' | ||
87 | +}).goto(0); |
1 | var $ = require('yoho-jquery'), | 1 | var $ = require('yoho-jquery'), |
2 | IScroll = require('yoho-iscroll'); | 2 | IScroll = require('yoho-iscroll'); |
3 | 3 | ||
4 | -var defaultOpt = { | ||
5 | - navClass: '.outlet-nav' | ||
6 | -}; | ||
7 | - | ||
8 | // nav 滚动 | 4 | // nav 滚动 |
9 | function initNavScroll(opt) { | 5 | function initNavScroll(opt) { |
10 | var $navBox, | 6 | var $navBox, |
7 | + iScroll, | ||
8 | + _default = { | ||
9 | + el: '.outlet-nav' | ||
10 | + }, | ||
11 | + options; | ||
11 | 12 | ||
12 | - // $lis, | ||
13 | - iScroll; | 13 | + options = $.extend({}, _default, opt); |
14 | + $navBox = $(options.el); | ||
14 | 15 | ||
15 | - $.extend(opt || {}, defaultOpt); | 16 | + function scroll(index) { |
17 | + var $ele; | ||
16 | 18 | ||
17 | - $navBox = $(opt.navClass); | 19 | + $ele = $navBox.find('li').eq(index); |
20 | + if ($ele.length > 0) { | ||
21 | + setTimeout(function() { | ||
22 | + iScroll.scrollToElement($ele[0], 400); | ||
23 | + }, 1); | ||
24 | + } | ||
25 | + } | ||
18 | 26 | ||
19 | - // $lis = $navBox.find('li'); | 27 | + iScroll = new IScroll($navBox[0], { |
28 | + scrollX: true, | ||
29 | + scrollY: false | ||
30 | + }); | ||
20 | 31 | ||
21 | - function scroll(ele) { | ||
22 | - var offset; | 32 | + return { |
33 | + goto: scroll | ||
34 | + }; | ||
35 | +} | ||
23 | 36 | ||
24 | - ele = ele || $navBox.find('li').eq(0)[0]; | ||
25 | - offset = -($navBox.find('ul').width() - 20) / 2; | 37 | +// 获取url中的参数 |
38 | +function getUrlParam(name) { | ||
39 | + var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); // 构造一个含有目标参数的正则表达式对象 | ||
40 | + var r = window.location.search.substr(1).match(reg); // 匹配目标参数 | ||
26 | 41 | ||
27 | - setTimeout(function() { | ||
28 | - iScroll.scrollToElement(ele, 400, offset); | ||
29 | - }, 1); | 42 | + // 返回参数值 |
43 | + if (r !== null) { | ||
44 | + return decodeURIComponent(r[2]); | ||
45 | + } else { | ||
46 | + return null; | ||
30 | } | 47 | } |
48 | +} | ||
31 | 49 | ||
32 | - $.each($navBox, function(index) { | ||
33 | - iScroll = new IScroll($navBox[index], { | ||
34 | - scrollX: true, | ||
35 | - scrollY: false | ||
36 | - }); | ||
37 | - }); | 50 | +// 选中顶部导航 |
51 | +function activeNav() { | ||
52 | + var $nav = $('#index_nav'); | ||
53 | + var index = getUrlParam('yh_channel'); | ||
38 | 54 | ||
39 | - // $navBox.on('click', 'li', function() { | ||
40 | - // var $this = $(this); // eslint-disable-line | ||
41 | - // var i = $this.index(); | 55 | + if (index === null) { |
56 | + index = 0; | ||
57 | + } | ||
58 | + $nav.find('li').eq(index).addClass('active').siblings().removeClass('active'); | ||
59 | +} | ||
42 | 60 | ||
43 | - // $lis.eq(i).addClass('active').siblings().removeClass('active'); | ||
44 | - // scroll($this[0]); | ||
45 | - // }); | ||
46 | 61 | ||
47 | - scroll($navBox.find('.active')[0]); | ||
48 | -} | 62 | +activeNav(); |
49 | 63 | ||
50 | module.exports = initNavScroll; | 64 | module.exports = initNavScroll; |
51 | 65 |
@@ -7,8 +7,11 @@ | @@ -7,8 +7,11 @@ | ||
7 | var $ = require('yoho-jquery'), | 7 | var $ = require('yoho-jquery'), |
8 | Swiper = require('yoho-swiper'); | 8 | Swiper = require('yoho-swiper'); |
9 | 9 | ||
10 | +var search = require('./sale/search'); | ||
11 | + | ||
10 | require('../common/common'); | 12 | require('../common/common'); |
11 | -require('./sale/search'); | 13 | + |
14 | +search.start(); | ||
12 | 15 | ||
13 | if ($('.swiper-container .swiper-slide').length > 1) { | 16 | if ($('.swiper-container .swiper-slide').length > 1) { |
14 | new Swiper('.swiper-container', { | 17 | new Swiper('.swiper-container', { |
@@ -15,6 +15,7 @@ var $goodsContainer = $('#goods-container'), | @@ -15,6 +15,7 @@ var $goodsContainer = $('#goods-container'), | ||
15 | $dgc = $goodsContainer.find('.discount-goods'), | 15 | $dgc = $goodsContainer.find('.discount-goods'), |
16 | $pgc = $goodsContainer.find('.price-goods'), | 16 | $pgc = $goodsContainer.find('.price-goods'), |
17 | $agc = $goodsContainer.find('.all-goods'), | 17 | $agc = $goodsContainer.find('.all-goods'), |
18 | + $cgc = $goodsContainer.find('.category-goods'), | ||
18 | $sgc = $goodsContainer.find('.sale-goods'); | 19 | $sgc = $goodsContainer.find('.sale-goods'); |
19 | 20 | ||
20 | var winH = $(window).height(), | 21 | var winH = $(window).height(), |
@@ -56,6 +57,13 @@ var $listNav = $('#list-nav'), | @@ -56,6 +57,13 @@ var $listNav = $('#list-nav'), | ||
56 | reload: true, | 57 | reload: true, |
57 | page: 0, | 58 | page: 0, |
58 | end: false | 59 | end: false |
60 | + }, | ||
61 | + category: { | ||
62 | + order: 0, | ||
63 | + reload: true, | ||
64 | + fuck: true, | ||
65 | + page: 0, | ||
66 | + end: false | ||
59 | } | 67 | } |
60 | }, | 68 | }, |
61 | $pre = $listNav.find('.active'), // 纪录进入筛选前的active项,初始为选中项 | 69 | $pre = $listNav.find('.active'), // 纪录进入筛选前的active项,初始为选中项 |
@@ -90,7 +98,7 @@ $.extend(defaultOpt, { | @@ -90,7 +98,7 @@ $.extend(defaultOpt, { | ||
90 | 98 | ||
91 | // 判断导航类型 | 99 | // 判断导航类型 |
92 | function judgeType(dom) { | 100 | function judgeType(dom) { |
93 | - var navType; | 101 | + var navType = 'category'; |
94 | 102 | ||
95 | if (dom.hasClass('new')) { | 103 | if (dom.hasClass('new')) { |
96 | navType = 'newest'; | 104 | navType = 'newest'; |
@@ -102,6 +110,8 @@ function judgeType(dom) { | @@ -102,6 +110,8 @@ function judgeType(dom) { | ||
102 | navType = 'sale'; | 110 | navType = 'sale'; |
103 | } else if (dom.hasClass('all')) { | 111 | } else if (dom.hasClass('all')) { |
104 | navType = 'all'; | 112 | navType = 'all'; |
113 | + } else if (dom.hasClass('category')) { | ||
114 | + navType = 'category'; | ||
105 | } | 115 | } |
106 | 116 | ||
107 | return navType; | 117 | return navType; |
@@ -184,9 +194,7 @@ function search(opt, params) { | @@ -184,9 +194,7 @@ function search(opt, params) { | ||
184 | $.extend(defaultOpt, ext); // 扩展筛选项 | 194 | $.extend(defaultOpt, ext); // 扩展筛选项 |
185 | } | 195 | } |
186 | 196 | ||
187 | - if (params) { | ||
188 | - $.extend(defaultOpt, params); | ||
189 | - } | 197 | + $.extend(defaultOpt, params || {}); // 扩展筛选项 |
190 | 198 | ||
191 | // 导航类别 | 199 | // 导航类别 |
192 | navType = judgeType($pre); | 200 | navType = judgeType($pre); |
@@ -240,6 +248,9 @@ function search(opt, params) { | @@ -240,6 +248,9 @@ function search(opt, params) { | ||
240 | case 'all': | 248 | case 'all': |
241 | $container = $agc; | 249 | $container = $agc; |
242 | break; | 250 | break; |
251 | + case 'categroy': | ||
252 | + $container = $cgc; | ||
253 | + break; | ||
243 | default: | 254 | default: |
244 | $container = $agc; | 255 | $container = $agc; |
245 | break; | 256 | break; |
@@ -257,7 +268,11 @@ function search(opt, params) { | @@ -257,7 +268,11 @@ function search(opt, params) { | ||
257 | $container.html(noResult); | 268 | $container.html(noResult); |
258 | } | 269 | } |
259 | } else { | 270 | } else { |
260 | - if (nav.reload) { | 271 | + if (navType === 'category') { |
272 | + nav.page = 1; | ||
273 | + } | ||
274 | + | ||
275 | + if (nav.reload || navType === 'category') { | ||
261 | $container.html(data); | 276 | $container.html(data); |
262 | lazyLoad($container.find('.lazy')); | 277 | lazyLoad($container.find('.lazy')); |
263 | } else { | 278 | } else { |
@@ -359,7 +374,7 @@ $listNav.on('touchend touchcancel', function(e) { | @@ -359,7 +374,7 @@ $listNav.on('touchend touchcancel', function(e) { | ||
359 | // 导航类别 | 374 | // 导航类别 |
360 | navType = judgeType($this); | 375 | navType = judgeType($this); |
361 | 376 | ||
362 | - nav = navInfo[navType || 'all']; | 377 | + nav = navInfo[navType]; |
363 | 378 | ||
364 | if ($this.hasClass('active')) { | 379 | if ($this.hasClass('active')) { |
365 | 380 | ||
@@ -419,7 +434,7 @@ $listNav.on('touchend touchcancel', function(e) { | @@ -419,7 +434,7 @@ $listNav.on('touchend touchcancel', function(e) { | ||
419 | $this.addClass('active'); | 434 | $this.addClass('active'); |
420 | } | 435 | } |
421 | 436 | ||
422 | - if (nav && nav.reload) { | 437 | + if (nav.reload) { |
423 | search(); | 438 | search(); |
424 | } | 439 | } |
425 | } | 440 | } |
@@ -442,8 +457,6 @@ $(window).scroll(function() { | @@ -442,8 +457,6 @@ $(window).scroll(function() { | ||
442 | window.requestAnimationFrame(scrollHandler); | 457 | window.requestAnimationFrame(scrollHandler); |
443 | }); | 458 | }); |
444 | 459 | ||
445 | -// 初始请求最新第一页数据 | ||
446 | -search(); | ||
447 | 460 | ||
448 | $listNav.on('touchstart', 'li', function() { | 461 | $listNav.on('touchstart', 'li', function() { |
449 | $(this).addClass('bytouch'); | 462 | $(this).addClass('bytouch'); |
@@ -451,5 +464,6 @@ $listNav.on('touchstart', 'li', function() { | @@ -451,5 +464,6 @@ $listNav.on('touchstart', 'li', function() { | ||
451 | $listNav.find('li').removeClass('bytouch'); | 464 | $listNav.find('li').removeClass('bytouch'); |
452 | }); | 465 | }); |
453 | 466 | ||
454 | - | ||
455 | -module.exports = search; | 467 | +module.exports = { |
468 | + start: search | ||
469 | +}; |
-
Please register or login to post a comment