Authored by 沈志敏

Merge branch 'release/5.2' of git.yoho.cn:fe/yohobuywap-node into release/5.2

... ... @@ -7,6 +7,9 @@
const mRoot = '../models';
const rssModel = require(`${mRoot}/rss`);
const Feed = require('feed');
const _ = require('lodash');
const moment = require('moment');
const helpers = global.yoho.helpers;
/**
... ... @@ -15,18 +18,40 @@ const helpers = global.yoho.helpers;
const index = (req, res, next) => {
let gender = req.query.gender || '1,2,3',
items = [];
res.setHeader('Content-Type', 'text/xml; charset=utf-8');
return rssModel.getRssArticle(gender).then((result) => {
return res.render('rss/index', {
layout: false,
time: (new Date()).toUTCString(),
items: result
if (!result) {
return next();
}
res.setHeader('Content-Type', 'text/xml; charset=utf-8');
var feed = new Feed({
id: 'http://yohobuy.com',
title: '有货逛',
description: 'Yoho!Buy有货 | 年轻人潮流购物中心',
link: 'http://yohobuy.com',
copyright: '2015 yoho.inc',
generator: 'http://m.yohobuy.com',
updated: new Date(),
})
_.forEach(result, item => {
item.url = item.url.indexOf('http') > 0 ? item.url : 'http://'+item.url
feed.addItem({
title: item.title,
link: `${item.url}&ref=rss`,
description: item.intro,
author: [{
name: (item.author && item.author.name) || ' '
}],
date: new Date(item.publishTimeLong && parseFloat(item.publishTimeLong) || moment(item.publishTime, "MM月DD日 HH:mm"))
});
});
if (req.params[0] && req.params[0] === '/atom') {
return res.send(feed.render('atom-1.0'));
}
return res.send(feed.render('rss-2.0'))
});
};
module.exports = {
index
};
};
\ No newline at end of file
... ...
... ... @@ -44,7 +44,8 @@ const getRssArticle = (gender) => {
if (typeof value.id !== 'undefined') {
build = guangProcess.formatArticle(value, false, false, true);
build.author.name = (build.author && build.author.name) || '';
build.author = build.author || {};
build.author.name = (build.author && build.author.name) || ''
return _genIntro(value.id).then((intro) => {
build.intro = intro;
result.push(build);
... ...
... ... @@ -54,7 +54,7 @@ router.get('/plustar', plustar.getListData); // 国际优选列表页
router.get('/plustar/brandinfo', plustar.getDetailData); // 国际优选详情页
router.post('/plustar/brandinfoAsync', plustar.getDetailDataAsync); // 国际优选详情页异步数据
router.get('/rss', rss.index); // 订阅资讯
router.get(/^\/rss(\/\w+)?(\/\w+)?/, rss.index); // 订阅资讯
router.get('/info/listData', index.listDynamicData);
router.get('/info/detailData', index.detailDynamicData);
... ...
... ... @@ -1744,6 +1744,7 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => {
}
let soldOut = (origin.storage_sum === 0) || (totalStorageNum === 0); // status
let notForSale = origin.attribute === 2;
let preSale = (origin.status === 0 && origin.advance_shelve_time > 0);
// 悬浮的购物车信息
dest.cartInfo = {
... ... @@ -1753,7 +1754,7 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => {
};
// 显示加入购物车链接
if (!soldOut && !notForSale || origin.isLimitBuy) {
if (!soldOut && !notForSale && !preSale || origin.isLimitBuy) {
_.orderBy(colorGroup);
Object.assign(dest.cartInfo, {
productId: origin.product_id,
... ... @@ -1808,12 +1809,15 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => {
origin.goods_id + '.html');
return callback();
}
} else if (notForSale) {
} else if (notForSale && !preSale) {
dest.cartInfo.notForSale = true;
return callback();
} else if (soldOut) {
} else if (soldOut && !preSale) {
dest.cartInfo.soldOut = true;
return callback();
} else if (preSale) {
dest.cartInfo.preSale = true;
return callback();
}
// 是否收藏 使用单独收藏接口获取
... ...
... ... @@ -140,6 +140,7 @@
<a id="soldOut" href="javascript:;" class="sold-out data-bind">已售罄</a>
<a id="notForSale" href="javascript:;" class="sold-out data-bind">非卖品</a>
<a id="limitNotForSale" href="javascript:;" class="sold-out limit data-bind">即将发售</a>
<a id="preSale" href="javascript:;" class="sold-out limit data-bind">即将开售</a>
<a href="javascript:;" id="addtoCart" class="addto-cart can-buy-limit data-bind">立即购买</a>
<a id="noLimitCode" href="javascript:;" class="sold-out limit data-bind">立即购买</a>
<input type="hidden" id="limitCodeUrl" name="limitCodeUrl" value="">
... ...
... ... @@ -17,9 +17,9 @@
</li>
{{/data}}
</ul>
{{/if}}
<div class="swiper-pagination">
<div class="pagination-inner">
<div class="swiper-pagination">
<div class="pagination-inner">
</div>
</div>
</div>
{{/if}}
</div>
... ...
... ... @@ -27,6 +27,7 @@
"cookie-parser": "^1.4.3",
"cookie-session": "^1.2.0",
"express": "^4.14.0",
"feed": "^0.3.0",
"lodash": "^4.16.1",
"md5": "^2.1.0",
"moment": "^2.15.1",
... ...
... ... @@ -11,8 +11,7 @@ var $ = require('yoho-jquery'),
var bannerSwiper;
var C_ID,
getChannel;
var C_ID;
// 获取url中的参数
function getUrlParam(name) {
... ...
... ... @@ -120,6 +120,9 @@ function render(data) {
if (data.cartInfo.canNotBuy) {
$('#noLimitCode').removeClass(dbClass);
}
if (data.cartInfo.preSale) {
$('#preSale').removeClass(dbClass);
}
$('.cart-bar').removeClass('data-bind');
$('#limitCodeUrl').val(data.cartInfo.limitCodeUrl);
$('#limitProductPay').val(data.cartInfo.limitProductPay);
... ...
... ... @@ -202,7 +202,7 @@ $search.on('touchend', function() {
*/
function getQueryString(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
var r = window.location.search.substr(1).match(reg);
var r = decodeURI(window.location.search).substr(1).match(reg);
if (r !== null) {
return window.unescape(r[2]);
... ...
.banner-center {
position: relative;
height: 200px;
border-bottom: 1px solid #e0e0e0;
overflow: hidden;
img {
... ... @@ -47,7 +46,6 @@
background: #fff;
width: 100%;
height: 200px;
border-top: 1px solid #e0e0e0;
overflow: hidden;
.banner-list {
... ...
... ... @@ -10,7 +10,6 @@
}
&-goods-list {
height: 330px;
width: 100%;
overflow-x: scroll;
overflow-y: hidden;
... ... @@ -39,28 +38,30 @@
.goods-info {
position: relative;
height: 84px;
width: 100%;
height: 168px;
width: 200%;
background: #fff;
padding: 12px 0 10px 10px;
padding: 24px 0 20px 20px;
transform: scale(0.5);
transform-origin: 0 0 0;
.price {
color: #444;
font-size: 20px;
font-size: 40px;
line-height: 1;
}
.view-num {
color: #b0b0b0;
font-size: 15px;
margin-top: 10px;
font-size: 30px;
margin-top: 20px;
line-height: 1;
}
.view-status {
color: #b0b0b0;
font-size: 15px;
margin-top: 7px;
font-size: 30px;
margin-top: 14px;
line-height: 1;
}
... ...
... ... @@ -3,6 +3,7 @@
position: relative;
background: #fff;
-webkit-overflow-scrolling: touch;
&-banner {
height: 200px;
... ... @@ -11,7 +12,6 @@
}
&-goods-list {
height: 330px;
width: 100%;
overflow-x: scroll;
overflow-y: hidden;
... ... @@ -40,31 +40,33 @@
.goods-info {
position: relative;
height: 84px;
width: 100%;
height: 168px;
width: 200%;
background: #fff;
padding: 14px 0 10px 10px;
padding: 28px 0 20px 20px;
transform: scale(0.5);
transform-origin: 0 0 0;
.vip-price {
display: none;
color: #d0021b;
font-size: 20px;
font-size: 40px;
line-height: 1;
}
.sale-price {
color: #b0b0b0;
font-size: 15px;
line-height: 20px;
font-size: 30px;
line-height: 40px;
text-decoration: line-through;
margin-top: 12px;
margin-top: 24px;
}
.vip-icon {
display: inline-block;
height: 20px;
width: 50px;
margin-left: 8px;
height: 40px;
width: 100px;
margin-left: 16px;
vertical-align: middle;
background: resolve('channel/vip.png');
background-size: 100% 100%;
... ...
... ... @@ -97,7 +97,8 @@
}
.open-icon-1 {
background: url("/home/installment-icon1.png") no-repeat;
background: resolve("home/installment-icon1.png") no-repeat;
background-size: contain;
width: 67px;
height: 67px;
display: block;
... ... @@ -105,7 +106,8 @@
}
.open-icon-2 {
background: url("/home/installment-icon2.png") no-repeat;
background: resolve("home/installment-icon2.png") no-repeat;
background-size: contain;
width: 67px;
height: 67px;
display: block;
... ... @@ -113,7 +115,8 @@
}
.open-icon-3 {
background: url("/home/installment-icon3.png") no-repeat;
background: resolve("home/installment-icon3.png") no-repeat;
background-size: contain;
width: 67px;
height: 67px;
display: block;
... ... @@ -431,7 +434,7 @@
color: #fff;
display: block;
margin: 30px auto 0;
font-size: 26px;
font-size: 22px;
}
}
... ... @@ -498,7 +501,7 @@
.usable-area {
position: relative;
height: 330px;
height: 325px;
.replay-status {
position: absolute;
... ...
... ... @@ -68,6 +68,7 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid, reqQueryStr
title: articleData.title,
text: articleData.intro,
publishTime: articleData.publish_time,
publishTimeLong: articleData.publish_time_long,
pageView: articleData.views_num
};
... ...