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) => { @@ -54,23 +54,15 @@ const processPublicData = (req, title) => {
54 * @param {[object]} res 54 * @param {[object]} res
55 * @return {[type]} 55 * @return {[type]}
56 */ 56 */
57 -exports.index = (req, res, next) => { 57 +exports.index = (req, res) => {
58 const pageHeadTab = _.cloneDeep(headTab); 58 const pageHeadTab = _.cloneDeep(headTab);
59 59
60 pageHeadTab[0].cur = true; 60 pageHeadTab[0].cur = true;
61 - starModel.getIndexData().then((result) => {  
62 - res.render('star/index', _.assign({  
63 - page: 'star',  
64 - isStarIndexPage: true,  
65 - headTab: pageHeadTab,  
66 - content: {  
67 - focus: true,  
68 - data: result.ads  
69 - },  
70 - starAvatar: result.starAvatar,  
71 - articles: result.articles  
72 - }, processPublicData(req, '星潮教室')));  
73 - }).catch(next); 61 + res.render('star/index', _.assign({
  62 + page: 'star',
  63 + isStarIndexPage: true,
  64 + headTab: pageHeadTab
  65 + }, processPublicData(req, '星潮教室')));
74 }; 66 };
75 67
76 exports.getIndexHtml = (req, res, next) => { 68 exports.getIndexHtml = (req, res, next) => {
@@ -81,7 +73,7 @@ exports.getIndexHtml = (req, res, next) => { @@ -81,7 +73,7 @@ exports.getIndexHtml = (req, res, next) => {
81 focus: true, 73 focus: true,
82 data: result.ads 74 data: result.ads
83 }, 75 },
84 - starAvatar: result.starAvatar, 76 + starAvatar: result.starAvatar.concat(result.starAvatar).concat(result.starAvatar),
85 articles: result.articles 77 articles: result.articles
86 })); 78 }));
87 }).catch(next); 79 }).catch(next);
@@ -2,6 +2,5 @@ @@ -2,6 +2,5 @@
2 {{> star/head-tab}} 2 {{> star/head-tab}}
3 <div class="swiper-num"></div> 3 <div class="swiper-num"></div>
4 <div class="star-main"> 4 <div class="star-main">
5 - {{> star/index-html}}  
6 </div> 5 </div>
7 </div> 6 </div>
@@ -26,8 +26,7 @@ var $window = $(window), @@ -26,8 +26,7 @@ var $window = $(window),
26 var mySwiper; 26 var mySwiper;
27 */ 27 */
28 28
29 -var avatarKey, bannerLen, res, avatarSwiper, avatarSwiperClone, getIndexHtml;  
30 -var $avatarClone, $avatar, $starArticle, $starMain; 29 +var avatarKey, bannerLen, res, avatarSwiper, avatarSwiperClone, getIndexHtml, $avatarClone, $avatar, $starArticle;
31 30
32 require('../common'); 31 require('../common');
33 32
@@ -93,30 +92,6 @@ function setIndexAction() { @@ -93,30 +92,6 @@ function setIndexAction() {
93 $avatarWrap = $('.avatar-wrap:not(.avatar-clone)'), 92 $avatarWrap = $('.avatar-wrap:not(.avatar-clone)'),
94 avatarHeight = $('.avatar').height(); 93 avatarHeight = $('.avatar').height();
95 94
96 - $starMain = $('.star-main');  
97 - $avatar = $('.avatar');  
98 - $starArticle = $('.star-article');  
99 - bannerLen = $avatar.find('.swiper-slide').length;  
100 -  
101 - if ($avatarClone) {  
102 - $avatarClone.remove();  
103 - }  
104 -  
105 - $('.avatar li').each(function() {  
106 - setAvatar($(this).find('span'));  
107 - });  
108 -  
109 - $starMain.before($('.avatar-swiper').clone().addClass('avatar-clone').hide());  
110 -  
111 - $avatarClone = $('.avatar-clone');  
112 -  
113 - // 限制标题字数  
114 - $('.cont-area').each(function() {  
115 - txtLimit($(this), '.title', '.cont-txt');  
116 - });  
117 -  
118 - lazyLoad($('img.lazy'));  
119 -  
120 // 下拉刷新,上拉加载 95 // 下拉刷新,上拉加载
121 starIScroll = new PullRefresh('.star-wrap', { 96 starIScroll = new PullRefresh('.star-wrap', {
122 height: $(window).height() - commonHeaderTop - avatarHeight, 97 height: $(window).height() - commonHeaderTop - avatarHeight,
@@ -252,10 +227,11 @@ function setIndexAction() { @@ -252,10 +227,11 @@ function setIndexAction() {
252 }); 227 });
253 } 228 }
254 229
255 -setIndexAction();  
256 230
257 // 首页数据请求 231 // 首页数据请求
258 getIndexHtml = function() { 232 getIndexHtml = function() {
  233 + var $starMain = $('.star-main');
  234 +
259 loading.showLoadingMask(); 235 loading.showLoadingMask();
260 $.ajax({ 236 $.ajax({
261 url: '/guang/star/getIndexHtml', 237 url: '/guang/star/getIndexHtml',
@@ -265,15 +241,38 @@ getIndexHtml = function() { @@ -265,15 +241,38 @@ getIndexHtml = function() {
265 241
266 if (!data) { 242 if (!data) {
267 stopLoading = true; 243 stopLoading = true;
268 - loading.hideLoadingMask();  
269 tip.show('没有更多内容了'); 244 tip.show('没有更多内容了');
270 - } else {  
271 - setTimeout(function() {  
272 - setIndexAction();  
273 - loading.hideLoadingMask();  
274 - }, 100);  
275 } 245 }
276 246
  247 + $starMain.html(data);
  248 + $avatar = $('.avatar');
  249 + $starArticle = $('.star-article');
  250 + bannerLen = $avatar.find('.swiper-slide').length;
  251 +
  252 + if ($avatarClone) {
  253 + $avatarClone.remove();
  254 + }
  255 +
  256 + $('.avatar li').each(function() {
  257 + setAvatar($(this).find('span'));
  258 + });
  259 +
  260 + $starMain.before($('.avatar-swiper').clone().addClass('avatar-clone').hide());
  261 +
  262 + $avatarClone = $('.avatar-clone');
  263 +
  264 + // 限制标题字数
  265 + $('.cont-area').each(function() {
  266 + txtLimit($(this), '.title', '.cont-txt');
  267 + });
  268 +
  269 + lazyLoad($('img.lazy'));
  270 +
  271 + setTimeout(function() {
  272 + setIndexAction();
  273 + loading.hideLoadingMask();
  274 + }, 100);
  275 +
277 }, 276 },
278 error: function() { 277 error: function() {
279 tip.show('网络断开连接了~'); 278 tip.show('网络断开连接了~');
@@ -281,6 +280,8 @@ getIndexHtml = function() { @@ -281,6 +280,8 @@ getIndexHtml = function() {
281 }); 280 });
282 }; 281 };
283 282
  283 +getIndexHtml();
  284 +
284 // 明星动态文章图片相关操作 285 // 明星动态文章图片相关操作
285 /* 286 /*
286 function articleImgAction(dom, key) { 287 function articleImgAction(dom, key) {