Showing
6 changed files
with
131 additions
and
86 deletions
@@ -2,35 +2,65 @@ const FindGoods = require('../models/find-goods'); | @@ -2,35 +2,65 @@ const FindGoods = require('../models/find-goods'); | ||
2 | const _ = require('lodash'); | 2 | const _ = require('lodash'); |
3 | const stringProcess = require('../../../utils/string-process'); | 3 | const stringProcess = require('../../../utils/string-process'); |
4 | 4 | ||
5 | - | ||
6 | exports.index = function(req, res, next) { | 5 | exports.index = function(req, res, next) { |
7 | let qcdn = _.get(req.app.locals, 'wap.qcloud_cdn'); | 6 | let qcdn = _.get(req.app.locals, 'wap.qcloud_cdn'); |
8 | - const {page = 1} = req.query || {}; | ||
9 | - | ||
10 | - req.ctx(FindGoods).findGoods({page}).then((result)=> { | ||
11 | - if (!result) { | ||
12 | - return next(); | ||
13 | - } | ||
14 | - const title = stringProcess.paramsFilter(req.query.title) || '发现好货'; | ||
15 | - const shareId = _.parseInt(stringProcess.paramsFilter(req.query.share_id)); | ||
16 | - | ||
17 | - // 唤起 APP 的路径 | ||
18 | - res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.h5","params":{"param":{"share_id":"${shareId}","title":"${title}"},"share":"/operations/api/v5/webshare/getShare","shareparam":{"share_id":"${shareId}"},"title":"${title}","url":"https://activity.yoho.cn/activity/find/goods.html"}}`; | ||
19 | - | ||
20 | - const jsSdk = global.yoho.config.jsSdk; | ||
21 | - | ||
22 | - console.log('---------result---------', result); | ||
23 | - res.render('find-goods/index', { | ||
24 | - module: 'activity', | ||
25 | - page: 'find-goods', | ||
26 | - title: title, | ||
27 | - content: result.data, | ||
28 | - isFeature: true, | ||
29 | - wechatShare: true, | ||
30 | - localCss: true, | ||
31 | - loadJs: [{ | ||
32 | - src: qcdn ? jsSdk.replace(/\/\/cdn.yoho.cn/gi, '//qcdn.yoho.cn') : jsSdk | ||
33 | - }] | ||
34 | - }); | ||
35 | - }).then().catch(next); | 7 | + const { page = 1 } = req.query || {}; |
8 | + | ||
9 | + req.ctx(FindGoods) | ||
10 | + .findGoods({ page, limit: 5 }) | ||
11 | + .then(result => { | ||
12 | + if (!result) { | ||
13 | + return next(); | ||
14 | + } | ||
15 | + const title = | ||
16 | + stringProcess.paramsFilter(req.query.title) || '发现好货'; | ||
17 | + const shareId = _.parseInt( | ||
18 | + stringProcess.paramsFilter(req.query.share_id), | ||
19 | + ); | ||
20 | + | ||
21 | + // 唤起 APP 的路径 | ||
22 | + res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.h5","params":{"param":{"share_id":"${shareId}","title":"${title}"},"share":"/operations/api/v5/webshare/getShare","shareparam":{"share_id":"${shareId}"},"title":"${title}","url":"https://activity.yoho.cn/activity/find/goods.html"}}`; | ||
23 | + | ||
24 | + const jsSdk = global.yoho.config.jsSdk; | ||
25 | + | ||
26 | + console.log('---------result---------', result); | ||
27 | + | ||
28 | + res.render('find-goods/index', { | ||
29 | + module: 'activity', | ||
30 | + page: 'find-goods', | ||
31 | + title: title, | ||
32 | + content: result.data, | ||
33 | + isFeature: true, | ||
34 | + wechatShare: true, | ||
35 | + localCss: true, | ||
36 | + loadJs: [ | ||
37 | + { | ||
38 | + src: qcdn ? | ||
39 | + jsSdk.replace( | ||
40 | + /\/\/cdn.yoho.cn/gi, | ||
41 | + '//qcdn.yoho.cn', | ||
42 | + ) : | ||
43 | + jsSdk, | ||
44 | + }, | ||
45 | + ], | ||
46 | + }); | ||
47 | + }) | ||
48 | + .catch(next); | ||
49 | +}; | ||
50 | + | ||
51 | +exports.fetchMore = function(req, res, next) { | ||
52 | + const { page = 1 } = req.query || {}; | ||
53 | + | ||
54 | + req.ctx(FindGoods) | ||
55 | + .findGoods({ page }) | ||
56 | + .then(result => { | ||
57 | + if (!result) { | ||
58 | + return next(); | ||
59 | + } | ||
60 | + | ||
61 | + res.render('find-goods/item-list', { | ||
62 | + content: result.data | ||
63 | + }); | ||
64 | + }) | ||
65 | + .catch(next); | ||
36 | }; | 66 | }; |
@@ -473,5 +473,6 @@ router.get('/group/loadOrder', auth, group.loadOrder); // 加载拼团列表 | @@ -473,5 +473,6 @@ router.get('/group/loadOrder', auth, group.loadOrder); // 加载拼团列表 | ||
473 | 473 | ||
474 | // 发现好货 | 474 | // 发现好货 |
475 | router.get('/find/goods', FindGoods.index); | 475 | router.get('/find/goods', FindGoods.index); |
476 | +router.get('/find/goods/more', FindGoods.fetchMore); | ||
476 | 477 | ||
477 | module.exports = router; | 478 | module.exports = router; |
1 | <div class="item-wrapper"> | 1 | <div class="item-wrapper"> |
2 | - <div class="author-info"> | 2 | + <a class="author-info"> |
3 | <img class="avatar-img" src="{{image2 authorHeadIco w=30 h=30}}" alt="" /> | 3 | <img class="avatar-img" src="{{image2 authorHeadIco w=30 h=30}}" alt="" /> |
4 | <span class="avatar-name">{{authorName}}</span> | 4 | <span class="avatar-name">{{authorName}}</span> |
5 | - </div> | 5 | + </a> |
6 | <a class="item-info"> | 6 | <a class="item-info"> |
7 | <img src="{{image2 findGood.productImage w=120 h=120}}" alt="" /> | 7 | <img src="{{image2 findGood.productImage w=120 h=120}}" alt="" /> |
8 | <div class="item-detail"> | 8 | <div class="item-detail"> |
1 | -.item-wrapper { | ||
2 | - padding: 48px 30px 54px 30px; | ||
3 | - border-bottom: 1px solid #e0e0e0; | 1 | +.find-goods-wrapper { |
2 | + height: 100vh; | ||
3 | + overflow-x: hidden; | ||
4 | + overflow-y: auto; | ||
4 | 5 | ||
5 | - &:last-child { | ||
6 | - border-bottom: 0; | ||
7 | - } | ||
8 | - | ||
9 | - .author-info { | 6 | + .empty { |
7 | + height: 100%; | ||
10 | display: flex; | 8 | display: flex; |
11 | align-items: center; | 9 | align-items: center; |
10 | + justify-content: center; | ||
11 | + } | ||
12 | 12 | ||
13 | - .avatar-img { | ||
14 | - border-radius: 50%; | ||
15 | - } | 13 | + .item-wrapper { |
14 | + padding: 48px 30px 54px 30px; | ||
15 | + border-bottom: 1px solid #e0e0e0; | ||
16 | 16 | ||
17 | - .avatar-name { | ||
18 | - font-size: 24px; | ||
19 | - color: rgba(153, 153, 153, 0.85); | ||
20 | - letter-spacing: 0.08px; | ||
21 | - line-height: 13px; | ||
22 | - padding-left: 16px; | 17 | + &:last-child { |
18 | + border-bottom: 0; | ||
23 | } | 19 | } |
24 | - } | ||
25 | 20 | ||
26 | - .item-info { | ||
27 | - display: flex; | ||
28 | - margin-top: 30px; | ||
29 | - max-height: 240px; | ||
30 | - overflow: hidden; | ||
31 | - | ||
32 | - .item-detail { | 21 | + .author-info { |
33 | display: flex; | 22 | display: flex; |
34 | - flex-direction: column; | ||
35 | - flex: 1; | ||
36 | - margin-left: 38px; | ||
37 | - justify-content: space-between; | 23 | + align-items: center; |
38 | 24 | ||
39 | - .item-name { | ||
40 | - font-size: 28px; | ||
41 | - letter-spacing: 0.18px; | ||
42 | - display: -webkit-box; | ||
43 | - -webkit-line-clamp: 2; | ||
44 | - -webkit-box-orient: vertical; | ||
45 | - overflow: hidden; | ||
46 | - text-overflow: ellipsis; | ||
47 | - max-height: 92px; | 25 | + .avatar-img { |
26 | + border-radius: 50%; | ||
48 | } | 27 | } |
49 | 28 | ||
50 | - .item-desc { | ||
51 | - font-size: 22px; | ||
52 | - color: #b0b0b0; | ||
53 | - letter-spacing: 0; | ||
54 | - max-height: 64px; | ||
55 | - text-overflow: ellipsis; | ||
56 | - display: -webkit-box; | ||
57 | - -webkit-line-clamp: 2; | ||
58 | - overflow: hidden; | ||
59 | - -webkit-box-orient: vertical; | ||
60 | - margin-top: 10px; | 29 | + .avatar-name { |
30 | + font-size: 24px; | ||
31 | + color: rgba(153, 153, 153, 0.85); | ||
32 | + letter-spacing: 0.08px; | ||
33 | + line-height: 13px; | ||
34 | + padding-left: 16px; | ||
61 | } | 35 | } |
36 | + } | ||
62 | 37 | ||
63 | - .action-tip { | ||
64 | - font-size: 24px; | ||
65 | - letter-spacing: 0.16px; | 38 | + .item-info { |
39 | + display: flex; | ||
40 | + margin-top: 30px; | ||
41 | + max-height: 240px; | ||
42 | + overflow: hidden; | ||
43 | + | ||
44 | + .item-detail { | ||
66 | display: flex; | 45 | display: flex; |
67 | - align-items: center; | 46 | + flex-direction: column; |
47 | + flex: 1; | ||
48 | + margin-left: 38px; | ||
49 | + justify-content: space-between; | ||
50 | + | ||
51 | + .item-name { | ||
52 | + font-size: 28px; | ||
53 | + letter-spacing: 0.18px; | ||
54 | + display: -webkit-box; | ||
55 | + -webkit-line-clamp: 2; | ||
56 | + -webkit-box-orient: vertical; | ||
57 | + overflow: hidden; | ||
58 | + text-overflow: ellipsis; | ||
59 | + max-height: 92px; | ||
60 | + } | ||
61 | + | ||
62 | + .item-desc { | ||
63 | + font-size: 22px; | ||
64 | + color: #b0b0b0; | ||
65 | + letter-spacing: 0; | ||
66 | + max-height: 64px; | ||
67 | + text-overflow: ellipsis; | ||
68 | + display: -webkit-box; | ||
69 | + -webkit-line-clamp: 2; | ||
70 | + overflow: hidden; | ||
71 | + -webkit-box-orient: vertical; | ||
72 | + margin-top: 10px; | ||
73 | + } | ||
74 | + | ||
75 | + .action-tip { | ||
76 | + font-size: 24px; | ||
77 | + letter-spacing: 0.16px; | ||
78 | + display: flex; | ||
79 | + align-items: center; | ||
80 | + } | ||
68 | 81 | ||
69 | .action-icon { | 82 | .action-icon { |
70 | display: inline-block; | 83 | display: inline-block; |
-
Please register or login to post a comment