Authored by 毕凯

Merge branch 'gray' of git.yoho.cn:fe/yohobuywap-node into gray

... ... @@ -3,6 +3,31 @@
const headerModel = require('../../../doraemon/models/header');
const storeHomeModel = require('../models/store-home');
const helpers = global.yoho.helpers;
exports.storeAuth = (req, res, next) => {
if (!req.user.uid) {
let route = req.route.path;
let from = '';
if (route.indexOf('coffee') > 0) {
from = 'yohocoffee';
} else if (route.indexOf('green') > 0) {
from = 'yohogreen';
} else if (route.indexOf('photography') > 0) {
from = 'yoholittle';
} else {
from = 'yohobuy';
}
return res.redirect(helpers.urlFormat('/signin.html', {
refer: req.originalUrl,
from: from
}));
}
next();
};
exports.photography = (req, res, next) => {
let responseData = {
... ...
... ... @@ -286,14 +286,14 @@ router.get('/free-mail/list', auth, freeMail.freeMailList); // 免邮券列表
router.get('/free-mail/verify', auth, freeMail.receiveVerify); // 免邮券领取验证
router.get('/free-mail/verifyCoupon', auth, freeMail.receiveCoupon); // 免邮券领取
router.get('/store-home/photography', auth, storeHome.photography); // 线下店个人中心-摄影
router.get('/store-home/coffee', auth, storeHome.coffee); // 线下店个人中心-咖啡
router.get('/store-home/green', auth, storeHome.green); // 线下店个人中心-绿植
router.get('/store-home/history', auth, storeHome.history); // 线下店个人中心-消费明细
router.get('/store-home/ewm', auth, storeHome.ewm); // 线下店个人中心-二维码
router.get('/store-home/coupon', auth, storeHome.coupon); // 线下店个人中心-优惠卷
router.get('/store-home/moreHistory', auth, storeHome.moreHistory); // 线下店个人中心-更多记录
router.get('/store-home/modify', auth, storeHome.modify); // 线下店个人中心-修改宝宝信息
router.get('/store-home/photography', storeHome.storeAuth, storeHome.photography); // 线下店个人中心-摄影
router.get('/store-home/coffee', storeHome.storeAuth, storeHome.coffee); // 线下店个人中心-咖啡
router.get('/store-home/green', storeHome.storeAuth, storeHome.green); // 线下店个人中心-绿植
router.get('/store-home/history', storeHome.storeAuth, storeHome.history); // 线下店个人中心-消费明细
router.get('/store-home/ewm', storeHome.storeAuth, storeHome.ewm); // 线下店个人中心-二维码
router.get('/store-home/coupon', storeHome.storeAuth, storeHome.coupon); // 线下店个人中心-优惠卷
router.get('/store-home/moreHistory', storeHome.storeAuth, storeHome.moreHistory); // 线下店个人中心-更多记录
router.get('/store-home/modify', storeHome.storeAuth, storeHome.modify); // 线下店个人中心-修改宝宝信息
router.get('/coupon-list', auth, couponList.index); // 优惠券领取页
router.get('/coupon-list/receive', couponList.receive); // 个人优惠券领取
... ...
... ... @@ -25,6 +25,7 @@ exports.index = (req, res, next) => {
}),
module: 'news',
localCss: true,
pageFooter: true,
page: 'index'
}, result));
}).catch(next);
... ... @@ -54,7 +55,11 @@ exports.detail = (req, res, next) => {
}),
module: 'news',
localCss: true,
page: 'detail'
pageFooter: true,
page: 'detail',
cononical: {
currentHref: `//www.yohobuy.com${req.originalUrl}`
}
}, result));
}).catch(next);
};
... ...
<div class="news-info" data-id="{{id}}">
{{# author}}
<a class="info-author clearfix"{{#if url}} href="{{url}}"{{/if}}>
<img class="lazy avatar" data-original="{{image2 avatar mode=2 q=60}}">
<img class="lazy avatar" data-original="http:{{image2 avatar mode=2 q=60}}">
<span class="name">{{name}}</span>
{{#if minCategory}}
<span class="min-tag">#{{minCategory}}</span>
... ... @@ -48,9 +48,9 @@
{{/if}}
<a class="img-box"{{#unless isShow}} href="{{url}}"{{/unless}}>
{{#if @first}}
<img src="{{image2 img q=60}}" alt="{{alt}}">
<img src="http:{{image2 img q=60}}" alt="{{alt}}">
{{^}}
<img class="lazy" data-original="{{image2 img q=60}}" alt="{{alt}}">
<img class="lazy" data-original="http:{{image2 img q=60}}" alt="{{alt}}">
{{/if}}
{{#if isVideo}}
<div class="play"></div>
... ... @@ -60,9 +60,9 @@
<div class="info-deps">
<a class="info-title-container"{{#unless isShow}} href="{{url}}"{{/unless}}>
<div class="info-title">{{#if top}}<span class="top-tag">置顶</span>{{/if}}{{title}}</div>
<div class="info-title ellipsis-line">{{#if top}}<span class="top-tag">置顶</span>{{/if}}{{title}}</div>
</a>
<p class="info-text">{{text}}</p>
<p class="info-text ellipsis-line">{{text}}</p>
{{> news-index/tvls}}
</div>
... ...
... ... @@ -94,9 +94,12 @@ exports.qaDetail = (req, res, next) => {
return res.send(`
<html>
<head>
<title>${_.get(detailApi, 'data.helpdetail_list[0].caption')}</title>
<meta charset="utf-8">
<title>${req.query.keyword || _.get(detailApi, 'data.helpdetail_list[0].caption')}</title>
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
</head>
<body>
<body style="margin: 15px;">
${_.get(detailApi, 'data.helpdetail_list[0].content')}
</body>
</html>
... ...
This diff could not be displayed because it is too large.
... ... @@ -15,7 +15,6 @@ export class IndexView extends View {
}
init() {
let that = this;
let $loadMoreInfo = $('#load-more-info');
ellipsis.init();
... ... @@ -35,10 +34,8 @@ export class IndexView extends View {
}];
// srcoll to load more
$(document).scroll(function() {
window.requestAnimationFrame(function() {
that.scrollHandler.apply(that, []);
});
$(document).scroll(() => {
window.requestAnimationFrame(this.scrollHandler.bind(this));
});
this.setLazyLoadAndMellipsis(this.selector.$infoList.children('.info-list').not('.hide').find('.news-info'));
... ... @@ -56,7 +53,7 @@ export class IndexView extends View {
let that = this;
if (that.selector.searching || that.navState[index].end) {
return;
return false;
}
that.selector.searching = true;
... ... @@ -81,26 +78,18 @@ export class IndexView extends View {
let $dataHtml = $(rdata);
$container.append($dataHtml);
that.setLazyLoadAndMellipsis($dataHtml.siblings('.news-info'));
that.setLazyLoadAndMellipsis($container.find('.news-info:not(.lazy-ms)'));
that.navState[index].page++;
that.selector.searching = false;
}).catch(() => {
that.selector.searching = false;
});
}
setLazyLoadAndMellipsis($infos) {
$infos.addClass('lazy-ms');
lazyLoad($infos.find('img.lazy'));
$infos.each(function() {
let $this = $(this),
$title = $this.find('.info-title'),
$text = $this.find('.info-text');
$title[0].mlellipsis(2);
$text[0].mlellipsis(2);
});
}
}
... ...
... ... @@ -120,6 +120,14 @@
margin: 32px 0 0;
padding: 0 40px 0 30px;
.ellipsis-line {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.info-title-container {
text-decoration: none;
color: #000;
... ... @@ -146,6 +154,7 @@
line-height: 46px;
font-size: 14PX;
color: #444;
-webkit-line-clamp: 4;
}
.time-view-like-share {
... ...