Merge branch 'feature/guang2' into 'release/5.8'
逛需求 See merge request !625
Showing
20 changed files
with
412 additions
and
62 deletions
@@ -122,6 +122,8 @@ const _shareInfo = (id, getArticle) => { | @@ -122,6 +122,8 @@ const _shareInfo = (id, getArticle) => { | ||
122 | */ | 122 | */ |
123 | const index = (req, res, next) => { | 123 | const index = (req, res, next) => { |
124 | let id = req.query.id || req.params[0] || req.params.id, | 124 | let id = req.query.id || req.params[0] || req.params.id, |
125 | + uid = req.user.uid, | ||
126 | + udid = req.sessionID || require('yoho-md5')(req.ip) || 'yoho', | ||
125 | gender = req.query.gender || | 127 | gender = req.query.gender || |
126 | req.query.channel && typeLib.channels[req.query.channel] || | 128 | req.query.channel && typeLib.channels[req.query.channel] || |
127 | req.cookies._Channel && channels[req.cookies._Channel] || | 129 | req.cookies._Channel && channels[req.cookies._Channel] || |
@@ -157,6 +159,12 @@ const index = (req, res, next) => { | @@ -157,6 +159,12 @@ const index = (req, res, next) => { | ||
157 | 159 | ||
158 | co(function* () { | 160 | co(function* () { |
159 | let detail = yield req.ctx(DetailModel).packageData(id, isApp, isWeixin, channel, isShare); | 161 | let detail = yield req.ctx(DetailModel).packageData(id, isApp, isWeixin, channel, isShare); |
162 | + let commentsTotal = yield req.ctx(DetailModel).commentsTotal({article_id: id}); | ||
163 | + let praise = yield req.ctx(DetailModel).getArticlePraiseAndFavor({ | ||
164 | + uid: uid, | ||
165 | + id: id, | ||
166 | + udid: udid | ||
167 | + }); | ||
160 | let data = { | 168 | let data = { |
161 | guangDetail: true, | 169 | guangDetail: true, |
162 | guang: {} | 170 | guang: {} |
@@ -198,8 +206,11 @@ const index = (req, res, next) => { | @@ -198,8 +206,11 @@ const index = (req, res, next) => { | ||
198 | id: _.get(detail, 'getArticle.id'), | 206 | id: _.get(detail, 'getArticle.id'), |
199 | title: detail.getArticle.article_title, | 207 | title: detail.getArticle.article_title, |
200 | publishTime: detail.getArticle.publishTime, | 208 | publishTime: detail.getArticle.publishTime, |
201 | - pageView: detail.getArticle.pageViews, | ||
202 | - content: [] | 209 | + pageView: _.get(praise, 'browseNum', 0), |
210 | + content: [], | ||
211 | + praise: _.get(praise, 'praiseNum', 0), | ||
212 | + praiseHeadIco: _.get(praise, 'praiseHeadIco', []), | ||
213 | + commentsTotal: commentsTotal | ||
203 | }; | 214 | }; |
204 | if (!detail.getArticleContent) { | 215 | if (!detail.getArticleContent) { |
205 | return next(); | 216 | return next(); |
@@ -254,7 +265,8 @@ const index = (req, res, next) => { | @@ -254,7 +265,8 @@ const index = (req, res, next) => { | ||
254 | wechatShare: true, | 265 | wechatShare: true, |
255 | isWeixin: isWeixin, | 266 | isWeixin: isWeixin, |
256 | localCss: true, | 267 | localCss: true, |
257 | - isShare: isShare | 268 | + isShare: isShare, |
269 | + id: id | ||
258 | }, data, parameter)); | 270 | }, data, parameter)); |
259 | })().catch(next); | 271 | })().catch(next); |
260 | }; | 272 | }; |
@@ -287,6 +299,8 @@ const indexRedirect = (req, res, next) => { | @@ -287,6 +299,8 @@ const indexRedirect = (req, res, next) => { | ||
287 | */ | 299 | */ |
288 | const mini = (req, res, next) => { | 300 | const mini = (req, res, next) => { |
289 | let id = req.query.id, | 301 | let id = req.query.id, |
302 | + uid = req.user.uid, | ||
303 | + udid = req.sessionID || require('yoho-md5')(req.ip) || 'yoho', | ||
290 | gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || 1, | 304 | gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || 1, |
291 | isApp = req.query.app_version || req.query.appVersion || false; // 标识是不是APP访问的 | 305 | isApp = req.query.app_version || req.query.appVersion || false; // 标识是不是APP访问的 |
292 | 306 | ||
@@ -302,6 +316,12 @@ const mini = (req, res, next) => { | @@ -302,6 +316,12 @@ const mini = (req, res, next) => { | ||
302 | 316 | ||
303 | co(function* () { | 317 | co(function* () { |
304 | let detail = yield req.ctx(DetailModel).packageData(id, isApp); | 318 | let detail = yield req.ctx(DetailModel).packageData(id, isApp); |
319 | + let commentsTotal = yield req.ctx(DetailModel).commentsTotal({article_id: id}); | ||
320 | + let praise = yield req.ctx(DetailModel).getArticlePraiseAndFavor({ | ||
321 | + uid: uid, | ||
322 | + id: id, | ||
323 | + udid: udid | ||
324 | + }); | ||
305 | let data = { | 325 | let data = { |
306 | guangEzine: true, | 326 | guangEzine: true, |
307 | guang: {} | 327 | guang: {} |
@@ -317,8 +337,11 @@ const mini = (req, res, next) => { | @@ -317,8 +337,11 @@ const mini = (req, res, next) => { | ||
317 | guang.detail = { | 337 | guang.detail = { |
318 | title: detail.getArticle.article_title, | 338 | title: detail.getArticle.article_title, |
319 | publishTime: detail.getArticle.publishTime, | 339 | publishTime: detail.getArticle.publishTime, |
320 | - pageView: detail.getArticle.pageViews, | ||
321 | - content: [] | 340 | + pageView: _.get(praise, 'browseNum', 0), |
341 | + content: [], | ||
342 | + praise: _.get(praise, 'praiseNum', 0), | ||
343 | + praiseHeadIco: _.get(praise, 'praiseHeadIco', []), | ||
344 | + commentsTotal: commentsTotal | ||
322 | }; | 345 | }; |
323 | 346 | ||
324 | 347 | ||
@@ -349,7 +372,8 @@ const mini = (req, res, next) => { | @@ -349,7 +372,8 @@ const mini = (req, res, next) => { | ||
349 | page: 'info-index', | 372 | page: 'info-index', |
350 | title: '逛', | 373 | title: '逛', |
351 | gender: gender, | 374 | gender: gender, |
352 | - wechatShare: true | 375 | + wechatShare: true, |
376 | + id: id | ||
353 | }, data)); | 377 | }, data)); |
354 | } else { | 378 | } else { |
355 | return next(); | 379 | return next(); |
@@ -423,9 +447,29 @@ const foryoho = (req, res, next) => { | @@ -423,9 +447,29 @@ const foryoho = (req, res, next) => { | ||
423 | })().catch(next); | 447 | })().catch(next); |
424 | }; | 448 | }; |
425 | 449 | ||
450 | +/** | ||
451 | + * 异步获取逛文章评论 | ||
452 | + * @param {*} req | ||
453 | + * @param {*} res | ||
454 | + * @param {*} next | ||
455 | + */ | ||
456 | +const getComments = (req, res, next) => { | ||
457 | + | ||
458 | + req.ctx(DetailModel).comments({ | ||
459 | + article_id: req.query.article_id, | ||
460 | + page: req.query.page | ||
461 | + }).then(result => { | ||
462 | + return res.render('info/comments', { | ||
463 | + comments: result, | ||
464 | + layout: false | ||
465 | + }); | ||
466 | + }).catch(next); | ||
467 | +}; | ||
468 | + | ||
426 | module.exports = { | 469 | module.exports = { |
427 | index, | 470 | index, |
428 | mini, | 471 | mini, |
429 | foryoho, | 472 | foryoho, |
430 | - indexRedirect | 473 | + indexRedirect, |
474 | + getComments | ||
431 | }; | 475 | }; |
@@ -11,7 +11,8 @@ const helpers = global.yoho.helpers; | @@ -11,7 +11,8 @@ const helpers = global.yoho.helpers; | ||
11 | 11 | ||
12 | const URI_PACKAGE_ARTICLE = 'guang/service/v2/article/'; | 12 | const URI_PACKAGE_ARTICLE = 'guang/service/v2/article/'; |
13 | const URI_PACKAGE_AUTHOR = 'guang/service/v1/author/'; | 13 | const URI_PACKAGE_AUTHOR = 'guang/service/v1/author/'; |
14 | - | 14 | +const URI_PACKAGE_COMMENTS = 'guang/api/v1/comments/'; |
15 | +const URI_PACKAGE_PRAISE = 'guang/api/v1/article/'; | ||
15 | 16 | ||
16 | class DetailModel extends global.yoho.BaseModel { | 17 | class DetailModel extends global.yoho.BaseModel { |
17 | constructor(ctx) { | 18 | constructor(ctx) { |
@@ -348,6 +349,47 @@ class DetailModel extends global.yoho.BaseModel { | @@ -348,6 +349,47 @@ class DetailModel extends global.yoho.BaseModel { | ||
348 | return _.get(result, 'data.product_list', []); | 349 | return _.get(result, 'data.product_list', []); |
349 | }); | 350 | }); |
350 | } | 351 | } |
352 | + | ||
353 | + /** | ||
354 | + * 获取文章评论列表 | ||
355 | + */ | ||
356 | + comments(params) { | ||
357 | + return serviceAPI.get(`${URI_PACKAGE_COMMENTS}getList`, { | ||
358 | + article_id: params.article_id, | ||
359 | + page: params.page, | ||
360 | + limit: params.limit || 10 | ||
361 | + }).then(result => { | ||
362 | + return _.get(result, 'data.list', []); | ||
363 | + }); | ||
364 | + } | ||
365 | + | ||
366 | + /** | ||
367 | + * 获取评论数量 | ||
368 | + * @param {*} params | ||
369 | + */ | ||
370 | + commentsTotal(params) { | ||
371 | + return serviceAPI.get(`${URI_PACKAGE_COMMENTS}getList`, { | ||
372 | + article_id: params.article_id, | ||
373 | + page: 1, | ||
374 | + limit: 1 | ||
375 | + }).then(result => { | ||
376 | + return _.get(result, 'data.total', 0); | ||
377 | + }); | ||
378 | + } | ||
379 | + | ||
380 | + /** | ||
381 | + * 获取点赞相关数据 | ||
382 | + * @param {*} params | ||
383 | + */ | ||
384 | + getArticlePraiseAndFavor(params) { | ||
385 | + return serviceAPI.get(`${URI_PACKAGE_PRAISE}getArticlePraiseAndFavor`, { | ||
386 | + uid: params.uid, | ||
387 | + id: params.id, | ||
388 | + udid: params.udid | ||
389 | + }).then(result => { | ||
390 | + return _.get(result, 'data', {}); | ||
391 | + }); | ||
392 | + } | ||
351 | } | 393 | } |
352 | 394 | ||
353 | module.exports = DetailModel; | 395 | module.exports = DetailModel; |
@@ -133,7 +133,8 @@ class IndexModel extends global.yoho.BaseModel { | @@ -133,7 +133,8 @@ class IndexModel extends global.yoho.BaseModel { | ||
133 | 133 | ||
134 | return api.all([ | 134 | return api.all([ |
135 | this._category(), | 135 | this._category(), |
136 | - this._article(param) | 136 | + this._article(param), |
137 | + this._getTopArticles(param) | ||
137 | ]).then(result => { | 138 | ]).then(result => { |
138 | 139 | ||
139 | let type = param.type; | 140 | let type = param.type; |
@@ -204,11 +205,13 @@ class IndexModel extends global.yoho.BaseModel { | @@ -204,11 +205,13 @@ class IndexModel extends global.yoho.BaseModel { | ||
204 | 205 | ||
205 | } | 206 | } |
206 | 207 | ||
208 | + let infoList = _.get(result && result[2], 'data.list.artList', []); | ||
209 | + | ||
207 | if (result && result[1] && result[1].data && result[1].data.list && result[1].data.list.artList) { | 210 | if (result && result[1] && result[1].data && result[1].data.list && result[1].data.list.artList) { |
208 | 211 | ||
209 | let inf = []; | 212 | let inf = []; |
210 | 213 | ||
211 | - let infoList = result[1].data.list.artList; | 214 | + infoList = _.concat(infoList, result[1].data.list.artList); |
212 | 215 | ||
213 | infoList.forEach(val => { | 216 | infoList.forEach(val => { |
214 | inf.push(guangProcess.formatArticle(val, true, false, true)); | 217 | inf.push(guangProcess.formatArticle(val, true, false, true)); |
@@ -321,6 +324,16 @@ class IndexModel extends global.yoho.BaseModel { | @@ -321,6 +324,16 @@ class IndexModel extends global.yoho.BaseModel { | ||
321 | } | 324 | } |
322 | 325 | ||
323 | /** | 326 | /** |
327 | + * 获取置顶的文章 | ||
328 | + * @param {*} params | ||
329 | + */ | ||
330 | + _getTopArticles(params) { | ||
331 | + return serviceAPI.get('guang/api/v6/article/getTopList', { | ||
332 | + gender: params.gender | ||
333 | + }); | ||
334 | + } | ||
335 | + | ||
336 | + /** | ||
324 | * 逛分类 | 337 | * 逛分类 |
325 | */ | 338 | */ |
326 | _category() { | 339 | _category() { |
@@ -59,6 +59,8 @@ router.get('/:id.html', detail.index); // 逛详情页(兼容 PC 跳转过来的 | @@ -59,6 +59,8 @@ router.get('/:id.html', detail.index); // 逛详情页(兼容 PC 跳转过来的 | ||
59 | router.get('/info/mini', detail.mini); // 逛mini内容页 | 59 | router.get('/info/mini', detail.mini); // 逛mini内容页 |
60 | router.get('/info/foryoho', detail.foryoho); // 逛foryoho内容页 | 60 | router.get('/info/foryoho', detail.foryoho); // 逛foryoho内容页 |
61 | 61 | ||
62 | +router.get('/info/getComments', detail.getComments); // 异步获取逛文章评论 | ||
63 | + | ||
62 | router.get('/plustar', plustar.getListData); // 国际优选列表页 | 64 | router.get('/plustar', plustar.getListData); // 国际优选列表页 |
63 | router.get('/plustar/brandinfo', plustar.getDetailData); // 国际优选详情页 | 65 | router.get('/plustar/brandinfo', plustar.getDetailData); // 国际优选详情页 |
64 | router.post('/plustar/brandinfoAsync', plustar.getDetailDataAsync); // 国际优选详情页异步数据 | 66 | router.post('/plustar/brandinfoAsync', plustar.getDetailDataAsync); // 国际优选详情页异步数据 |
apps/guang/views/action/info/comments.hbs
0 → 100644
1 | +{{#comments}} | ||
2 | +<div class="comments-list clearfix"> | ||
3 | + <div class="avatar"> | ||
4 | + <img src="{{avator}}" alt=""> | ||
5 | + </div> | ||
6 | + <div class="info-box"> | ||
7 | + <div class="info-top"> | ||
8 | + <div> | ||
9 | + <span class="username">{{username}}</span> | ||
10 | + <span class="info-right"> | ||
11 | + <span class="iconfont"></span> | ||
12 | + <span>{{praiseNum}}</span> | ||
13 | + </span> | ||
14 | + </div> | ||
15 | + <div class="time"><span>{{create_time}}</span></div> | ||
16 | + </div> | ||
17 | + <div class="info-bottom">{{#relayTo}}回复{{username}}:{{/relayTo}}{{content}}</div> | ||
18 | + </div> | ||
19 | +</div> | ||
20 | +{{/comments}} |
1 | -<div class="guang-detail-page guang-page yoho-page {{#if guangDetail}}guang-detail{{/if}} {{#if guangEzine}}guang-ezine{{/if}}" id="guangDetail"> | 1 | +<div class="guang-detail-page guang-page yoho-page {{#if guangDetail}}guang-detail{{/if}} {{#if guangEzine}}guang-ezine{{/if}}" id="guangDetail" data-id={{id}}> |
2 | {{# guang}} | 2 | {{# guang}} |
3 | <div id="wrapper" > | 3 | <div id="wrapper" > |
4 | <div id="scroller" class="{{channel}}"> | 4 | <div id="scroller" class="{{channel}}"> |
@@ -81,6 +81,10 @@ | @@ -81,6 +81,10 @@ | ||
81 | </div> | 81 | </div> |
82 | {{/if}} | 82 | {{/if}} |
83 | 83 | ||
84 | + {{#video}} | ||
85 | + <video src="{{src}}" controls="controls" poster="{{cover_image}}"> | ||
86 | + {{/video}} | ||
87 | + | ||
84 | {{#if collocation}} | 88 | {{#if collocation}} |
85 | <div class="post-block collocation-block"> | 89 | <div class="post-block collocation-block"> |
86 | <ul class="thumb-container"> | 90 | <ul class="thumb-container"> |
@@ -200,6 +204,18 @@ | @@ -200,6 +204,18 @@ | ||
200 | {{> wx-footer}} | 204 | {{> wx-footer}} |
201 | </div> | 205 | </div> |
202 | {{/ wxFooter}} | 206 | {{/ wxFooter}} |
207 | + <div class="comments" id="comments"> | ||
208 | + <div class="comments-title clearfix"> | ||
209 | + <div class="avatar-list"> | ||
210 | + {{#each detail.praiseHeadIco}} | ||
211 | + <img src="{{.}}" alt=""> | ||
212 | + {{/each}} | ||
213 | + </div> | ||
214 | + <div class="agree">{{detail.praise}}人点赞</div> | ||
215 | + <div class="seenum"><span>{{detail.pageView}}</span>人看过</div> | ||
216 | + </div> | ||
217 | + <div class="comments-num"><span>评论{{detail.commentsTotal}}</span></div> | ||
218 | + </div> | ||
203 | </div> | 219 | </div> |
204 | 220 | ||
205 | {{!-- wx-share --}} | 221 | {{!-- wx-share --}} |
@@ -33,14 +33,25 @@ | @@ -33,14 +33,25 @@ | ||
33 | 专题 | 33 | 专题 |
34 | <div class="info-tag special-topic"></div> | 34 | <div class="info-tag special-topic"></div> |
35 | {{/ isSpecialTopic}} | 35 | {{/ isSpecialTopic}} |
36 | + {{# isVideo}} | ||
37 | + 视频 | ||
38 | + <div class="info-tag video"></div> | ||
39 | + {{/ isVideo}} | ||
40 | + {{# isShow}} | ||
41 | + SHOW | ||
42 | + <div class="info-tag show"></div> | ||
43 | + {{/ isShow}} | ||
36 | </a> | 44 | </a> |
37 | {{/if}} | 45 | {{/if}} |
38 | - <a href="{{url}}"> | 46 | + <a class="img-box" href="{{url}}"> |
39 | {{#if @first}} | 47 | {{#if @first}} |
40 | <img src="{{image2 img q=60}}" alt="{{alt}}"> | 48 | <img src="{{image2 img q=60}}" alt="{{alt}}"> |
41 | {{^}} | 49 | {{^}} |
42 | <img class="lazy" data-original="{{image2 img q=60}}" alt="{{alt}}"> | 50 | <img class="lazy" data-original="{{image2 img q=60}}" alt="{{alt}}"> |
43 | {{/if}} | 51 | {{/if}} |
52 | + {{#if isVideo}} | ||
53 | + <div class="play"></div> | ||
54 | + {{/if}} | ||
44 | </a> | 55 | </a> |
45 | </div> | 56 | </div> |
46 | 57 |
@@ -11,8 +11,8 @@ const isProduction = process.env.NODE_ENV === 'production'; | @@ -11,8 +11,8 @@ 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/', | 14 | + api: 'http://api-test3.yohops.com:9999/', |
15 | + service: 'http://service-test3.yohops.com:9999/', | ||
16 | singleApi: 'http://api-test3.yohops.com:9999/', | 16 | singleApi: 'http://api-test3.yohops.com:9999/', |
17 | global: 'http://global-test-soa.yohops.com:9999', | 17 | global: 'http://global-test-soa.yohops.com:9999', |
18 | liveApi: 'http://testapi.live.yohops.com:9999/', | 18 | liveApi: 'http://testapi.live.yohops.com:9999/', |
public/img/guang/info/show.png
0 → 100644

2.18 KB
public/img/guang/info/video.png
0 → 100644

2.13 KB
public/img/guang/play-btn.png
0 → 100755

7.48 KB
@@ -24,6 +24,7 @@ function renderData(data) { | @@ -24,6 +24,7 @@ function renderData(data) { | ||
24 | if (data && data.code === 200 && data.data) { | 24 | if (data && data.code === 200 && data.data) { |
25 | 25 | ||
26 | $('.guang-detail-page .page-view').text(data.data.browseNum || 0); | 26 | $('.guang-detail-page .page-view').text(data.data.browseNum || 0); |
27 | + $('.guang-detail-page .comments .seenum span').text(data.data.browseNum || 0); | ||
27 | } | 28 | } |
28 | } | 29 | } |
29 | 30 |
public/js/guang/detail/guang-comments.js
0 → 100644
1 | +/* | ||
2 | + * @Author: Targaryen | ||
3 | + * @Date: 2017-05-25 14:36:33 | ||
4 | + * @Last Modified by: Targaryen | ||
5 | + * @Last Modified time: 2017-06-02 10:51:56 | ||
6 | + */ | ||
7 | +const $ = require('yoho-jquery'); | ||
8 | +const article_id = $('#guangDetail').data('id'); | ||
9 | +const $comments = $('#comments'); | ||
10 | + | ||
11 | +let page = 1; | ||
12 | +let beforeScroll = document.body.scrollTop; // 滚动前位置记录 | ||
13 | +let onLoading = false; // 是否正在加载 | ||
14 | +let loadingEnd = false; | ||
15 | + | ||
16 | +/** | ||
17 | + * 异步加载评论 | ||
18 | + */ | ||
19 | +const getComments = () => { | ||
20 | + if (loadingEnd) { | ||
21 | + return false; | ||
22 | + } | ||
23 | + | ||
24 | + if (!onLoading) { | ||
25 | + onLoading = true; | ||
26 | + } else { | ||
27 | + return false; | ||
28 | + } | ||
29 | + | ||
30 | + $.ajax({ | ||
31 | + type: 'get', | ||
32 | + url: '//guang.m.yohobuy.com/guang/info/getComments', | ||
33 | + data: { | ||
34 | + article_id: article_id, | ||
35 | + page: page++ | ||
36 | + }, | ||
37 | + success: function(result) { | ||
38 | + let noResult = !result || result.length < 1; | ||
39 | + | ||
40 | + if (noResult) { | ||
41 | + loadingEnd = true; | ||
42 | + return false; | ||
43 | + } | ||
44 | + | ||
45 | + $comments.append(result); | ||
46 | + onLoading = false; | ||
47 | + } | ||
48 | + }); | ||
49 | +}; | ||
50 | + | ||
51 | +/** | ||
52 | + * 当scroll到1/2$goodsContainer高度后继续请求下一页数据 | ||
53 | + */ | ||
54 | +const scrollHandler = function() { | ||
55 | + if ($(window).scrollTop() > $('#guangDetail').height() * 0.6) { | ||
56 | + getComments(); | ||
57 | + } | ||
58 | +}; | ||
59 | + | ||
60 | +/** | ||
61 | + * 滚动加载 | ||
62 | + */ | ||
63 | +$(window).scroll(function() { | ||
64 | + setTimeout(function() { | ||
65 | + let afterScroll = document.body.scrollTop; | ||
66 | + | ||
67 | + if (afterScroll - beforeScroll > 0) { | ||
68 | + window.requestAnimationFrame(scrollHandler); | ||
69 | + beforeScroll = afterScroll; | ||
70 | + } else { | ||
71 | + return false; | ||
72 | + } | ||
73 | + }, 5); | ||
74 | +}); | ||
75 | + | ||
76 | +getComments(); |
@@ -29,6 +29,7 @@ require('common'); | @@ -29,6 +29,7 @@ require('common'); | ||
29 | require('plugin/wx-share')(); | 29 | require('plugin/wx-share')(); |
30 | require('./detail-dynamic'); | 30 | require('./detail-dynamic'); |
31 | require('./detail/guang-cart'); | 31 | require('./detail/guang-cart'); |
32 | +require('./detail/guang-comments'); | ||
32 | 33 | ||
33 | let CollactionBlock = require('./collocation-block'); | 34 | let CollactionBlock = require('./collocation-block'); |
34 | 35 | ||
@@ -51,26 +52,6 @@ function initIscroll() { | @@ -51,26 +52,6 @@ function initIscroll() { | ||
51 | hH = $yohoHeader.outerHeight(); | 52 | hH = $yohoHeader.outerHeight(); |
52 | } | 53 | } |
53 | 54 | ||
54 | - /* | ||
55 | - myScroll = new IScroll('#wrapper', { | ||
56 | - probeType: 3, | ||
57 | - mouseWheel: true, | ||
58 | - click: true | ||
59 | - }); | ||
60 | - document.addEventListener('touchmove', function(e) { | ||
61 | - e.preventDefault(); | ||
62 | - }, false); | ||
63 | - | ||
64 | - if (!hasCollocationBlock) { | ||
65 | - myScroll.on('scroll', function() { | ||
66 | - $scroller.trigger('scroll'); | ||
67 | - }); | ||
68 | - return; | ||
69 | - } | ||
70 | - | ||
71 | - */ | ||
72 | - | ||
73 | - | ||
74 | winH = $(window).height() - hH; | 55 | winH = $(window).height() - hH; |
75 | fixedThumbDom = $fixedThumbContainer[0]; | 56 | fixedThumbDom = $fixedThumbContainer[0]; |
76 | 57 | ||
@@ -118,6 +99,18 @@ function initIscroll() { | @@ -118,6 +99,18 @@ function initIscroll() { | ||
118 | } | 99 | } |
119 | } | 100 | } |
120 | }); | 101 | }); |
102 | + | ||
103 | + // 评论滚动加载 | ||
104 | + // setTimeout(function() { | ||
105 | + // let afterScroll = document.body.scrollTop; | ||
106 | + | ||
107 | + // if (afterScroll - beforeScroll > 0) { | ||
108 | + // window.requestAnimationFrame(scrollHandler); | ||
109 | + // beforeScroll = afterScroll; | ||
110 | + // } else { | ||
111 | + // return false; | ||
112 | + // } | ||
113 | + // }, 5); | ||
121 | } | 114 | } |
122 | 115 | ||
123 | /** | 116 | /** |
@@ -134,18 +127,6 @@ $relatedRecoMore.on('touchstart', function(e) { | @@ -134,18 +127,6 @@ $relatedRecoMore.on('touchstart', function(e) { | ||
134 | } | 127 | } |
135 | }); | 128 | }); |
136 | 129 | ||
137 | -/* | ||
138 | - // window onload 后重新refresh iscroll | ||
139 | - window.onload = function() { | ||
140 | - myScroll && myScroll.refresh(); | ||
141 | - }; | ||
142 | - | ||
143 | - // 图片加载完成之后重新 refresh iscroll | ||
144 | - $('img').on('load', function() { | ||
145 | - myScroll && myScroll.refresh(); | ||
146 | - }); | ||
147 | - */ | ||
148 | - | ||
149 | // 微信导航 | 130 | // 微信导航 |
150 | $('.nav-btn').on('touchstart', function() { | 131 | $('.nav-btn').on('touchstart', function() { |
151 | $sideNav.css('pointer-events', 'none'); | 132 | $sideNav.css('pointer-events', 'none'); |
@@ -300,11 +281,6 @@ $('.wei-share').on('touchend', function(e) { | @@ -300,11 +281,6 @@ $('.wei-share').on('touchend', function(e) { | ||
300 | } | 281 | } |
301 | lazyLoad($('.lazy')); | 282 | lazyLoad($('.lazy')); |
302 | 283 | ||
303 | - // title mlellipsis | ||
304 | - // $('.info-list .title, .one-good .reco-name').each(function() { | ||
305 | - // this.mlellipsis(2); | ||
306 | - // }); | ||
307 | - | ||
308 | // offset.left约等于marginLeft的值则表示介绍被换行,则清除intro的paddingTop让其更靠近头像和作者名 | 284 | // offset.left约等于marginLeft的值则表示介绍被换行,则清除intro的paddingTop让其更靠近头像和作者名 |
309 | if ($authorIntro.offset() && (parseInt($authorIntro.offset().left, 10) === | 285 | if ($authorIntro.offset() && (parseInt($authorIntro.offset().left, 10) === |
310 | parseInt($authorIntro.css('margin-left'), 10))) { | 286 | parseInt($authorIntro.css('margin-left'), 10))) { |
@@ -318,8 +294,6 @@ $('.wei-share').on('touchend', function(e) { | @@ -318,8 +294,6 @@ $('.wei-share').on('touchend', function(e) { | ||
318 | $('#float-layer-close').on('touchend', function() { | 294 | $('#float-layer-close').on('touchend', function() { |
319 | let appClose = window.cookie('_float-layer-app-close') || '0'; | 295 | let appClose = window.cookie('_float-layer-app-close') || '0'; |
320 | 296 | ||
321 | - // window.setCookie('_float-layer-app-close', 1); | ||
322 | - | ||
323 | if (parseInt(appClose, 10) === 0) { | 297 | if (parseInt(appClose, 10) === 0) { |
324 | setCookie('_float-layer-app-close', 1, {expires: -1}); | 298 | setCookie('_float-layer-app-close', 1, {expires: -1}); |
325 | 299 | ||
@@ -351,14 +325,11 @@ $('.wei-share').on('touchend', function(e) { | @@ -351,14 +325,11 @@ $('.wei-share').on('touchend', function(e) { | ||
351 | }); | 325 | }); |
352 | 326 | ||
353 | if (typeof window.cookie === 'function' && parseInt(window.cookie('_float-layer-app-close'), 10) !== 2) { | 327 | if (typeof window.cookie === 'function' && parseInt(window.cookie('_float-layer-app-close'), 10) !== 2) { |
354 | - // $('#float-layer-app').show(); | ||
355 | $('.down-bottom').show(); | 328 | $('.down-bottom').show(); |
356 | } else { | 329 | } else { |
357 | - // $('#float-layer-app').hide(); | ||
358 | $('.down-bottom').hide(); | 330 | $('.down-bottom').hide(); |
359 | } | 331 | } |
360 | } | 332 | } |
361 | 333 | ||
362 | initIscroll(); | 334 | initIscroll(); |
363 | }()); | 335 | }()); |
364 | - |
@@ -712,6 +712,7 @@ $focus-size: 42px; | @@ -712,6 +712,7 @@ $focus-size: 42px; | ||
712 | margin: 30px 0; | 712 | margin: 30px 0; |
713 | overflow-x: scroll; | 713 | overflow-x: scroll; |
714 | overflow-y: hidden; | 714 | overflow-y: hidden; |
715 | + -webkit-overflow-scrolling: touch; | ||
715 | } | 716 | } |
716 | 717 | ||
717 | .recommend-products-box > .recommend-products-content { | 718 | .recommend-products-box > .recommend-products-content { |
@@ -748,6 +749,10 @@ $focus-size: 42px; | @@ -748,6 +749,10 @@ $focus-size: 42px; | ||
748 | padding: 6px; | 749 | padding: 6px; |
749 | } | 750 | } |
750 | } | 751 | } |
752 | + | ||
753 | + video { | ||
754 | + width: 100%; | ||
755 | + } | ||
751 | } | 756 | } |
752 | 757 | ||
753 | .guang-detail-page.menu-open { | 758 | .guang-detail-page.menu-open { |
@@ -40,6 +40,16 @@ | @@ -40,6 +40,16 @@ | ||
40 | width: 100%; | 40 | width: 100%; |
41 | min-height: 400px; | 41 | min-height: 400px; |
42 | } | 42 | } |
43 | + | ||
44 | + .play { | ||
45 | + position: absolute; | ||
46 | + width: 140px; | ||
47 | + height: 140px; | ||
48 | + left: 50%; | ||
49 | + top: 50%; | ||
50 | + transform: translate(-50%, -50%); | ||
51 | + background-image: url("/guang/play-btn.png"); | ||
52 | + } | ||
43 | } | 53 | } |
44 | 54 | ||
45 | .info-match { | 55 | .info-match { |
@@ -84,6 +94,14 @@ | @@ -84,6 +94,14 @@ | ||
84 | &.topic { | 94 | &.topic { |
85 | background-image: url("/guang/info/topic.png"); | 95 | background-image: url("/guang/info/topic.png"); |
86 | } | 96 | } |
97 | + | ||
98 | + &.video { | ||
99 | + background-image: url("/guang/info/video.png"); | ||
100 | + } | ||
101 | + | ||
102 | + &.show { | ||
103 | + background-image: url("/guang/info/show.png"); | ||
104 | + } | ||
87 | } | 105 | } |
88 | 106 | ||
89 | .info-deps { | 107 | .info-deps { |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | * @Author: Targaryen | 2 | * @Author: Targaryen |
3 | * @Date: 2017-05-03 14:08:52 | 3 | * @Date: 2017-05-03 14:08:52 |
4 | * @Last Modified by: Targaryen | 4 | * @Last Modified by: Targaryen |
5 | - * @Last Modified time: 2017-05-15 19:22:38 | 5 | + * @Last Modified time: 2017-05-27 14:53:10 |
6 | */ | 6 | */ |
7 | .guang-list-page { | 7 | .guang-list-page { |
8 | .product-list-box { | 8 | .product-list-box { |
@@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
11 | padding: 0 20px; | 11 | padding: 0 20px; |
12 | overflow-x: scroll; | 12 | overflow-x: scroll; |
13 | overflow-y: hidden; | 13 | overflow-y: hidden; |
14 | + -webkit-overflow-scrolling: touch; | ||
14 | } | 15 | } |
15 | 16 | ||
16 | .product-list { | 17 | .product-list { |
public/scss/guang/detail/_comments.css
0 → 100644
1 | +/* | ||
2 | + * @Author: Targaryen | ||
3 | + * @Date: 2017-05-25 15:49:46 | ||
4 | + * @Last Modified by: Targaryen | ||
5 | + * @Last Modified time: 2017-06-02 10:43:21 | ||
6 | + */ | ||
7 | + | ||
8 | +.guang-detail-page .comments { | ||
9 | + margin-top: 30px; | ||
10 | + background-color: #fff; | ||
11 | + | ||
12 | + .comments-title { | ||
13 | + color: #444; | ||
14 | + padding: 30px; | ||
15 | + border-bottom: 1px solid #b0b0b0; | ||
16 | + line-height: 70px; | ||
17 | + | ||
18 | + .avatar-list { | ||
19 | + float: left; | ||
20 | + margin-right: 30px; | ||
21 | + | ||
22 | + img { | ||
23 | + width: 70px; | ||
24 | + height: 70px; | ||
25 | + border-radius: 35px; | ||
26 | + margin-left: -35px; | ||
27 | + float: left; | ||
28 | + border: 2px solid #fff; | ||
29 | + } | ||
30 | + | ||
31 | + img:first-child { | ||
32 | + margin-left: 0; | ||
33 | + } | ||
34 | + } | ||
35 | + | ||
36 | + .agree { | ||
37 | + float: left; | ||
38 | + } | ||
39 | + | ||
40 | + .seenum { | ||
41 | + float: right; | ||
42 | + } | ||
43 | + } | ||
44 | + | ||
45 | + .comments-num { | ||
46 | + padding: 0 30px; | ||
47 | + height: 50px; | ||
48 | + line-height: 50px; | ||
49 | + } | ||
50 | + | ||
51 | + .comments-num > span { | ||
52 | + color: #b0b0b0; | ||
53 | + } | ||
54 | + | ||
55 | + .comments-list { | ||
56 | + padding-bottom: 40px; | ||
57 | + margin: 30px; | ||
58 | + border-bottom: 1px solid #b0b0b0; | ||
59 | + | ||
60 | + &:last-child { | ||
61 | + border-bottom: none; | ||
62 | + } | ||
63 | + | ||
64 | + .avatar { | ||
65 | + float: left; | ||
66 | + width: 70px; | ||
67 | + overflow: hidden; | ||
68 | + margin-right: 30px; | ||
69 | + } | ||
70 | + | ||
71 | + .avatar > img { | ||
72 | + width: 70px; | ||
73 | + height: 70px; | ||
74 | + border-radius: 35px; | ||
75 | + } | ||
76 | + | ||
77 | + .info-box { | ||
78 | + float: left; | ||
79 | + width: 480px; | ||
80 | + overflow: hidden; | ||
81 | + } | ||
82 | + | ||
83 | + .info-top { | ||
84 | + .username { | ||
85 | + font-size: 26px; | ||
86 | + font-weight: 700; | ||
87 | + color: #444; | ||
88 | + } | ||
89 | + | ||
90 | + .info-right { | ||
91 | + float: right; | ||
92 | + color: #b0b0b0; | ||
93 | + } | ||
94 | + | ||
95 | + .time { | ||
96 | + color: #b0b0b0; | ||
97 | + padding: 5px 0; | ||
98 | + } | ||
99 | + } | ||
100 | + | ||
101 | + .info-bottom { | ||
102 | + color: #444; | ||
103 | + } | ||
104 | + } | ||
105 | +} |
@@ -33,7 +33,7 @@ const transHttpsUrl = (url) => { | @@ -33,7 +33,7 @@ const transHttpsUrl = (url) => { | ||
33 | * @return {[strng]} | 33 | * @return {[strng]} |
34 | */ | 34 | */ |
35 | const getFilterUrl = (url) => { | 35 | const getFilterUrl = (url) => { |
36 | - url = url.replace('.m.yohobuy.com', global.yoho.config.subDomains.host) | 36 | + url = url && url.replace('.m.yohobuy.com', global.yoho.config.subDomains.host) |
37 | .replace('www.yohobuy.com', global.yoho.config.siteUrl); | 37 | .replace('www.yohobuy.com', global.yoho.config.siteUrl); |
38 | 38 | ||
39 | const whiteDomains = ['m.yohobuy.com', 'cdn.yoho.cn/myohobuy']; | 39 | const whiteDomains = ['m.yohobuy.com', 'cdn.yoho.cn/myohobuy']; |
@@ -43,15 +43,16 @@ const getFilterUrl = (url) => { | @@ -43,15 +43,16 @@ const getFilterUrl = (url) => { | ||
43 | 'huodong.m.yohobuy.com', | 43 | 'huodong.m.yohobuy.com', |
44 | '/home/orders/pay']; | 44 | '/home/orders/pay']; |
45 | 45 | ||
46 | - if (whiteDomains.every(item => url.includes(item)) && | 46 | + if (whiteDomains.every(item => url && url.includes(item)) && |
47 | blackDomains.every(item => !url.includes(item))) { | 47 | blackDomains.every(item => !url.includes(item))) { |
48 | url = url.replace('http://', '//'); | 48 | url = url.replace('http://', '//'); |
49 | } | 49 | } |
50 | 50 | ||
51 | - if (url.includes('feature.yoho.cn')) { | 51 | + if (url && url.includes('feature.yoho.cn')) { |
52 | url = transHttpsUrl(url); | 52 | url = transHttpsUrl(url); |
53 | } | 53 | } |
54 | - if (url.includes('openby:yohobuy=')) { | 54 | + |
55 | + if (url && url.includes('openby:yohobuy=')) { | ||
55 | let filters = ['openby:yohobuy=', '&', '?']; | 56 | let filters = ['openby:yohobuy=', '&', '?']; |
56 | 57 | ||
57 | filters.forEach(item => { | 58 | filters.forEach(item => { |
@@ -162,6 +163,12 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid) => { | @@ -162,6 +163,12 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid) => { | ||
162 | case '19': // 专题 | 163 | case '19': // 专题 |
163 | result.isSpecialTopic = true; | 164 | result.isSpecialTopic = true; |
164 | break; | 165 | break; |
166 | + case '9999': // 视频 | ||
167 | + result.isVideo = true; | ||
168 | + break; | ||
169 | + case '24': // Show | ||
170 | + result.isShow = true; | ||
171 | + break; | ||
165 | default: | 172 | default: |
166 | break; | 173 | break; |
167 | } | 174 | } |
@@ -235,11 +242,16 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW | @@ -235,11 +242,16 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW | ||
235 | if (_.get(value, 'singleImage.data.length', false)) { | 242 | if (_.get(value, 'singleImage.data.length', false)) { |
236 | let tagList = _.get(value, 'singleImage.data[0].tagList', []); | 243 | let tagList = _.get(value, 'singleImage.data[0].tagList', []); |
237 | 244 | ||
245 | + | ||
238 | if (tagList.length > 0) { | 246 | if (tagList.length > 0) { |
239 | _.forEach(tagList, (tag, tagIndex) => { | 247 | _.forEach(tagList, (tag, tagIndex) => { |
240 | 248 | ||
241 | // 链接 | 249 | // 链接 |
242 | - tagList[tagIndex].href = '//m.yohobuy.com/product/' + tag.product_skn + '.html'; | 250 | + if (tag.is_global === 'Y') { |
251 | + tagList[tagIndex].href = '//m.yohobuy.com/product/global/' + tag.product_skn + '.html'; | ||
252 | + } else { | ||
253 | + tagList[tagIndex].href = '//m.yohobuy.com/product/' + tag.product_skn + '.html'; | ||
254 | + } | ||
243 | tagList[tagIndex].isApp = isApp; | 255 | tagList[tagIndex].isApp = isApp; |
244 | }); | 256 | }); |
245 | } | 257 | } |
@@ -362,6 +374,18 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW | @@ -362,6 +374,18 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW | ||
362 | recommendProducts: _.get(value, 'recommend_products.data', []) | 374 | recommendProducts: _.get(value, 'recommend_products.data', []) |
363 | }); | 375 | }); |
364 | } | 376 | } |
377 | + | ||
378 | + // 视频 | ||
379 | + if (_.get(value, 'video', false)) { | ||
380 | + let video = { | ||
381 | + src: _.get(value, 'video.data.src', ''), | ||
382 | + cover_image: _.get(value, 'video.data.cover_image', '') | ||
383 | + }; | ||
384 | + | ||
385 | + finalDetail.push({ | ||
386 | + video: video | ||
387 | + }); | ||
388 | + } | ||
365 | }); | 389 | }); |
366 | 390 | ||
367 | return { | 391 | return { |
-
Please register or login to post a comment