Merge branch 'feature/star' of git.yoho.cn:fe/yohobuywap-node into feature/star
Showing
6 changed files
with
43 additions
and
12 deletions
@@ -77,7 +77,7 @@ exports.special = (req, res) => { | @@ -77,7 +77,7 @@ exports.special = (req, res) => { | ||
77 | 77 | ||
78 | pageHeadTab[1].cur = true; | 78 | pageHeadTab[1].cur = true; |
79 | res.render('star/special', _.assign({ | 79 | res.render('star/special', _.assign({ |
80 | - page: 'star' | 80 | + page: 'special' |
81 | }, processPublicData(req, '星潮教室'), { | 81 | }, processPublicData(req, '星潮教室'), { |
82 | resources: result, | 82 | resources: result, |
83 | headTab: pageHeadTab | 83 | headTab: pageHeadTab |
@@ -12,6 +12,7 @@ const API = require(`${library}/api`).API; | @@ -12,6 +12,7 @@ const API = require(`${library}/api`).API; | ||
12 | const sign = require(`${library}/sign`); | 12 | const sign = require(`${library}/sign`); |
13 | const logger = require(`${library}/logger`); | 13 | const logger = require(`${library}/logger`); |
14 | const camelCase = require(`${library}/camel-case`); | 14 | const camelCase = require(`${library}/camel-case`); |
15 | +const helpers = require(`${library}/helpers`); | ||
15 | const _ = require('lodash'); | 16 | const _ = require('lodash'); |
16 | const serviceAPI = new ServiceAPI(); | 17 | const serviceAPI = new ServiceAPI(); |
17 | const api = new API(); | 18 | const api = new API(); |
@@ -86,7 +87,7 @@ const processIndexData = (list) => { | @@ -86,7 +87,7 @@ const processIndexData = (list) => { | ||
86 | title: data.title, | 87 | title: data.title, |
87 | articeTxt: data.intro, | 88 | articeTxt: data.intro, |
88 | src: data.src, | 89 | src: data.src, |
89 | - publishTime: data.publishTime, | 90 | + publishTime: helpers.dateFormat('MM月DD日 hh:mm', data.publishTime), |
90 | viewsNum: data.viewsNum | 91 | viewsNum: data.viewsNum |
91 | }, avatar)); | 92 | }, avatar)); |
92 | }); | 93 | }); |
@@ -104,6 +105,27 @@ const processIndexData = (list) => { | @@ -104,6 +105,27 @@ const processIndexData = (list) => { | ||
104 | return formatData; | 105 | return formatData; |
105 | }; | 106 | }; |
106 | 107 | ||
108 | + | ||
109 | +/** | ||
110 | + * 明星专题列表数据处理 | ||
111 | + * @param {[array]} list | ||
112 | + * @return {[array]} | ||
113 | + */ | ||
114 | +const processDetailData = (list) => { | ||
115 | + const formatData = []; | ||
116 | + | ||
117 | + list = list || []; | ||
118 | + list = camelCase(list); | ||
119 | + | ||
120 | + _.forEach(list, (data) => { | ||
121 | + data.publishTime = helpers.dateFormat('MM月DD日 hh:mm', data.publishTime); | ||
122 | + formatData.push(data); | ||
123 | + }); | ||
124 | + | ||
125 | + return formatData; | ||
126 | +}; | ||
127 | + | ||
128 | + | ||
107 | /** | 129 | /** |
108 | * 星搭配文章列表数据处理 | 130 | * 星搭配文章列表数据处理 |
109 | */ | 131 | */ |
@@ -156,7 +178,7 @@ exports.getDetailData = (params) => { | @@ -156,7 +178,7 @@ exports.getDetailData = (params) => { | ||
156 | if (params.page > result.data.totalPage) { | 178 | if (params.page > result.data.totalPage) { |
157 | return ''; | 179 | return ''; |
158 | } else { | 180 | } else { |
159 | - return camelCase(result.data.list); | 181 | + return processDetailData(result.data.list); |
160 | } | 182 | } |
161 | } else { | 183 | } else { |
162 | logger.error('明星专题文章数据返回 code 不是 200'); | 184 | logger.error('明星专题文章数据返回 code 不是 200'); |
@@ -13,8 +13,7 @@ | @@ -13,8 +13,7 @@ | ||
13 | <ul class="clearfix swiper-wrapper"> | 13 | <ul class="clearfix swiper-wrapper"> |
14 | {{# starAvatar}} | 14 | {{# starAvatar}} |
15 | <li class="swiper-slide"> | 15 | <li class="swiper-slide"> |
16 | - <img class="swiper-lazy rank-avatar" data-url="{{url}}" data-src="{{image cover 180 180}}"> | ||
17 | - <div class="swiper-lazy-preloader"></div> | 16 | + <img class="rank-avatar" data-url="{{url}}" src="{{image cover 180 180}}"> |
18 | </li> | 17 | </li> |
19 | {{/ starAvatar}} | 18 | {{/ starAvatar}} |
20 | </ul> | 19 | </ul> |
public/js/guang/special.page.js
0 → 100644
@@ -11,8 +11,9 @@ var $ = require('yoho-jquery'), | @@ -11,8 +11,9 @@ var $ = require('yoho-jquery'), | ||
11 | PullRefresh = require('../plugin/pull-refresh'); | 11 | PullRefresh = require('../plugin/pull-refresh'); |
12 | 12 | ||
13 | var $window = $(window), | 13 | var $window = $(window), |
14 | + $starArticle = $('.star-article'), | ||
14 | $headTab = $('.head-tab'), | 15 | $headTab = $('.head-tab'), |
15 | - $starArticle = $('.star-article'); | 16 | + bannerLen = $('.avatar-swiper .swiper-slide').length; |
16 | 17 | ||
17 | /* | 18 | /* |
18 | $swiperView = $('.swiper-view'), | 19 | $swiperView = $('.swiper-view'), |
@@ -40,10 +41,10 @@ $(function() { | @@ -40,10 +41,10 @@ $(function() { | ||
40 | starIScroll = new PullRefresh('.star-wrap', { | 41 | starIScroll = new PullRefresh('.star-wrap', { |
41 | height: $(window).height() - $('#yoho-header').height() - $('.head-tab').height(), | 42 | height: $(window).height() - $('#yoho-header').height() - $('.head-tab').height(), |
42 | pullDown: function() { | 43 | pullDown: function() { |
43 | - console.log('下拉了'); | 44 | + location.reload(); |
44 | }, | 45 | }, |
45 | pullUp: function() { | 46 | pullUp: function() { |
46 | - console.log('上滑了'); | 47 | + $headTab.slideUp(); |
47 | } | 48 | } |
48 | }); | 49 | }); |
49 | 50 | ||
@@ -155,7 +156,7 @@ function articleImgAction(dom, key) { | @@ -155,7 +156,7 @@ function articleImgAction(dom, key) { | ||
155 | */ | 156 | */ |
156 | 157 | ||
157 | // banner swiper 初始化 | 158 | // banner swiper 初始化 |
158 | -if ($('.banner-swiper .swiper-slide').length > 1) { | 159 | +if (bannerLen > 1) { |
159 | new Swiper('.banner-swiper', { | 160 | new Swiper('.banner-swiper', { |
160 | lazyLoading: true, | 161 | lazyLoading: true, |
161 | lazyLoadingInPrevNext: true, | 162 | lazyLoadingInPrevNext: true, |
@@ -173,10 +174,9 @@ if ($('.banner-swiper .swiper-slide').length > 1) { | @@ -173,10 +174,9 @@ if ($('.banner-swiper .swiper-slide').length > 1) { | ||
173 | if ($('.avatar-swiper .swiper-slide').length > 1) { | 174 | if ($('.avatar-swiper .swiper-slide').length > 1) { |
174 | avatarSwiper = new Swiper('.avatar-swiper', { | 175 | avatarSwiper = new Swiper('.avatar-swiper', { |
175 | loop: true, | 176 | loop: true, |
177 | + loopedSlides: bannerLen, | ||
176 | initialSlide: 3, | 178 | initialSlide: 3, |
177 | centeredSlides: true, | 179 | centeredSlides: true, |
178 | - lazyLoading: true, | ||
179 | - lazyLoadingInPrevNext: true, | ||
180 | slidesPerView: 'auto', | 180 | slidesPerView: 'auto', |
181 | slidesOffsetBefore: '-' + $('.avatar-swiper').find('li').not('.swiper-slide-visible').width() / 2, | 181 | slidesOffsetBefore: '-' + $('.avatar-swiper').find('li').not('.swiper-slide-visible').width() / 2, |
182 | watchSlidesProgress: true, | 182 | watchSlidesProgress: true, |
-
Please register or login to post a comment