Authored by htoooth

add front end

... ... @@ -10,6 +10,8 @@ const index = (req, res, next)=>{
indexService.index(uid, udid, channel, isStudent).then((result) => {
return res.render('index', {
module: 'home',
page: 'index',
meIndexPage: true,
me: result
});
... ...
... ... @@ -4,7 +4,7 @@ const api = global.yoho.API;
const pendingOrderCount = (uid) => {
return api.get('', {
method: 'web.SpaceOrders.pendingOrderCount',
method: 'web.SpaceOrders.getPendingOrderCount',
uid: uid
});
};
... ...
... ... @@ -25,7 +25,7 @@ const _channelNum = channel => CHANNEL_NUM[channel] || CHANNEL_NUM.boys;
const _handleBrand = (brands, needNum) => {
const handle = Fn.pipe(Fn.filter({is_hot: 'Y'}), Fn.take(needNum), Fn.map((brand) => ({
href: helpers.urlFormat(null, null, brand.brand_domain),
logo: helpers.getForceSourceUrl(brand.brand_ico),
logo: brand.brand_ico,
name: brand.brand_name
})));
... ... @@ -74,8 +74,8 @@ const _msgNumber = co(function * (uid, udid) {
});
result[0].count = _.get(reqData, 'pending.data.count', 0);
result[1].count = _.get(reqData, 'unread.data.count', 0);
result[2].count = _.get(reqData, 'needComment.data.count', 0);
result[1].count = _.get(reqData, 'unread.data.inbox_total', 0);
result[2].count = _.get(reqData, 'needComment.data', 0);
return result;
});
... ... @@ -88,7 +88,7 @@ const _recentOrder = co(function * (uid) {
return {
more: helpers.urlFormat('/home/orders'),
orders: latestOrder
orders: latestOrder.list
};
});
... ... @@ -150,19 +150,15 @@ const index = co(function * (uid, udid, channel, isStudent) {
certifiedName: isStudent ? '学生身份已验证' : '身份验证',
certifiedUrl: helpers.urlFormat('/product/students/'),
cancelReason: reqData.reason,
content: [
{
message: reqData.msgNumber
content: {
messages: reqData.msgNumber,
latestOrders: reqData.recentOrder,
favBrand: {
more: '/brands',
brands: reqData.guessBrand
},
{
latestOrders: reqData.recentOrder,
favBrand: {
more: '/brands',
brands: reqData.guessBrand
},
newArrival: reqData.newProduct
}
],
newArrival: reqData.newProduct
},
recommend: reqData.recommendProduct,
banner: reqData.footerBanner,
helpUsUrl: ''
... ...
... ... @@ -16,7 +16,7 @@
{{#if certifiedName}}
<a href="{{certifiedUrl}}" target="_blank">{{certifiedName}}</a>
{{/if}}
<span id="close-message" class="close iconfont">&#xe602;</span>
<span id="close-message" class="close iconfont">&#xe60d;</span>
</p>
{{/if}}
... ... @@ -56,10 +56,10 @@
<h2 class="title">
<p class="na-pager-wrap">
<span class="na-pager pre no-visible">
<i class="iconfont">&#xe622;</i>
<i class="iconfont">&#xe618;</i>
</span>
<span class="na-pager next">
<i class="iconfont">&#xe621;</i>
<i class="iconfont">&#xe619;</i>
</span>
</p>
</h2>
... ... @@ -88,10 +88,10 @@
<h2 class="title">
<p class="na-pager-wrap">
<span class="rc-pager pre no-visible">
<i class="iconfont">&#xe622;</i>
<i class="iconfont">&#xe618;</i>
</span>
<span class="rc-pager next">
<i class="iconfont">&#xe621;</i>
<i class="iconfont">&#xe619;</i>
</span>
</p>
</h2>
... ...
... ... @@ -5,63 +5,166 @@
*/
var $ = require('yoho-jquery');
var yas = require('../common/data-yas');
var RECID = (new Date().getTime() + '_PC_YOHOBUY_' +
Math.floor(Math.random() * 1000000 + 1000000) +
'_' + Math.floor(Math.random() * 1000000 + 1000000));
require('./orders/order-block');
require('../common');
// 关闭消息提示
//关闭消息提示
$('#close-message').click(function() {
$('.message-tip').slideUp(200);
});
// 新品上架
/**
*
* @param self 点击的控件
* @param $ul 列表父
* @param page 总共页数
* @param itemWith 子元素宽
* @param curPage 当前页码
* @param num 一页商品数量
*/
function pageChange(self, $ul, page, itemWith, curPage, num) {
var $this = self,
left;
if ($this.hasClass('next')) {
//第2页显示前翻按钮
if (curPage === 2) {
$this.siblings().removeClass('no-visible');
}
//最后一页隐藏后翻按钮
if (curPage === page) {
$this.addClass('no-visible');
}
} else {
//倒数第2页显示后翻按钮
if (curPage === page - 1) {
$this.siblings().removeClass('no-visible');
}
//第1页隐藏前翻按钮
if (curPage === 1) {
$this.addClass('no-visible');
}
}
left = -num * (curPage - 1) * itemWith;
$ul.animate({
marginLeft: left
}, 400);
}
//新品上架
(function() {
var $naPager = $('.na-pager'),
$rcPager = $('.rc-pager'),
$naUl = $('.new-arrival ul'),
$rcUl = $('.recommend ul'),
naPage = Math.ceil($naUl.children('li').length / 5),
rcPage = Math.ceil($rcUl.children('li').length / 6),
naItemWith = $naUl.children('li:last-child').outerWidth(),
naCurPage = 1;
rcItemWith = $rcUl.children('li:last-child').outerWidth(),
naCurPage = 1,
rcCurPage = 1,
PRDID = [];
$naUl.width($naUl.width() * naPage);
$rcUl.width($rcUl.width() * rcPage);
// 最新上架翻页
//最新上架翻页
$naPager.click(function() {
var $this = $(this),
left;
var $this = $(this);
if ($this.hasClass('next')) {
if (naPage > 1) {
if ($this.hasClass('next')) {
++naCurPage;
} else {
--naCurPage;
}
pageChange($this, $naUl, naPage, naItemWith, naCurPage, 5);
}
});
// 后翻
++naCurPage;
//为你推荐翻页
$rcPager.click(function() {
var $this = $(this);
// 第2页显示前翻按钮
if (naCurPage === 2) {
$this.siblings().removeClass('no-visible');
if (rcPage > 1) {
if ($this.hasClass('next')) {
++rcCurPage;
} else {
--rcCurPage;
}
// 最后一页隐藏后翻按钮
if (naCurPage === naPage) {
$this.addClass('no-visible');
}
} else {
PRDID = [];
$rcUl.find('li').each(function(index) {
if (PRDID.length >= 6) {
return false;
}
if (index >= (rcCurPage - 1) * 6) {
PRDID.push($(this).find('a').data('id'));
}
});
// 前翻
--naCurPage;
yas.givePoint('YB_CHOOSE_FOR_YOU_Y', {
REC_POSE: 120004,
PRD_ID: PRDID.join(','),
PRD_NUM: PRDID.length,
ACTION_ID: 0,
page_num: rcCurPage,
REC_ID: RECID
});
// 倒数第2页显示后翻按钮
if (naCurPage === naPage - 1) {
$this.siblings().removeClass('no-visible');
pageChange($this, $rcUl, rcPage, rcItemWith, rcCurPage, 6);
}
});
//为您优选埋点 start
setTimeout(function() {
PRDID = [];
$rcUl.find('li').each(function(index) {
if (PRDID.length >= 6) {
return false;
}
// 第1页隐藏前翻按钮
if (naCurPage === 1) {
$this.addClass('no-visible');
if (index >= 0) {
PRDID.push($(this).find('a').data('id'));
}
}
});
left = -5 * (naCurPage - 1) * naItemWith;
yas.givePoint('YB_CHOOSE_FOR_YOU_Y', {
REC_POSE: 120004,
PRD_ID: PRDID.join(','),
PRD_NUM: PRDID.length,
ACTION_ID: 0,
page_num: 1,
REC_ID: RECID
});
}, 3000);
$naUl.animate({
marginLeft: left
}, 400);
$rcUl.find('li a').bind('click', function() {
var index = $(this).closest('li').index() + 1;
yas.givePoint('YB_CHOOSE_FOR_YOU_Y', {
REC_POSE: 120004,
PRD_ID: $(this).data('id'),
PRD_NUM: index % 6 === 0 ? 6 : index % 6,
ACTION_ID: 1,
page_num: rcCurPage,
REC_ID: RECID
});
return true;
});
//为您优选埋点 end
}());
... ...
... ... @@ -42,7 +42,7 @@
color: #fdfdfd;
text-align: center;
border-radius: 2px;
background: resolve(img/home/btn-more.png) no-repeat;
background: resolve(home/btn-more.png) no-repeat;
}
.brands ul {
... ... @@ -81,7 +81,7 @@
}
}
.new-arrival {
.new-arrival,.recommend {
overflow: hidden;
.na-pager-wrap {
... ... @@ -141,24 +141,53 @@
.price {
color: #000;
}
p {
height: 28px;
overflow: hidden;
}
}
}
.recommend {
margin-bottom: 10px;
ul {
width: 990px;
}
li {
width: 106px;
}
}
.ho-btm{
float: right;
width: 800px;
}
.banner {
display: block;
width: 800px;
border: none;
}
.latest-orders .title {
background-image: resolve(img/home/latest-orders.png);
background-image: resolve(home/latest-orders.png);
}
.brands .title {
background-image: resolve(img/home/brands.png);
background-image: resolve(home/brands.png);
}
.new-arrival .title {
background-image: resolve(img/home/new-arrival.png);
background-image: resolve(home/new-arrival.png);
}
.recommend .title {
background-image: resolve(home/recommend.png);
}
}
\ No newline at end of file
}
... ...