Authored by lea guo

发现好货

... ... @@ -2,35 +2,65 @@ 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 || {};
req.ctx(FindGoods).findGoods({page}).then((result)=> {
if (!result) {
return next();
}
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"}}`;
const jsSdk = global.yoho.config.jsSdk;
console.log('---------result---------', result);
res.render('find-goods/index', {
module: 'activity',
page: 'find-goods',
title: title,
content: result.data,
isFeature: true,
wechatShare: true,
localCss: true,
loadJs: [{
src: qcdn ? jsSdk.replace(/\/\/cdn.yoho.cn/gi, '//qcdn.yoho.cn') : jsSdk
}]
});
}).then().catch(next);
const { page = 1 } = req.query || {};
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),
);
// 唤起 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"}}`;
const jsSdk = global.yoho.config.jsSdk;
console.log('---------result---------', result);
res.render('find-goods/index', {
module: 'activity',
page: 'find-goods',
title: title,
content: result.data,
isFeature: true,
wechatShare: true,
localCss: true,
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
});
})
.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 {
padding: 48px 30px 54px 30px;
border-bottom: 1px solid #e0e0e0;
.find-goods-wrapper {
height: 100vh;
overflow-x: hidden;
overflow-y: auto;
&:last-child {
border-bottom: 0;
}
.author-info {
.empty {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.avatar-img {
border-radius: 50%;
}
.item-wrapper {
padding: 48px 30px 54px 30px;
border-bottom: 1px solid #e0e0e0;
.avatar-name {
font-size: 24px;
color: rgba(153, 153, 153, 0.85);
letter-spacing: 0.08px;
line-height: 13px;
padding-left: 16px;
&:last-child {
border-bottom: 0;
}
}
.item-info {
display: flex;
margin-top: 30px;
max-height: 240px;
overflow: hidden;
.item-detail {
.author-info {
display: flex;
flex-direction: column;
flex: 1;
margin-left: 38px;
justify-content: space-between;
align-items: center;
.item-name {
font-size: 28px;
letter-spacing: 0.18px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
max-height: 92px;
.avatar-img {
border-radius: 50%;
}
.item-desc {
font-size: 22px;
color: #b0b0b0;
letter-spacing: 0;
max-height: 64px;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
overflow: hidden;
-webkit-box-orient: vertical;
margin-top: 10px;
.avatar-name {
font-size: 24px;
color: rgba(153, 153, 153, 0.85);
letter-spacing: 0.08px;
line-height: 13px;
padding-left: 16px;
}
}
.action-tip {
font-size: 24px;
letter-spacing: 0.16px;
.item-info {
display: flex;
margin-top: 30px;
max-height: 240px;
overflow: hidden;
.item-detail {
display: flex;
align-items: center;
flex-direction: column;
flex: 1;
margin-left: 38px;
justify-content: space-between;
.item-name {
font-size: 28px;
letter-spacing: 0.18px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
max-height: 92px;
}
.item-desc {
font-size: 22px;
color: #b0b0b0;
letter-spacing: 0;
max-height: 64px;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
overflow: hidden;
-webkit-box-orient: vertical;
margin-top: 10px;
}
.action-tip {
font-size: 24px;
letter-spacing: 0.16px;
display: flex;
align-items: center;
}
.action-icon {
display: inline-block;
... ...