Authored by lea guo

发现好货

  1 +const FindGoods = require('../models/find-goods');
  2 +const _ = require('lodash');
  3 +const stringProcess = require('../../../utils/string-process');
  4 +
  5 +
  6 +exports.index = function(req, res, next) {
  7 + 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);
  36 +};
  1 +/**
  2 + * 发现好货商品列表
  3 + */
  4 +
  5 +module.exports = class FindGoods extends global.yoho.BaseModel {
  6 + constructor(ctx) {
  7 + super(ctx);
  8 + }
  9 +
  10 + /**
  11 + *
  12 + * @param {*} {uid, page, limit}
  13 + */
  14 + findGoods(params) {
  15 + console.log('----------find goods api----------');
  16 + return this.get({
  17 + data: Object.assign({
  18 + method: 'app.grass.findGrassGoods'
  19 + }, params)
  20 + });
  21 + }
  22 +};
@@ -78,6 +78,8 @@ const yoluckBack = require(`${cRoot}/yoluck-back`); @@ -78,6 +78,8 @@ const yoluckBack = require(`${cRoot}/yoluck-back`);
78 78
79 const group = require(`${cRoot}/group`); 79 const group = require(`${cRoot}/group`);
80 80
  81 +// 发现好货
  82 +const FindGoods = require('./controllers/find-goods');
81 83
82 // routers 84 // routers
83 85
@@ -136,15 +138,22 @@ router.get('/raffle/enter', raffle.enter); // 微信免单抽奖活动入口页 @@ -136,15 +138,22 @@ router.get('/raffle/enter', raffle.enter); // 微信免单抽奖活动入口页
136 router.post('/raffle/lucky', raffle.lucky); // 微信免单抽奖按钮 138 router.post('/raffle/lucky', raffle.lucky); // 微信免单抽奖按钮
137 router.get('/raffle/bind', raffle.bind); // 送有货币 139 router.get('/raffle/bind', raffle.bind); // 送有货币
138 140
139 -router.get(/\/invite\/share_([\d]+)_([\d]+)_([\d]+).html/, invite.checkType, invite.share); 141 +router.get(
  142 + /\/invite\/share_([\d]+)_([\d]+)_([\d]+).html/,
  143 + invite.checkType,
  144 + invite.share,
  145 +);
140 146
141 router.get('/invite/sendRegCodeToMobile', invite.sendRegCodeToMobile); 147 router.get('/invite/sendRegCodeToMobile', invite.sendRegCodeToMobile);
142 router.get('/invite/checkOldUserCoupon', invite.checkOldUserCoupon); 148 router.get('/invite/checkOldUserCoupon', invite.checkOldUserCoupon);
143 router.get('/invite/validRegCode', invite.validRegCode); 149 router.get('/invite/validRegCode', invite.validRegCode);
144 router.get('/invite/register', invite.register); 150 router.get('/invite/register', invite.register);
145 router.get('/invite/receiveCoupons', invite.receiveCoupons); 151 router.get('/invite/receiveCoupons', invite.receiveCoupons);
146 -router.get(/\/invite\/mycoupons_([\d]+)_([\d]+)_([\d]+)_([\d]+).html/,  
147 - invite.checkType, invite.myCoupons); // 好友领取完优惠券的页面 152 +router.get(
  153 + /\/invite\/mycoupons_([\d]+)_([\d]+)_([\d]+)_([\d]+).html/,
  154 + invite.checkType,
  155 + invite.myCoupons,
  156 +); // 好友领取完优惠券的页面
148 router.get('/invite/getwxinfo', invite.getwxinfo); 157 router.get('/invite/getwxinfo', invite.getwxinfo);
149 router.get('/invite/shareover', invite.shareover); 158 router.get('/invite/shareover', invite.shareover);
150 router.get('/invite/over', invite.over); 159 router.get('/invite/over', invite.over);
@@ -153,9 +162,21 @@ router.get('/vip-day', vipDay.index); @@ -153,9 +162,21 @@ router.get('/vip-day', vipDay.index);
153 162
154 // 涉嫌博彩,要求下线 180129 163 // 涉嫌博彩,要求下线 180129
155 // router.get('/vip-day/crazy-wheel', vipDay.beforeIn, vipDay.crazyWheel); 164 // router.get('/vip-day/crazy-wheel', vipDay.beforeIn, vipDay.crazyWheel);
156 -router.post('/vip-day/crazy-wheel/award.json', vipDay.beforeIn, vipDay.wheelResult);  
157 -router.post('/vip-day/crazy-luck/award.json', vipDay.beforeIn, vipDay.luckResult);  
158 -router.get('/vip-day/crazy-luck/award-list.json', vipDay.beforeIn, vipDay.luckResultCollect); 165 +router.post(
  166 + '/vip-day/crazy-wheel/award.json',
  167 + vipDay.beforeIn,
  168 + vipDay.wheelResult,
  169 +);
  170 +router.post(
  171 + '/vip-day/crazy-luck/award.json',
  172 + vipDay.beforeIn,
  173 + vipDay.luckResult,
  174 +);
  175 +router.get(
  176 + '/vip-day/crazy-luck/award-list.json',
  177 + vipDay.beforeIn,
  178 + vipDay.luckResultCollect,
  179 +);
159 180
160 // 涉嫌博彩,要求下线 180129 181 // 涉嫌博彩,要求下线 180129
161 // router.get('/vip-day/crazy-luck', vipDay.beforeIn, vipDay.crazyLuck); 182 // router.get('/vip-day/crazy-luck', vipDay.beforeIn, vipDay.crazyLuck);
@@ -180,14 +201,30 @@ router.get('/vip-day1028', vipDay1028.index); @@ -180,14 +201,30 @@ router.get('/vip-day1028', vipDay1028.index);
180 201
181 // 涉嫌博彩,要求下线 180129 202 // 涉嫌博彩,要求下线 180129
182 // router.get('/vip-day1028/crazy-wheel', vipDay1028.beforeIn, vipDay1028.crazyWheel); 203 // router.get('/vip-day1028/crazy-wheel', vipDay1028.beforeIn, vipDay1028.crazyWheel);
183 -router.post('/vip-day1028/crazy-wheel/award.json', vipDay1028.beforeIn, vipDay1028.wheelResult);  
184 -router.post('/vip-day1028/crazy-luck/award.json', vipDay1028.beforeIn, vipDay1028.luckResult);  
185 -router.get('/vip-day1028/crazy-luck/award-list.json', vipDay1028.beforeIn, vipDay1028.luckResultCollect); 204 +router.post(
  205 + '/vip-day1028/crazy-wheel/award.json',
  206 + vipDay1028.beforeIn,
  207 + vipDay1028.wheelResult,
  208 +);
  209 +router.post(
  210 + '/vip-day1028/crazy-luck/award.json',
  211 + vipDay1028.beforeIn,
  212 + vipDay1028.luckResult,
  213 +);
  214 +router.get(
  215 + '/vip-day1028/crazy-luck/award-list.json',
  216 + vipDay1028.beforeIn,
  217 + vipDay1028.luckResultCollect,
  218 +);
186 219
187 // 涉嫌博彩,要求下线 180129 220 // 涉嫌博彩,要求下线 180129
188 // router.get('/vip-day1028/crazy-luck', vipDay1028.beforeIn, vipDay1028.crazyLuck); 221 // router.get('/vip-day1028/crazy-luck', vipDay1028.beforeIn, vipDay1028.crazyLuck);
189 router.post('/vip-day1028/signin.json', vipDay1028.beforeIn, vipDay1028.signin); 222 router.post('/vip-day1028/signin.json', vipDay1028.beforeIn, vipDay1028.signin);
190 -router.post('/vip-day1028/isStudent', vipDay1028.beforeIn, vipDay1028.checkIsStudent); 223 +router.post(
  224 + '/vip-day1028/isStudent',
  225 + vipDay1028.beforeIn,
  226 + vipDay1028.checkIsStudent,
  227 +);
191 228
192 // 阿里云广告 229 // 阿里云广告
193 router.get('/ali-cloud-bottom', aliCloud.aliCloudbo); 230 router.get('/ali-cloud-bottom', aliCloud.aliCloudbo);
@@ -327,14 +364,38 @@ router.get('/free-mail/list', auth, freeMail.freeMailList); // 免邮券列表 @@ -327,14 +364,38 @@ router.get('/free-mail/list', auth, freeMail.freeMailList); // 免邮券列表
327 router.get('/free-mail/verify', auth, freeMail.receiveVerify); // 免邮券领取验证 364 router.get('/free-mail/verify', auth, freeMail.receiveVerify); // 免邮券领取验证
328 router.get('/free-mail/verifyCoupon', auth, freeMail.receiveCoupon); // 免邮券领取 365 router.get('/free-mail/verifyCoupon', auth, freeMail.receiveCoupon); // 免邮券领取
329 366
330 -router.get('/store-home/photography', disableBFCache, storeHome.storeAuth, storeHome.photography); // 线下店个人中心-摄影  
331 -router.get('/store-home/coffee', disableBFCache, storeHome.storeAuth, storeHome.coffee); // 线下店个人中心-咖啡  
332 -router.get('/store-home/green', disableBFCache, storeHome.storeAuth, storeHome.green); // 线下店个人中心-绿植  
333 -router.get('/store-home/gallery', disableBFCache, storeHome.storeAuth, storeHome.gallery); // 线下店个人中心-画廊 367 +router.get(
  368 + '/store-home/photography',
  369 + disableBFCache,
  370 + storeHome.storeAuth,
  371 + storeHome.photography,
  372 +); // 线下店个人中心-摄影
  373 +router.get(
  374 + '/store-home/coffee',
  375 + disableBFCache,
  376 + storeHome.storeAuth,
  377 + storeHome.coffee,
  378 +); // 线下店个人中心-咖啡
  379 +router.get(
  380 + '/store-home/green',
  381 + disableBFCache,
  382 + storeHome.storeAuth,
  383 + storeHome.green,
  384 +); // 线下店个人中心-绿植
  385 +router.get(
  386 + '/store-home/gallery',
  387 + disableBFCache,
  388 + storeHome.storeAuth,
  389 + storeHome.gallery,
  390 +); // 线下店个人中心-画廊
334 router.get('/store-home/history', storeHome.storeAuth, storeHome.history); // 线下店个人中心-消费明细 391 router.get('/store-home/history', storeHome.storeAuth, storeHome.history); // 线下店个人中心-消费明细
335 router.get('/store-home/ewm', storeHome.storeAuth, storeHome.ewm); // 线下店个人中心-二维码 392 router.get('/store-home/ewm', storeHome.storeAuth, storeHome.ewm); // 线下店个人中心-二维码
336 router.get('/store-home/coupon', storeHome.storeAuth, storeHome.coupon); // 线下店个人中心-优惠券 393 router.get('/store-home/coupon', storeHome.storeAuth, storeHome.coupon); // 线下店个人中心-优惠券
337 -router.get('/store-home/moreHistory', storeHome.storeAuth, storeHome.moreHistory); // 线下店个人中心-更多记录 394 +router.get(
  395 + '/store-home/moreHistory',
  396 + storeHome.storeAuth,
  397 + storeHome.moreHistory,
  398 +); // 线下店个人中心-更多记录
338 router.get('/store-home/modify', storeHome.storeAuth, storeHome.modify); // 线下店个人中心-修改宝宝信息 399 router.get('/store-home/modify', storeHome.storeAuth, storeHome.modify); // 线下店个人中心-修改宝宝信息
339 400
340 router.get('/coupon-list', auth, couponList.index); // 优惠券领取页 401 router.get('/coupon-list', auth, couponList.index); // 优惠券领取页
@@ -375,12 +436,23 @@ function swtichYoLuck(newMiddleware, oldMiddleware) { @@ -375,12 +436,23 @@ function swtichYoLuck(newMiddleware, oldMiddleware) {
375 436
376 // yoluck 437 // yoluck
377 router.get('/yoluck/index.html', swtichYoLuck(yoluck.index, yoluckBack.index)); 438 router.get('/yoluck/index.html', swtichYoLuck(yoluck.index, yoluckBack.index));
378 -router.get('/yoluck/mylist.html', auth, swtichYoLuck(yoluck.index, yoluckBack.index)); 439 +router.get(
  440 + '/yoluck/mylist.html',
  441 + auth,
  442 + swtichYoLuck(yoluck.index, yoluckBack.index),
  443 +);
379 router.get('/yoluck/next', swtichYoLuck(yoluck.nextPage, yoluckBack.nextPage)); 444 router.get('/yoluck/next', swtichYoLuck(yoluck.nextPage, yoluckBack.nextPage));
380 445
381 router.get('/yoluck/:id.html', swtichYoLuck(yoluck.detail, yoluckBack.detail)); 446 router.get('/yoluck/:id.html', swtichYoLuck(yoluck.detail, yoluckBack.detail));
382 -router.post('/yoluck/:id.html', auth, swtichYoLuck(yoluck.getCode, yoluckBack.getCode));  
383 -router.post('/yoluck/detail/mylist.html', swtichYoLuck(yoluck.getActivityCodeList, yoluckBack.getActivityCodeList)); 447 +router.post(
  448 + '/yoluck/:id.html',
  449 + auth,
  450 + swtichYoLuck(yoluck.getCode, yoluckBack.getCode),
  451 +);
  452 +router.post(
  453 + '/yoluck/detail/mylist.html',
  454 + swtichYoLuck(yoluck.getActivityCodeList, yoluckBack.getActivityCodeList),
  455 +);
384 456
385 // 拼团 457 // 拼团
386 // router.get('/group', group.index); // 拼团首页 458 // router.get('/group', group.index); // 拼团首页
@@ -399,4 +471,7 @@ router.get('/group/delOrder', auth, group.delOrder); // 删除拼团订单 @@ -399,4 +471,7 @@ router.get('/group/delOrder', auth, group.delOrder); // 删除拼团订单
399 router.get('/group/cancelOrder', auth, group.cancelOrder); // 取消拼团订单 471 router.get('/group/cancelOrder', auth, group.cancelOrder); // 取消拼团订单
400 router.get('/group/loadOrder', auth, group.loadOrder); // 加载拼团列表 472 router.get('/group/loadOrder', auth, group.loadOrder); // 加载拼团列表
401 473
  474 +// 发现好货
  475 +router.get('/find/goods', FindGoods.index);
  476 +
402 module.exports = router; 477 module.exports = router;
  1 +<div class="find-goods-wrapper">
  2 + 发现好货
  3 + {{log content}}
  4 + {{#unless content.detailList}}
  5 + <div class="empty">
  6 + 暂无数据
  7 + </div>
  8 + {{else}}
  9 + {{#content.detailList}}
  10 + {{> find-goods/item-info}}
  11 + {{/content.detailList}}
  12 + {{/unless}}
  13 +</div>
  1 +<div class="item-wrapper">
  2 + <div class="author-info">
  3 + <img class="avatar-img" src="{{image2 authorHeadIco w=30 h=30}}" alt="" />
  4 + <span class="avatar-name">{{authorName}}</span>
  5 + </div>
  6 + <a class="item-info">
  7 + <img src="{{image2 findGood.productImage w=120 h=120}}" alt="" />
  8 + <div class="item-detail">
  9 + <div>
  10 + <div class="item-name">{{findGood.productName}}</div>
  11 + <div class="item-desc">{{content}}</div>
  12 + </div>
  13 + <div class="action-tip">
  14 + <span class="action-name">SHOP NOW</span>
  15 + <span class="action-icon"></span>
  16 + </div>
  17 + </div>
  18 + </a>
  19 +</div>
  1 +// const $ = require('yoho-jquery');
  2 +// const lazyLoad = require('js/plugin/lazyload');
  3 +
  4 +require('scss/activity/find-goods.page.scss');
  1 +.item-wrapper {
  2 + padding: 48px 30px 54px 30px;
  3 + border-bottom: 1px solid #e0e0e0;
  4 +
  5 + &:last-child {
  6 + border-bottom: 0;
  7 + }
  8 +
  9 + .author-info {
  10 + display: flex;
  11 + align-items: center;
  12 +
  13 + .avatar-img {
  14 + border-radius: 50%;
  15 + }
  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;
  23 + }
  24 + }
  25 +
  26 + .item-info {
  27 + display: flex;
  28 + margin-top: 30px;
  29 + max-height: 240px;
  30 + overflow: hidden;
  31 +
  32 + .item-detail {
  33 + display: flex;
  34 + flex-direction: column;
  35 + flex: 1;
  36 + margin-left: 38px;
  37 + justify-content: space-between;
  38 +
  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;
  48 + }
  49 +
  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;
  61 + }
  62 +
  63 + .action-tip {
  64 + font-size: 24px;
  65 + letter-spacing: 0.16px;
  66 + display: flex;
  67 + align-items: center;
  68 +
  69 + .action-icon {
  70 + display: inline-block;
  71 + width: 32px;
  72 + height: 32px;
  73 + background: url("img/activity/find-goods-more@3x.png");
  74 + background-repeat: no-repeat;
  75 + background-position: center;
  76 + background-size: cover;
  77 + }
  78 + }
  79 + }
  80 + }
  81 +}
1 module.exports = { 1 module.exports = {
2 context: './js', 2 context: './js',
3 - regx: ['activity/feature.page.js'] 3 + regx: ['activity/feature.page.js', 'activity/find-goods.page.js']
4 }; 4 };