Authored by biao

Merge branch 'release/4.6' of http://git.yoho.cn/fe/yohobuywap-node into release/4.6

... ... @@ -54,23 +54,15 @@ const processPublicData = (req, title) => {
* @param {[object]} res
* @return {[type]}
*/
exports.index = (req, res, next) => {
exports.index = (req, res) => {
const pageHeadTab = _.cloneDeep(headTab);
pageHeadTab[0].cur = true;
starModel.getIndexData().then((result) => {
res.render('star/index', _.assign({
page: 'star',
isStarIndexPage: true,
headTab: pageHeadTab,
content: {
focus: true,
data: result.ads
},
starAvatar: result.starAvatar,
articles: result.articles
}, processPublicData(req, '星潮教室')));
}).catch(next);
res.render('star/index', _.assign({
page: 'star',
isStarIndexPage: true,
headTab: pageHeadTab
}, processPublicData(req, '星潮教室')));
};
exports.getIndexHtml = (req, res, next) => {
... ... @@ -81,7 +73,7 @@ exports.getIndexHtml = (req, res, next) => {
focus: true,
data: result.ads
},
starAvatar: result.starAvatar,
starAvatar: result.starAvatar.concat(result.starAvatar).concat(result.starAvatar),
articles: result.articles
}));
}).catch(next);
... ...
... ... @@ -2,6 +2,5 @@
{{> star/head-tab}}
<div class="swiper-num"></div>
<div class="star-main">
{{> star/index-html}}
</div>
</div>
... ...
... ... @@ -26,8 +26,7 @@ var $window = $(window),
var mySwiper;
*/
var avatarKey, bannerLen, res, avatarSwiper, avatarSwiperClone, getIndexHtml;
var $avatarClone, $avatar, $starArticle, $starMain;
var avatarKey, bannerLen, res, avatarSwiper, avatarSwiperClone, getIndexHtml, $avatarClone, $avatar, $starArticle;
require('../common');
... ... @@ -93,30 +92,6 @@ function setIndexAction() {
$avatarWrap = $('.avatar-wrap:not(.avatar-clone)'),
avatarHeight = $('.avatar').height();
$starMain = $('.star-main');
$avatar = $('.avatar');
$starArticle = $('.star-article');
bannerLen = $avatar.find('.swiper-slide').length;
if ($avatarClone) {
$avatarClone.remove();
}
$('.avatar li').each(function() {
setAvatar($(this).find('span'));
});
$starMain.before($('.avatar-swiper').clone().addClass('avatar-clone').hide());
$avatarClone = $('.avatar-clone');
// 限制标题字数
$('.cont-area').each(function() {
txtLimit($(this), '.title', '.cont-txt');
});
lazyLoad($('img.lazy'));
// 下拉刷新,上拉加载
starIScroll = new PullRefresh('.star-wrap', {
height: $(window).height() - commonHeaderTop - avatarHeight,
... ... @@ -252,10 +227,11 @@ function setIndexAction() {
});
}
setIndexAction();
// 首页数据请求
getIndexHtml = function() {
var $starMain = $('.star-main');
loading.showLoadingMask();
$.ajax({
url: '/guang/star/getIndexHtml',
... ... @@ -265,15 +241,38 @@ getIndexHtml = function() {
if (!data) {
stopLoading = true;
loading.hideLoadingMask();
tip.show('没有更多内容了');
} else {
setTimeout(function() {
setIndexAction();
loading.hideLoadingMask();
}, 100);
}
$starMain.html(data);
$avatar = $('.avatar');
$starArticle = $('.star-article');
bannerLen = $avatar.find('.swiper-slide').length;
if ($avatarClone) {
$avatarClone.remove();
}
$('.avatar li').each(function() {
setAvatar($(this).find('span'));
});
$starMain.before($('.avatar-swiper').clone().addClass('avatar-clone').hide());
$avatarClone = $('.avatar-clone');
// 限制标题字数
$('.cont-area').each(function() {
txtLimit($(this), '.title', '.cont-txt');
});
lazyLoad($('img.lazy'));
setTimeout(function() {
setIndexAction();
loading.hideLoadingMask();
}, 100);
},
error: function() {
tip.show('网络断开连接了~');
... ... @@ -281,6 +280,8 @@ getIndexHtml = function() {
});
};
getIndexHtml();
// 明星动态文章图片相关操作
/*
function articleImgAction(dom, key) {
... ...