Showing
11 changed files
with
113 additions
and
52 deletions
@@ -13,7 +13,7 @@ const starModel = require(`${mRoot}/star`); | @@ -13,7 +13,7 @@ const starModel = require(`${mRoot}/star`); | ||
13 | const headTab = [ | 13 | const headTab = [ |
14 | { | 14 | { |
15 | cur: false, | 15 | cur: false, |
16 | - url: '/guang/star/index', | 16 | + url: '/guang/star', |
17 | name: '全部' | 17 | name: '全部' |
18 | }, | 18 | }, |
19 | { | 19 | { |
@@ -277,8 +277,17 @@ exports.collocationList = (req, res) => { | @@ -277,8 +277,17 @@ exports.collocationList = (req, res) => { | ||
277 | res.render('star/collocation-list', _.assign({ | 277 | res.render('star/collocation-list', _.assign({ |
278 | layout: false, | 278 | layout: false, |
279 | params: params, | 279 | params: params, |
280 | - collocationList: result | 280 | + list: result |
281 | })); | 281 | })); |
282 | }); | 282 | }); |
283 | +}; | ||
283 | 284 | ||
285 | +/** | ||
286 | + * 明星文章专区 | ||
287 | + * @param {[object]} req | ||
288 | + * @param {[object]} res | ||
289 | + * @return {[type]} | ||
290 | + */ | ||
291 | +exports.detail = (req, res) => { | ||
292 | + res.render('star/detail'); | ||
284 | }; | 293 | }; |
@@ -13,6 +13,7 @@ const star = require(cRoot + '/star'); | @@ -13,6 +13,7 @@ const star = require(cRoot + '/star'); | ||
13 | const router = express.Router(); // eslint-disable-line | 13 | const router = express.Router(); // eslint-disable-line |
14 | 14 | ||
15 | router.get('/star', star.index); // 星潮教室首页 | 15 | router.get('/star', star.index); // 星潮教室首页 |
16 | +router.get('/star/detail', star.detail); // 明星文章专区 | ||
16 | router.get('/star/special', star.special); // 星潮教室星专题 | 17 | router.get('/star/special', star.special); // 星潮教室星专题 |
17 | router.get('/star/collocation', star.collocation); // 星潮教室星搭配 | 18 | router.get('/star/collocation', star.collocation); // 星潮教室星搭配 |
18 | router.get('/star/collocation/list', star.collocationList); // 星潮教室星搭配文章请求 | 19 | router.get('/star/collocation/list', star.collocationList); // 星潮教室星搭配文章请求 |
1 | -{{#each collocationList}} | ||
2 | -{{log this}} | ||
3 | - <li articleId="{{id}}" data-bp-id="guang_collocationList_{{title}}_false" class="buriedpoint"> | ||
4 | - | ||
5 | - {{#if src}} | ||
6 | - <a href="{{url}}"><img class="lazy" src ="" data-original="{{image src 640 310}}" /></a> | ||
7 | - {{/if}} | ||
8 | - | ||
9 | - <div class="cont-area "> | ||
10 | - <a href="{{url}}"><h2 class="title">{{title}}</h2></a> | ||
11 | - <p class="cont-txt">{{intro}}</p> | ||
12 | - <div class="count-area"> | ||
13 | - <span class="time"><i class="iconfont time-ico"></i>{{publishTime}}</span> | ||
14 | - <span class="see"><i class="iconfont see-ico"></i>{{viewsNum}}</span> | ||
15 | - <span class="collection"><i class="iconfont collected-ico {{#isCollected}} collected {{/isCollected}}"></i></span> | ||
16 | - | ||
17 | - {{# share.url}} | ||
18 | - <a href="{{this}}" class="iconfont forward"></a> | ||
19 | - {{/ share.url}} | ||
20 | - | ||
21 | - </div> | ||
22 | - </div> | ||
23 | - </li> | ||
24 | -{{/each}} | ||
1 | +{{> star/list}} |
apps/guang/views/action/star/detail.hbs
0 → 100644
@@ -28,16 +28,14 @@ | @@ -28,16 +28,14 @@ | ||
28 | </div> | 28 | </div> |
29 | <div class="star-article"> | 29 | <div class="star-article"> |
30 | <i class="article-arrow"></i> | 30 | <i class="article-arrow"></i> |
31 | - <h2 class="article-title">{{title}}</h2> | 31 | + <a href="{{url}}"><h2 class="article-title">{{title}}</h2></a> |
32 | <div class="artice-cont"> | 32 | <div class="artice-cont"> |
33 | - <a href="{{url}}"> | ||
34 | - <p>{{articeTxt}}</p> | ||
35 | - <ul class="artice-imgs"> | ||
36 | - {{#each articeImg}} | ||
37 | - <li><img src="{{image . 130 130}}" /></li> | ||
38 | - {{/each}} | ||
39 | - </ul> | ||
40 | - </a> | 33 | + <a href="{{url}}"><p>{{articeTxt}}</p></a> |
34 | + <ul class="artice-imgs"> | ||
35 | + {{#each articeImg}} | ||
36 | + <li><img src="{{image . 130 130}}" /></li> | ||
37 | + {{/each}} | ||
38 | + </ul> | ||
41 | </div> | 39 | </div> |
42 | <div class="artice-o"> | 40 | <div class="artice-o"> |
43 | <span class="time"><i class="iconfont time-ico"></i>{{publishTime}}</span> | 41 | <span class="time"><i class="iconfont time-ico"></i>{{publishTime}}</span> |
apps/guang/views/partial/star/list.hbs
0 → 100644
1 | +{{#each list}} | ||
2 | + <li articleId="{{id}}" data-bp-id="guang_collocationList_{{title}}_false" class="buriedpoint"> | ||
3 | + | ||
4 | + {{#if src}} | ||
5 | + <a href="{{url}}"><img class="lazy" src ="" data-original="{{image src 640 310}}" /></a> | ||
6 | + {{/if}} | ||
7 | + | ||
8 | + <div class="cont-area "> | ||
9 | + <a href="{{url}}"><h2 class="title">{{title}}</h2></a> | ||
10 | + <p class="cont-txt">{{intro}}</p> | ||
11 | + <div class="count-area"> | ||
12 | + <span class="time"><i class="iconfont time-ico"></i>{{publishTime}}</span> | ||
13 | + <span class="see"><i class="iconfont see-ico"></i>{{viewsNum}}</span> | ||
14 | + <span class="collection"><i class="iconfont collected-ico {{#isCollected}} collected {{/isCollected}}"></i></span> | ||
15 | + | ||
16 | + {{# share.url}} | ||
17 | + <a href="{{this}}" class="iconfont forward"></a> | ||
18 | + {{/ share.url}} | ||
19 | + | ||
20 | + </div> | ||
21 | + </div> | ||
22 | + </li> | ||
23 | +{{/each}} |
public/img/guang/star/img.png
0 → 100644

1.05 KB
public/img/sprite.guang.png
0 → 100644

225 Bytes
@@ -9,11 +9,38 @@ var $ = require('yoho-jquery'), | @@ -9,11 +9,38 @@ var $ = require('yoho-jquery'), | ||
9 | lazyLoad = require('yoho-jquery-lazyload'), | 9 | lazyLoad = require('yoho-jquery-lazyload'), |
10 | ellipsis = require('yoho-mlellipsis'); | 10 | ellipsis = require('yoho-mlellipsis'); |
11 | 11 | ||
12 | -var avatarSwiper, avatarKey, $this, $title, $cont; | 12 | +var $starArticle = $('.star-article'); |
13 | + | ||
14 | +var avatarSwiper, avatarKey; | ||
13 | 15 | ||
14 | lazyLoad($('img.lazy')); | 16 | lazyLoad($('img.lazy')); |
15 | ellipsis.init(); | 17 | ellipsis.init(); |
16 | 18 | ||
19 | +// 限制标题字数 | ||
20 | +function txtLimit(dom) { | ||
21 | + var $title = dom.find('.article-title'), | ||
22 | + $cont = dom.find('p'); | ||
23 | + | ||
24 | + $title[0].mlellipsis(2); | ||
25 | + $cont[0].mlellipsis(3); | ||
26 | +} | ||
27 | + | ||
28 | +// 明星动态文章图片相关操作 | ||
29 | +function articleImgAction(dom) { | ||
30 | + var $articeImgs = dom.find('.artice-imgs'), | ||
31 | + $li = $articeImgs.find('li'), | ||
32 | + imgLen = $articeImgs.find('img').length, | ||
33 | + addFlagDom = $li.eq(2); | ||
34 | + | ||
35 | + $li.on('click', function() { | ||
36 | + console.log('1'); | ||
37 | + }); | ||
38 | + | ||
39 | + if (imgLen > 3 && addFlagDom.find('.img-size').length < 1) { | ||
40 | + addFlagDom.append('<div class="img-size"><i class="pic-icon"></i>' + imgLen + '</div>'); | ||
41 | + } | ||
42 | +} | ||
43 | + | ||
17 | if ($('.banner-swiper .swiper-slide').length > 1) { | 44 | if ($('.banner-swiper .swiper-slide').length > 1) { |
18 | new Swiper('.banner-swiper', { | 45 | new Swiper('.banner-swiper', { |
19 | lazyLoading: true, | 46 | lazyLoading: true, |
@@ -41,26 +68,22 @@ if ($('.avatar-swiper .swiper-slide').length > 1) { | @@ -41,26 +68,22 @@ if ($('.avatar-swiper .swiper-slide').length > 1) { | ||
41 | }); | 68 | }); |
42 | } | 69 | } |
43 | 70 | ||
44 | - | ||
45 | if ($('.star-info').find('li').length > 0) { | 71 | if ($('.star-info').find('li').length > 0) { |
46 | - // 限制标题字数 | ||
47 | - $('.star-article').each(function() { | ||
48 | - $this = $(this); | ||
49 | - $title = $this.find('.article-title'); | ||
50 | - $cont = $this.find('p'); | ||
51 | - | ||
52 | - $title[0].mlellipsis(2); | ||
53 | - $cont[0].mlellipsis(3); | 72 | + $starArticle.each(function(key, item) { |
73 | + txtLimit($(item)); | ||
74 | + articleImgAction($(item)); | ||
54 | }); | 75 | }); |
55 | } | 76 | } |
56 | 77 | ||
57 | $('body').addClass('star-index-bg'); | 78 | $('body').addClass('star-index-bg'); |
58 | 79 | ||
59 | -$('.avatar-swiper li').not('.swiper-slide-active').on('click', function() { | ||
60 | - avatarKey = $(this).index(); | ||
61 | - avatarSwiper.slideTo(avatarKey, 1000, false); | ||
62 | -}); | ||
63 | 80 | ||
64 | -$('.swiper-slide-active').on('click', function() { | ||
65 | - location.href = $(this).find('img').data('url'); | 81 | +// 明星头像点击居中显示或跳转 |
82 | +$('.avatar-swiper li').on('click', function() { | ||
83 | + if ($(this).hasClass('swiper-slide-active')) { | ||
84 | + location.href = $(this).find('img').data('url'); | ||
85 | + } else { | ||
86 | + avatarKey = $(this).index(); | ||
87 | + avatarSwiper.slideTo(avatarKey, 1000, false); | ||
88 | + } | ||
66 | }); | 89 | }); |
@@ -214,6 +214,7 @@ | @@ -214,6 +214,7 @@ | ||
214 | li { | 214 | li { |
215 | float: left; | 215 | float: left; |
216 | margin-left: 6px; | 216 | margin-left: 6px; |
217 | + position: relative; | ||
217 | } | 218 | } |
218 | 219 | ||
219 | li:first { | 220 | li:first { |
@@ -225,6 +226,29 @@ | @@ -225,6 +226,29 @@ | ||
225 | height: 130px; | 226 | height: 130px; |
226 | border-radius: 4px; | 227 | border-radius: 4px; |
227 | } | 228 | } |
229 | + | ||
230 | + .img-size { | ||
231 | + width: 50px; | ||
232 | + height: 26px; | ||
233 | + line-height: 28px; | ||
234 | + border-radius: 13px; | ||
235 | + background-color: rgba(0, 0, 0, 0.4); | ||
236 | + color: #fff; | ||
237 | + position: absolute; | ||
238 | + right: 10px; | ||
239 | + bottom: 10px; | ||
240 | + font-size: 18px; | ||
241 | + } | ||
242 | + | ||
243 | + .pic-icon { | ||
244 | + width: 19px; | ||
245 | + height: 15px; | ||
246 | + background: url('/guang/star/img.png') no-repeat; | ||
247 | + background-size: contain; | ||
248 | + display: inline-block; | ||
249 | + margin: 6px 4px 0 8px; | ||
250 | + vertical-align: top; | ||
251 | + } | ||
228 | } | 252 | } |
229 | 253 | ||
230 | .artice-o { | 254 | .artice-o { |
-
Please register or login to post a comment