Showing
6 changed files
with
102 additions
and
35 deletions
@@ -32,3 +32,13 @@ exports.index = (req, res, next) => { | @@ -32,3 +32,13 @@ exports.index = (req, res, next) => { | ||
32 | res.render('guang-new', Object.assign(responseData, result)); | 32 | res.render('guang-new', Object.assign(responseData, result)); |
33 | }).catch(next); | 33 | }).catch(next); |
34 | }; | 34 | }; |
35 | + | ||
36 | +exports.more = (req, res, next) => { | ||
37 | + let params = { | ||
38 | + page: req.query.page | ||
39 | + }; | ||
40 | + | ||
41 | + req.ctx(newGuangModel).list(params).then(result => { | ||
42 | + res.json(result); | ||
43 | + }).catch(next); | ||
44 | +}; |
@@ -22,6 +22,28 @@ class newGuang extends global.yoho.BaseModel { | @@ -22,6 +22,28 @@ class newGuang extends global.yoho.BaseModel { | ||
22 | }); | 22 | }); |
23 | } | 23 | } |
24 | 24 | ||
25 | + list(params) { | ||
26 | + let options = { | ||
27 | + url: '/guang/api/v1/article/getHomePageList', | ||
28 | + data: { | ||
29 | + page: params.page || 1, | ||
30 | + limit: params.limit || 2 | ||
31 | + }, | ||
32 | + api: global.yoho.ServiceAPI | ||
33 | + }; | ||
34 | + | ||
35 | + return this.get(options).then(result => { | ||
36 | + let resu = { | ||
37 | + list: [] | ||
38 | + }; | ||
39 | + | ||
40 | + if (_.get(result, 'data.guangList')) { | ||
41 | + resu.list = result.data.guangList; | ||
42 | + } | ||
43 | + return resu; | ||
44 | + }); | ||
45 | + } | ||
46 | + | ||
25 | index(params) { | 47 | index(params) { |
26 | return Promise.all([ | 48 | return Promise.all([ |
27 | this._indexRes(params) | 49 | this._indexRes(params) |
@@ -48,9 +70,6 @@ class newGuang extends global.yoho.BaseModel { | @@ -48,9 +70,6 @@ class newGuang extends global.yoho.BaseModel { | ||
48 | if (val.template_name === 'GuangHhFloor') { | 70 | if (val.template_name === 'GuangHhFloor') { |
49 | resu.floorRes.haoHuo = _.get(val, 'data.list'); | 71 | resu.floorRes.haoHuo = _.get(val, 'data.list'); |
50 | } | 72 | } |
51 | - if (val.template_name === 'GuangShowOrderFloor') { | ||
52 | - resu.floorRes.show = _.get(val, 'data.list'); | ||
53 | - } | ||
54 | }); | 73 | }); |
55 | } | 74 | } |
56 | 75 |
@@ -78,5 +78,6 @@ router.get('/plusstar/brandList', brand.brandList); | @@ -78,5 +78,6 @@ router.get('/plusstar/brandList', brand.brandList); | ||
78 | router.get('/sitemap.xml', sitemap.siteMap); | 78 | router.get('/sitemap.xml', sitemap.siteMap); |
79 | 79 | ||
80 | router.get('/guang-new', guangNew.index); | 80 | router.get('/guang-new', guangNew.index); |
81 | +router.get('/guang-new/more', guangNew.more); | ||
81 | 82 | ||
82 | module.exports = router; | 83 | module.exports = router; |
@@ -130,45 +130,29 @@ | @@ -130,45 +130,29 @@ | ||
130 | <p class="eps">马思唯:有趣的人会买东西</p> | 130 | <p class="eps">马思唯:有趣的人会买东西</p> |
131 | </div> | 131 | </div> |
132 | </div> | 132 | </div> |
133 | - {{#if floorRes.show}} | ||
134 | - <div class="big-title"> | 133 | + <div class="big-title hide"> |
135 | SHOW | 134 | SHOW |
136 | <span class="iconfont">MORE </span> | 135 | <span class="iconfont">MORE </span> |
137 | </div> | 136 | </div> |
138 | - <div class="swiper-show"> | 137 | + <div class="swiper-show hide"> |
139 | <div class="swiper-container"> | 138 | <div class="swiper-container"> |
140 | <div class="swiper-wrapper"> | 139 | <div class="swiper-wrapper"> |
141 | - {{# floorRes.show}} | ||
142 | <div class="swiper-slide"> | 140 | <div class="swiper-slide"> |
143 | - <a href="//m.yohobuy.com/product/{{productSkn}}.html"> | ||
144 | - <img src="{{image2 url w=358 h=358 q=30}}" /> | ||
145 | - <p class="words eps-2">{{content}}</p> | ||
146 | - <div class="auther"> | ||
147 | - <span class="name">来自#{{userName}}#</span> | ||
148 | - <span class="iconfont hide"></span> | ||
149 | - </div> | ||
150 | - </a> | 141 | + <img src="" /> |
142 | + <p class="words eps-2"></p> | ||
143 | + <div class="auther"> | ||
144 | + <span class="name"></span> | ||
145 | + <span class="iconfont"></span> | ||
146 | + </div> | ||
151 | </div> | 147 | </div> |
152 | - {{/ floorRes.show}} | ||
153 | </div> | 148 | </div> |
154 | </div> | 149 | </div> |
155 | </div> | 150 | </div> |
156 | - {{/if}} | ||
157 | - <div class="big-title hide"> | 151 | + <div class="big-title"> |
158 | 逛 | 152 | 逛 |
159 | - <span class="iconfont">MORE </span> | ||
160 | - </div> | ||
161 | - <div class="guang-list hide"> | ||
162 | - <div class="guang-item"> | ||
163 | - <div class="page-c"> | ||
164 | - <img src="http://img11.static.yhbimg.com/yhb-img01/2017/10/27/11/01ea9512175a0c5795bfd01048271b654e.jpg" /> | ||
165 | - <div class="info"> | ||
166 | - <p class="name eps-2">DICKIES从诞生之日起就旨在出品高品质DICKIES从诞生之日起就旨在出品就旨在出品就旨在出品高品质</p> | ||
167 | - <p class="type">3潮流</p> | ||
168 | - </div> | ||
169 | - </div> | ||
170 | - </div> | 153 | + <a class="iconfont" href="//guang.m.yohobuy.com/?gender={{gender}}">MORE </a> |
171 | </div> | 154 | </div> |
155 | + <div class="guang-list"></div> | ||
172 | <div class="trend-list hide"> | 156 | <div class="trend-list hide"> |
173 | <div class="trend-item"> | 157 | <div class="trend-item"> |
174 | <img src="http://img11.static.yhbimg.com/yhb-img01/2017/10/27/11/01ea9512175a0c5795bfd01048271b654e.jpg" /> | 158 | <img src="http://img11.static.yhbimg.com/yhb-img01/2017/10/27/11/01ea9512175a0c5795bfd01048271b654e.jpg" /> |
@@ -11,14 +11,18 @@ const isProduction = process.env.NODE_ENV === 'production'; | @@ -11,14 +11,18 @@ const isProduction = process.env.NODE_ENV === 'production'; | ||
11 | const isTest = process.env.NODE_ENV === 'test'; | 11 | const isTest = process.env.NODE_ENV === 'test'; |
12 | 12 | ||
13 | const domains = { | 13 | const domains = { |
14 | - api: 'http://api.yoho.cn/', | ||
15 | - service: 'http://service.yoho.cn/', | ||
16 | liveApi: 'http://testapi.live.yohops.com:9999/', | 14 | liveApi: 'http://testapi.live.yohops.com:9999/', |
17 | singleApi: 'http://api-test3.yohops.com:9999/', | 15 | singleApi: 'http://api-test3.yohops.com:9999/', |
16 | + api: 'http://api-test3.yohops.com:9999/', | ||
17 | + service: 'http://service-test3.yohops.com:9999/', | ||
18 | + | ||
19 | + // liveApi: 'http://api.live.yoho.cn/', | ||
20 | + // singleApi: 'http://single.yoho.cn/', | ||
18 | imSocket: 'ws://socket.yohobuy.com:10240', | 21 | imSocket: 'ws://socket.yohobuy.com:10240', |
19 | imCs: 'http://im.yohobuy.com/api', | 22 | imCs: 'http://im.yohobuy.com/api', |
23 | + global: 'http://api-global.yohobuy.com', | ||
24 | + store: 'http://192.168.102.47:8080/portal-gateway/', | ||
20 | platformApi: 'http://192.168.102.48:8088/', | 25 | platformApi: 'http://192.168.102.48:8088/', |
21 | - store: 'http://192.168.102.47:8080/portal-gateway/wechat/', | ||
22 | extstore: 'http://extstore-test1.yohops.com', | 26 | extstore: 'http://extstore-test1.yohops.com', |
23 | family: 'http://192.168.103.73:8096/uic/', | 27 | family: 'http://192.168.103.73:8096/uic/', |
24 | yohoNowApi: 'http://yohonow-test.yohops.com:9999/' | 28 | yohoNowApi: 'http://yohonow-test.yohops.com:9999/' |
@@ -74,7 +78,7 @@ module.exports = { | @@ -74,7 +78,7 @@ module.exports = { | ||
74 | maxFiles: 7 | 78 | maxFiles: 7 |
75 | }, | 79 | }, |
76 | console: { | 80 | console: { |
77 | - level: 'info', | 81 | + level: 'debug', |
78 | colorize: 'all', | 82 | colorize: 'all', |
79 | prettyPrint: true | 83 | prettyPrint: true |
80 | } | 84 | } |
@@ -3,16 +3,26 @@ import $ from 'yoho-jquery'; | @@ -3,16 +3,26 @@ import $ from 'yoho-jquery'; | ||
3 | import Page from 'yoho-page'; | 3 | import Page from 'yoho-page'; |
4 | import Swiper from 'yoho-swiper'; | 4 | import Swiper from 'yoho-swiper'; |
5 | 5 | ||
6 | +import moreRender from 'guang/list.hbs'; | ||
7 | + | ||
6 | class GuangNew extends Page { | 8 | class GuangNew extends Page { |
7 | constructor() { | 9 | constructor() { |
8 | super(); | 10 | super(); |
9 | 11 | ||
10 | this.selector = { | 12 | this.selector = { |
11 | $parentObj: $('.swiper-tab'), | 13 | $parentObj: $('.swiper-tab'), |
12 | - $fixed: $('.fixed') | 14 | + $fixed: $('.fixed'), |
15 | + $guangList: $('.guang-list') | ||
16 | + }; | ||
17 | + | ||
18 | + this.view = { | ||
19 | + moreRender | ||
13 | }; | 20 | }; |
14 | 21 | ||
15 | this.fixedTop = 0; | 22 | this.fixedTop = 0; |
23 | + this.page = 0; | ||
24 | + this.end = false; | ||
25 | + this.loading = false; | ||
16 | this.init(); | 26 | this.init(); |
17 | } | 27 | } |
18 | 28 | ||
@@ -25,6 +35,45 @@ class GuangNew extends Page { | @@ -25,6 +35,45 @@ class GuangNew extends Page { | ||
25 | this.swiperShow(); | 35 | this.swiperShow(); |
26 | this.fixed(); | 36 | this.fixed(); |
27 | this.fixedRetop(); | 37 | this.fixedRetop(); |
38 | + this.list(); | ||
39 | + } | ||
40 | + | ||
41 | + list() { | ||
42 | + $(window).scroll(() => { | ||
43 | + window.requestAnimationFrame(this.scrollHandler.bind(this)); | ||
44 | + }); | ||
45 | + } | ||
46 | + | ||
47 | + scrollHandler() { | ||
48 | + if (($(window).scrollTop() + $(window).height() >= $(document).height() * 0.8)) { | ||
49 | + this.doMore(); | ||
50 | + } | ||
51 | + } | ||
52 | + | ||
53 | + doMore() { | ||
54 | + if (!this.end && !this.loading) { | ||
55 | + this.page++; | ||
56 | + this.moreList(this.page); | ||
57 | + } | ||
58 | + } | ||
59 | + | ||
60 | + moreList() { | ||
61 | + this.loading = true; | ||
62 | + this.ajax({ | ||
63 | + url: '/guang/guang-new/more', | ||
64 | + data: { | ||
65 | + page: this.page | ||
66 | + }, | ||
67 | + }).then(result => { | ||
68 | + if (result && result.list.length > 0) { | ||
69 | + this.selector.$guangList.append(this.view.moreRender(result)); | ||
70 | + this.loading = false; | ||
71 | + } else { | ||
72 | + this.end = true; | ||
73 | + } | ||
74 | + }).catch(error => { | ||
75 | + console.error(error); | ||
76 | + }); | ||
28 | } | 77 | } |
29 | 78 | ||
30 | // 返回顶部,最新资讯 | 79 | // 返回顶部,最新资讯 |
-
Please register or login to post a comment