Authored by lea guo

发现好货

... ... @@ -2,17 +2,21 @@ const FindGoods = require('../models/find-goods');
const _ = require('lodash');
const stringProcess = require('../../../utils/string-process');
exports.index = function(req, res, next) {
let qcdn = _.get(req.app.locals, 'wap.qcloud_cdn');
const {page = 1} = req.query || {};
const { page = 1 } = req.query || {};
req.ctx(FindGoods).findGoods({page}).then((result)=> {
req.ctx(FindGoods)
.findGoods({ page, limit: 5 })
.then(result => {
if (!result) {
return next();
}
const title = stringProcess.paramsFilter(req.query.title) || '发现好货';
const shareId = _.parseInt(stringProcess.paramsFilter(req.query.share_id));
const title =
stringProcess.paramsFilter(req.query.title) || '发现好货';
const shareId = _.parseInt(
stringProcess.paramsFilter(req.query.share_id),
);
// 唤起 APP 的路径
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"}}`;
... ... @@ -20,6 +24,7 @@ exports.index = function(req, res, next) {
const jsSdk = global.yoho.config.jsSdk;
console.log('---------result---------', result);
res.render('find-goods/index', {
module: 'activity',
page: 'find-goods',
... ... @@ -28,9 +33,34 @@ exports.index = function(req, res, next) {
isFeature: true,
wechatShare: true,
localCss: true,
loadJs: [{
src: qcdn ? jsSdk.replace(/\/\/cdn.yoho.cn/gi, '//qcdn.yoho.cn') : jsSdk
}]
loadJs: [
{
src: qcdn ?
jsSdk.replace(
/\/\/cdn.yoho.cn/gi,
'//qcdn.yoho.cn',
) :
jsSdk,
},
],
});
})
.catch(next);
};
exports.fetchMore = function(req, res, next) {
const { page = 1 } = req.query || {};
req.ctx(FindGoods)
.findGoods({ page })
.then(result => {
if (!result) {
return next();
}
res.render('find-goods/item-list', {
content: result.data
});
}).then().catch(next);
})
.catch(next);
};
... ...
... ... @@ -473,5 +473,6 @@ router.get('/group/loadOrder', auth, group.loadOrder); // 加载拼团列表
// 发现好货
router.get('/find/goods', FindGoods.index);
router.get('/find/goods/more', FindGoods.fetchMore);
module.exports = router;
... ...
<div class="find-goods-wrapper">
发现好货
{{log content}}
{{#unless content.detailList}}
<div class="empty">
暂无数据
... ...
{{#content.detailList}}
{{> find-goods/item-info}}
{{/content.detailList}}
\ No newline at end of file
... ...
<div class="item-wrapper">
<div class="author-info">
<a class="author-info">
<img class="avatar-img" src="{{image2 authorHeadIco w=30 h=30}}" alt="" />
<span class="avatar-name">{{authorName}}</span>
</div>
</a>
<a class="item-info">
<img src="{{image2 findGood.productImage w=120 h=120}}" alt="" />
<div class="item-detail">
... ...
.item-wrapper {
.find-goods-wrapper {
height: 100vh;
overflow-x: hidden;
overflow-y: auto;
.empty {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.item-wrapper {
padding: 48px 30px 54px 30px;
border-bottom: 1px solid #e0e0e0;
... ... @@ -65,6 +77,7 @@
letter-spacing: 0.16px;
display: flex;
align-items: center;
}
.action-icon {
display: inline-block;
... ...