Authored by ccbikai

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

... ... @@ -77,7 +77,7 @@ exports.special = (req, res) => {
pageHeadTab[1].cur = true;
res.render('star/special', _.assign({
page: 'star'
page: 'special'
}, processPublicData(req, '星潮教室'), {
resources: result,
headTab: pageHeadTab
... ...
... ... @@ -12,6 +12,7 @@ const API = require(`${library}/api`).API;
const sign = require(`${library}/sign`);
const logger = require(`${library}/logger`);
const camelCase = require(`${library}/camel-case`);
const helpers = require(`${library}/helpers`);
const _ = require('lodash');
const serviceAPI = new ServiceAPI();
const api = new API();
... ... @@ -86,7 +87,7 @@ const processIndexData = (list) => {
title: data.title,
articeTxt: data.intro,
src: data.src,
publishTime: data.publishTime,
publishTime: helpers.dateFormat('MM月DD日 hh:mm', data.publishTime),
viewsNum: data.viewsNum
}, avatar));
});
... ... @@ -104,6 +105,27 @@ const processIndexData = (list) => {
return formatData;
};
/**
* 明星专题列表数据处理
* @param {[array]} list
* @return {[array]}
*/
const processDetailData = (list) => {
const formatData = [];
list = list || [];
list = camelCase(list);
_.forEach(list, (data) => {
data.publishTime = helpers.dateFormat('MM月DD日 hh:mm', data.publishTime);
formatData.push(data);
});
return formatData;
};
/**
* 星搭配文章列表数据处理
*/
... ... @@ -156,7 +178,7 @@ exports.getDetailData = (params) => {
if (params.page > result.data.totalPage) {
return '';
} else {
return camelCase(result.data.list);
return processDetailData(result.data.list);
}
} else {
logger.error('明星专题文章数据返回 code 不是 200');
... ...
... ... @@ -13,8 +13,7 @@
<ul class="clearfix swiper-wrapper">
{{# starAvatar}}
<li class="swiper-slide">
<img class="swiper-lazy rank-avatar" data-url="{{url}}" data-src="{{image cover 180 180}}">
<div class="swiper-lazy-preloader"></div>
<img class="rank-avatar" data-url="{{url}}" src="{{image cover 180 180}}">
</li>
{{/ starAvatar}}
</ul>
... ...
/**
* 星专题
* @author: wsl<shuiling.wang@yoho.cn>
* @date: 2016/6/7
*/
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
lazyLoad($('img.lazy'));
... ...
... ... @@ -11,8 +11,9 @@ var $ = require('yoho-jquery'),
PullRefresh = require('../plugin/pull-refresh');
var $window = $(window),
$starArticle = $('.star-article'),
$headTab = $('.head-tab'),
$starArticle = $('.star-article');
bannerLen = $('.avatar-swiper .swiper-slide').length;
/*
$swiperView = $('.swiper-view'),
... ... @@ -40,10 +41,10 @@ $(function() {
starIScroll = new PullRefresh('.star-wrap', {
height: $(window).height() - $('#yoho-header').height() - $('.head-tab').height(),
pullDown: function() {
console.log('下拉了');
location.reload();
},
pullUp: function() {
console.log('上滑了');
$headTab.slideUp();
}
});
... ... @@ -155,7 +156,7 @@ function articleImgAction(dom, key) {
*/
// banner swiper 初始化
if ($('.banner-swiper .swiper-slide').length > 1) {
if (bannerLen > 1) {
new Swiper('.banner-swiper', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
... ... @@ -173,10 +174,9 @@ if ($('.banner-swiper .swiper-slide').length > 1) {
if ($('.avatar-swiper .swiper-slide').length > 1) {
avatarSwiper = new Swiper('.avatar-swiper', {
loop: true,
loopedSlides: bannerLen,
initialSlide: 3,
centeredSlides: true,
lazyLoading: true,
lazyLoadingInPrevNext: true,
slidesPerView: 'auto',
slidesOffsetBefore: '-' + $('.avatar-swiper').find('li').not('.swiper-slide-visible').width() / 2,
watchSlidesProgress: true,
... ...
... ... @@ -292,7 +292,7 @@
display: inline-block;
margin-right: 5px;
font-size: 22px;
vertical-align: text-top;
vertical-align: text-bottom;
}
}
... ...