Authored by 王水玲

star

... ... @@ -60,7 +60,33 @@ exports.index = (req, res) => {
curHeadTab(0);
res.render('star/index', _.assign(renderData, {
content: result,
headTab: headTab
headTab: headTab,
starAvatar: [
{
url: '',
src: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/07/16/0142677eb1abf7bf7b233524f604d71fd6.png?imageView/2/w/{width}/h/{height}'
},
{
url: '',
src: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/07/16/0142677eb1abf7bf7b233524f604d71fd6.png?imageView/2/w/{width}/h/{height}'
},
{
url: '',
src: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/07/16/0142677eb1abf7bf7b233524f604d71fd6.png?imageView/2/w/{width}/h/{height}'
},
{
url: '',
src: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/07/16/0142677eb1abf7bf7b233524f604d71fd6.png?imageView/2/w/{width}/h/{height}'
},
{
url: '',
src: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/07/16/0142677eb1abf7bf7b233524f604d71fd6.png?imageView/2/w/{width}/h/{height}'
},
{
url: '',
src: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/07/16/0142677eb1abf7bf7b233524f604d71fd6.png?imageView/2/w/{width}/h/{height}'
}
]
}));
});
};
... ...
... ... @@ -10,6 +10,8 @@ const resourcesProcess = require(`${utils}/resources-process`);
const ServiceAPI = require(`${library}/api`).ServiceAPI;
const sign = require(`${library}/sign`);
const logger = require(`${library}/logger`);
const camelCase = require(`${library}/camel-case`);
const _ = require('lodash');
const serviceAPI = new ServiceAPI();
/**
... ... @@ -36,6 +38,27 @@ const getResources = (page) => {
};
/**
* 星搭配文章列表数据处理
*/
const processCollocationData = (list) => {
const formatData = [];
list = list || [];
list = camelCase(list);
_.forEach(list, (data) => {
if (data.isFavor === 'N') {
data.isCollected = false;
} else {
data.isCollected = true;
}
formatData.push(data);
});
return formatData;
}
/**
* 星潮首页
*/
exports.getIndexData = () => {
... ... @@ -59,12 +82,10 @@ exports.getCollocationListData = (params, uid) => {
uid: uid
}, params))).then((result) => {
if (result && result.code === 200) {
return result;
return processCollocationData(result.data.list.artList);
} else {
logger.error('获取星搭配文章列表返回 code 不是 200');
return [];
}
});
};
// guang/api/v5/article/getStarClassroomArticleList
... ...
{{#each collocationList}}
<li articleId="{{articleId}}" data-bp-id="guang_collocationList_{{title}}_false" class="buriedpoint">
{{log this}}
<li articleId="{{id}}" data-bp-id="guang_collocationList_{{title}}_false" class="buriedpoint">
{{#if img}}
<a href="{{url}}"><img class="lazy" src ="" data-original="{{img}}" /></a>
{{#if src}}
<a href="{{url}}"><img class="lazy" src ="" data-original="{{image src 640 310}}" /></a>
{{/if}}
<div class="cont-area ">
<a href="{{url}}"><h2 class="title">{{title}}</h2></a>
<p class="cont-txt">{{content}}</p>
<p class="cont-txt">{{intro}}</p>
<div class="count-area">
<span class="time"><i class="iconfont time-ico">&#xe603;</i>{{time}}</span>
<span class="see"><i class="iconfont see-ico">&#xe602;</i>{{seeNum}}</span>
<span class="time"><i class="iconfont time-ico">&#xe603;</i>{{publishTime}}</span>
<span class="see"><i class="iconfont see-ico">&#xe602;</i>{{viewsNum}}</span>
<span class="collection"><i class="iconfont collected-ico {{#isCollected}} collected {{/isCollected}}">&#xe605;</i></span>
{{# share}}
{{# share.url}}
<a href="{{this}}" class="iconfont forward">&#xe600;</a>
{{/ share}}
{{/ share.url}}
</div>
</div>
... ...
... ... @@ -7,4 +7,19 @@
{{> resources/banner-top}}
{{/if}}
{{/content}}
<div class="star-avatar">
<div class="avatar-swiper swiper-container">
<ul class="swiper-wrapper">
{{#each starAvatar}}
<li class="swiper-slide">
<a href="{{url}}">
<img class="swiper-lazy" data-src="{{image src 180 180}}">
</a>
<div class="swiper-lazy-preloader"></div>
</li>
{{/each}}
</ul>
</div>
</div>
</div>
... ...
... ... @@ -183,7 +183,7 @@ exports.search = (req, res) => {
let params = Object.assign({}, req.query);
// uid = 9239279
let uid = req.user.uid || 0;
let uid = 9239279 || req.user.uid || 0;
saleModel.getSearchData(params, uid).then((result) => {
let vipLevel = result[1].curLevel;
... ... @@ -193,10 +193,7 @@ exports.search = (req, res) => {
vipObj = Object.assign({
saleVip: (req.query.saleType === '2' && (!uid || vipLevel === '1')),
vipLevel: vipLevel,
saleViplogin: vipLevel >= 1 ? true : false,
vipPrice1: vipLevel === '1',
vipPrice2: vipLevel === '2',
vipPrice3: vipLevel === '3'
saleViplogin: vipLevel >= 1 ? true : false
}, vipObj);
}
... ...
... ... @@ -35,9 +35,9 @@
{{#if @root.saleViplogin}}
<i class="vip-grade vip-grade-{{@root.vipLevel}}"></i>
<span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥
{{#if @root.vipPrice1}}{{vip1Price}}{{/if}}
{{#if @root.vipPrice2}}{{vip2Price}}{{/if}}
{{#if @root.vipPrice3}}{{vip3Price}}{{/if}}
{{#ifEqualTo @root.vipLevel '1'}}{{vip1Price}}{{/ifEquelTo}}
{{#ifEquelTo @root.vipLevel '2'}}{{vip2Price}}{{/ifEquelTo}}
{{#ifEquelTo @root.vipLevel '3'}}{{vip3Price}}{{/ifEquelTo}}
</span>
{{else}}
<span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥{{salesPrice}}</span>
... ...
... ... @@ -10,8 +10,8 @@ var $ = require('yoho-jquery'),
lazyLoad($('img.lazy'));
if ($('.swiper-container .swiper-slide').length > 1) {
new Swiper('.swiper-container', {
if ($('.banner-swiper .swiper-slide').length > 1) {
new Swiper('.banner-swiper', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
loop: true,
... ... @@ -23,3 +23,13 @@ if ($('.swiper-container .swiper-slide').length > 1) {
});
}
if ($('.avatar-swiper .swiper-slide').length > 1) {
new Swiper('.avatar-swiper', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
grabCursor: true,
slidesPerView: 'auto',
slideElement: 'li',
watchSlidesVisibility: true
});
}
\ No newline at end of file
... ...
... ... @@ -101,5 +101,19 @@
}
}
}
.star-avatar {
margin-top: 30px;
li {
float: left;
margin-left: 20px;
width: auto;
img {
border-radius: 4px;
}
}
}
}
... ...