Authored by 王水玲

star

@@ -60,7 +60,33 @@ exports.index = (req, res) => { @@ -60,7 +60,33 @@ exports.index = (req, res) => {
60 curHeadTab(0); 60 curHeadTab(0);
61 res.render('star/index', _.assign(renderData, { 61 res.render('star/index', _.assign(renderData, {
62 content: result, 62 content: result,
63 - headTab: headTab 63 + headTab: headTab,
  64 + starAvatar: [
  65 + {
  66 + url: '',
  67 + src: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/07/16/0142677eb1abf7bf7b233524f604d71fd6.png?imageView/2/w/{width}/h/{height}'
  68 + },
  69 + {
  70 + url: '',
  71 + src: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/07/16/0142677eb1abf7bf7b233524f604d71fd6.png?imageView/2/w/{width}/h/{height}'
  72 + },
  73 + {
  74 + url: '',
  75 + src: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/07/16/0142677eb1abf7bf7b233524f604d71fd6.png?imageView/2/w/{width}/h/{height}'
  76 + },
  77 + {
  78 + url: '',
  79 + src: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/07/16/0142677eb1abf7bf7b233524f604d71fd6.png?imageView/2/w/{width}/h/{height}'
  80 + },
  81 + {
  82 + url: '',
  83 + src: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/07/16/0142677eb1abf7bf7b233524f604d71fd6.png?imageView/2/w/{width}/h/{height}'
  84 + },
  85 + {
  86 + url: '',
  87 + src: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/07/16/0142677eb1abf7bf7b233524f604d71fd6.png?imageView/2/w/{width}/h/{height}'
  88 + }
  89 + ]
64 })); 90 }));
65 }); 91 });
66 }; 92 };
@@ -10,6 +10,8 @@ const resourcesProcess = require(`${utils}/resources-process`); @@ -10,6 +10,8 @@ const resourcesProcess = require(`${utils}/resources-process`);
10 const ServiceAPI = require(`${library}/api`).ServiceAPI; 10 const ServiceAPI = require(`${library}/api`).ServiceAPI;
11 const sign = require(`${library}/sign`); 11 const sign = require(`${library}/sign`);
12 const logger = require(`${library}/logger`); 12 const logger = require(`${library}/logger`);
  13 +const camelCase = require(`${library}/camel-case`);
  14 +const _ = require('lodash');
13 const serviceAPI = new ServiceAPI(); 15 const serviceAPI = new ServiceAPI();
14 16
15 /** 17 /**
@@ -36,6 +38,27 @@ const getResources = (page) => { @@ -36,6 +38,27 @@ const getResources = (page) => {
36 }; 38 };
37 39
38 /** 40 /**
  41 + * 星搭配文章列表数据处理
  42 + */
  43 +const processCollocationData = (list) => {
  44 + const formatData = [];
  45 +
  46 + list = list || [];
  47 + list = camelCase(list);
  48 +
  49 + _.forEach(list, (data) => {
  50 + if (data.isFavor === 'N') {
  51 + data.isCollected = false;
  52 + } else {
  53 + data.isCollected = true;
  54 + }
  55 + formatData.push(data);
  56 + });
  57 +
  58 + return formatData;
  59 +}
  60 +
  61 +/**
39 * 星潮首页 62 * 星潮首页
40 */ 63 */
41 exports.getIndexData = () => { 64 exports.getIndexData = () => {
@@ -59,12 +82,10 @@ exports.getCollocationListData = (params, uid) => { @@ -59,12 +82,10 @@ exports.getCollocationListData = (params, uid) => {
59 uid: uid 82 uid: uid
60 }, params))).then((result) => { 83 }, params))).then((result) => {
61 if (result && result.code === 200) { 84 if (result && result.code === 200) {
62 - return result; 85 + return processCollocationData(result.data.list.artList);
63 } else { 86 } else {
64 logger.error('获取星搭配文章列表返回 code 不是 200'); 87 logger.error('获取星搭配文章列表返回 code 不是 200');
65 return []; 88 return [];
66 } 89 }
67 }); 90 });
68 }; 91 };
69 -  
70 -// guang/api/v5/article/getStarClassroomArticleList  
1 {{#each collocationList}} 1 {{#each collocationList}}
2 - <li articleId="{{articleId}}" data-bp-id="guang_collocationList_{{title}}_false" class="buriedpoint"> 2 +{{log this}}
  3 + <li articleId="{{id}}" data-bp-id="guang_collocationList_{{title}}_false" class="buriedpoint">
3 4
4 - {{#if img}}  
5 - <a href="{{url}}"><img class="lazy" src ="" data-original="{{img}}" /></a> 5 + {{#if src}}
  6 + <a href="{{url}}"><img class="lazy" src ="" data-original="{{image src 640 310}}" /></a>
6 {{/if}} 7 {{/if}}
7 8
8 <div class="cont-area "> 9 <div class="cont-area ">
9 <a href="{{url}}"><h2 class="title">{{title}}</h2></a> 10 <a href="{{url}}"><h2 class="title">{{title}}</h2></a>
10 - <p class="cont-txt">{{content}}</p> 11 + <p class="cont-txt">{{intro}}</p>
11 <div class="count-area"> 12 <div class="count-area">
12 - <span class="time"><i class="iconfont time-ico">&#xe603;</i>{{time}}</span>  
13 - <span class="see"><i class="iconfont see-ico">&#xe602;</i>{{seeNum}}</span> 13 + <span class="time"><i class="iconfont time-ico">&#xe603;</i>{{publishTime}}</span>
  14 + <span class="see"><i class="iconfont see-ico">&#xe602;</i>{{viewsNum}}</span>
14 <span class="collection"><i class="iconfont collected-ico {{#isCollected}} collected {{/isCollected}}">&#xe605;</i></span> 15 <span class="collection"><i class="iconfont collected-ico {{#isCollected}} collected {{/isCollected}}">&#xe605;</i></span>
15 16
16 - {{# share}} 17 + {{# share.url}}
17 <a href="{{this}}" class="iconfont forward">&#xe600;</a> 18 <a href="{{this}}" class="iconfont forward">&#xe600;</a>
18 - {{/ share}} 19 + {{/ share.url}}
19 20
20 </div> 21 </div>
21 </div> 22 </div>
@@ -7,4 +7,19 @@ @@ -7,4 +7,19 @@
7 {{> resources/banner-top}} 7 {{> resources/banner-top}}
8 {{/if}} 8 {{/if}}
9 {{/content}} 9 {{/content}}
  10 +
  11 + <div class="star-avatar">
  12 + <div class="avatar-swiper swiper-container">
  13 + <ul class="swiper-wrapper">
  14 + {{#each starAvatar}}
  15 + <li class="swiper-slide">
  16 + <a href="{{url}}">
  17 + <img class="swiper-lazy" data-src="{{image src 180 180}}">
  18 + </a>
  19 + <div class="swiper-lazy-preloader"></div>
  20 + </li>
  21 + {{/each}}
  22 + </ul>
  23 + </div>
  24 + </div>
10 </div> 25 </div>
@@ -183,7 +183,7 @@ exports.search = (req, res) => { @@ -183,7 +183,7 @@ exports.search = (req, res) => {
183 let params = Object.assign({}, req.query); 183 let params = Object.assign({}, req.query);
184 184
185 // uid = 9239279 185 // uid = 9239279
186 - let uid = req.user.uid || 0; 186 + let uid = 9239279 || req.user.uid || 0;
187 187
188 saleModel.getSearchData(params, uid).then((result) => { 188 saleModel.getSearchData(params, uid).then((result) => {
189 let vipLevel = result[1].curLevel; 189 let vipLevel = result[1].curLevel;
@@ -193,10 +193,7 @@ exports.search = (req, res) => { @@ -193,10 +193,7 @@ exports.search = (req, res) => {
193 vipObj = Object.assign({ 193 vipObj = Object.assign({
194 saleVip: (req.query.saleType === '2' && (!uid || vipLevel === '1')), 194 saleVip: (req.query.saleType === '2' && (!uid || vipLevel === '1')),
195 vipLevel: vipLevel, 195 vipLevel: vipLevel,
196 - saleViplogin: vipLevel >= 1 ? true : false,  
197 - vipPrice1: vipLevel === '1',  
198 - vipPrice2: vipLevel === '2',  
199 - vipPrice3: vipLevel === '3' 196 + saleViplogin: vipLevel >= 1 ? true : false
200 }, vipObj); 197 }, vipObj);
201 } 198 }
202 199
@@ -35,9 +35,9 @@ @@ -35,9 +35,9 @@
35 {{#if @root.saleViplogin}} 35 {{#if @root.saleViplogin}}
36 <i class="vip-grade vip-grade-{{@root.vipLevel}}"></i> 36 <i class="vip-grade vip-grade-{{@root.vipLevel}}"></i>
37 <span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥ 37 <span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥
38 - {{#if @root.vipPrice1}}{{vip1Price}}{{/if}}  
39 - {{#if @root.vipPrice2}}{{vip2Price}}{{/if}}  
40 - {{#if @root.vipPrice3}}{{vip3Price}}{{/if}} 38 + {{#ifEqualTo @root.vipLevel '1'}}{{vip1Price}}{{/ifEquelTo}}
  39 + {{#ifEquelTo @root.vipLevel '2'}}{{vip2Price}}{{/ifEquelTo}}
  40 + {{#ifEquelTo @root.vipLevel '3'}}{{vip3Price}}{{/ifEquelTo}}
41 </span> 41 </span>
42 {{else}} 42 {{else}}
43 <span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥{{salesPrice}}</span> 43 <span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥{{salesPrice}}</span>
@@ -10,8 +10,8 @@ var $ = require('yoho-jquery'), @@ -10,8 +10,8 @@ var $ = require('yoho-jquery'),
10 10
11 lazyLoad($('img.lazy')); 11 lazyLoad($('img.lazy'));
12 12
13 -if ($('.swiper-container .swiper-slide').length > 1) {  
14 - new Swiper('.swiper-container', { 13 +if ($('.banner-swiper .swiper-slide').length > 1) {
  14 + new Swiper('.banner-swiper', {
15 lazyLoading: true, 15 lazyLoading: true,
16 lazyLoadingInPrevNext: true, 16 lazyLoadingInPrevNext: true,
17 loop: true, 17 loop: true,
@@ -23,3 +23,13 @@ if ($('.swiper-container .swiper-slide').length > 1) { @@ -23,3 +23,13 @@ if ($('.swiper-container .swiper-slide').length > 1) {
23 }); 23 });
24 } 24 }
25 25
  26 +if ($('.avatar-swiper .swiper-slide').length > 1) {
  27 + new Swiper('.avatar-swiper', {
  28 + lazyLoading: true,
  29 + lazyLoadingInPrevNext: true,
  30 + grabCursor: true,
  31 + slidesPerView: 'auto',
  32 + slideElement: 'li',
  33 + watchSlidesVisibility: true
  34 + });
  35 +}
@@ -101,5 +101,19 @@ @@ -101,5 +101,19 @@
101 } 101 }
102 } 102 }
103 } 103 }
  104 +
  105 + .star-avatar {
  106 + margin-top: 30px;
  107 +
  108 + li {
  109 + float: left;
  110 + margin-left: 20px;
  111 + width: auto;
  112 +
  113 + img {
  114 + border-radius: 4px;
  115 + }
  116 + }
  117 + }
104 } 118 }
105 119