Showing
6 changed files
with
44 additions
and
12 deletions
@@ -75,7 +75,7 @@ exports.special = (req, res) => { | @@ -75,7 +75,7 @@ exports.special = (req, res) => { | ||
75 | 75 | ||
76 | pageHeadTab[1].cur = true; | 76 | pageHeadTab[1].cur = true; |
77 | res.render('star/special', _.assign({ | 77 | res.render('star/special', _.assign({ |
78 | - page: 'star' | 78 | + page: 'special' |
79 | }, processPublicData(req, '星潮教室'), { | 79 | }, processPublicData(req, '星潮教室'), { |
80 | resources: result, | 80 | resources: result, |
81 | headTab: pageHeadTab | 81 | 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,7 +11,9 @@ var $ = require('yoho-jquery'), | @@ -11,7 +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 | + $starArticle = $('.star-article'), |
15 | + $headTab = $('.head-tab'), | ||
16 | + bannerLen = $('.avatar-swiper .swiper-slide').length; | ||
15 | 17 | ||
16 | /* | 18 | /* |
17 | $swiperView = $('.swiper-view'), | 19 | $swiperView = $('.swiper-view'), |
@@ -39,10 +41,10 @@ $(function() { | @@ -39,10 +41,10 @@ $(function() { | ||
39 | starIScroll = new PullRefresh('.star-wrap', { | 41 | starIScroll = new PullRefresh('.star-wrap', { |
40 | height: $(window).height() - $('#yoho-header').height() - $('.head-tab').height(), | 42 | height: $(window).height() - $('#yoho-header').height() - $('.head-tab').height(), |
41 | pullDown: function() { | 43 | pullDown: function() { |
42 | - console.log('下拉了'); | 44 | + location.reload(); |
43 | }, | 45 | }, |
44 | pullUp: function() { | 46 | pullUp: function() { |
45 | - console.log('上滑了'); | 47 | + $headTab.slideUp(); |
46 | } | 48 | } |
47 | }); | 49 | }); |
48 | 50 | ||
@@ -134,7 +136,7 @@ function articleImgAction(dom, key) { | @@ -134,7 +136,7 @@ function articleImgAction(dom, key) { | ||
134 | */ | 136 | */ |
135 | 137 | ||
136 | // banner swiper 初始化 | 138 | // banner swiper 初始化 |
137 | -if ($('.banner-swiper .swiper-slide').length > 1) { | 139 | +if (bannerLen > 1) { |
138 | new Swiper('.banner-swiper', { | 140 | new Swiper('.banner-swiper', { |
139 | lazyLoading: true, | 141 | lazyLoading: true, |
140 | lazyLoadingInPrevNext: true, | 142 | lazyLoadingInPrevNext: true, |
@@ -152,10 +154,9 @@ if ($('.banner-swiper .swiper-slide').length > 1) { | @@ -152,10 +154,9 @@ if ($('.banner-swiper .swiper-slide').length > 1) { | ||
152 | if ($('.avatar-swiper .swiper-slide').length > 1) { | 154 | if ($('.avatar-swiper .swiper-slide').length > 1) { |
153 | avatarSwiper = new Swiper('.avatar-swiper', { | 155 | avatarSwiper = new Swiper('.avatar-swiper', { |
154 | loop: true, | 156 | loop: true, |
157 | + loopedSlides: bannerLen, | ||
155 | initialSlide: 3, | 158 | initialSlide: 3, |
156 | centeredSlides: true, | 159 | centeredSlides: true, |
157 | - lazyLoading: true, | ||
158 | - lazyLoadingInPrevNext: true, | ||
159 | slidesPerView: 'auto', | 160 | slidesPerView: 'auto', |
160 | slidesOffsetBefore: '-' + $('.avatar-swiper').find('li').not('.swiper-slide-visible').width() / 2, | 161 | slidesOffsetBefore: '-' + $('.avatar-swiper').find('li').not('.swiper-slide-visible').width() / 2, |
161 | watchSlidesProgress: true, | 162 | watchSlidesProgress: true, |
-
Please register or login to post a comment