Authored by 陈轩

Merge remote-tracking branch 'origin/release/5.1' into release/5.1

... ... @@ -41,12 +41,7 @@ const getListData = (req, res, next) => {
navTitle: '明星原创'
}),
pageFooter: true,
ps: {
sName: '明星潮品',
pName: '原创潮牌',
star: result.star,
plus: result.plus
}
ps: result
});
}).catch(next);
} else {
... ... @@ -60,12 +55,7 @@ const getListData = (req, res, next) => {
navTitle: '国际优选'
}),
pageFooter: true,
ps: {
sName: '设计师',
pName: '经典潮牌',
star: result.star,
plus: result.plus
}
ps: result
});
}).catch(next);
}
... ... @@ -79,6 +69,8 @@ const getDetailData = (req, res, next) => {
let isApp = req.query.app_version || req.query.appVersion || false;
let clientType = req.body.client_type || '';
let version = req.body.app_version || '';
let userAgent = req.get('User-Agent');
let isWeixin = userAgent.includes('MicroMessenger'); // 标识是否是微信访问
if (clientType.toLowerCase() === 'ios' && version) {
clientType = 'iphone';
... ... @@ -90,15 +82,26 @@ const getDetailData = (req, res, next) => {
plustarModel.getDetailData(id, uid, udid, gender, isApp, clientType).then((result) => {
result.brandIntro = htmlProcess.removeHtml(result.brandIntro);
res.render('plustar/detail', {
module: 'guang',
page: 'plustar-detail',
title: result.brandName,
pageHeader: headerModel.setNav({
navTitle: result.brandName
}),
ps: result
});
if (!isApp & !isWeixin) {
res.render('plustar/detail', {
module: 'guang',
page: 'plustar-detail',
title: result.brandName,
pageHeader: headerModel.setNav({
navTitle: result.brandName
}),
ps: result
});
} else {
res.render('plustar/detail', {
module: 'guang',
page: 'plustar-detail',
title: result.brandName,
ps: result
});
}
}).catch(next);
};
... ...
... ... @@ -5,6 +5,15 @@ const _ = require('lodash');
const logger = global.yoho.logger;
const camelCase = global.yoho.camelCase;
const helpers = global.yoho.helpers;
const htmlProcess = require(`${global.utils}/html-process`);
const privateKeyList = {
android: 'fd4ad5fcfa0de589ef238c0e7331b585',
iphone: 'a85bb0674e08986c6b115d5e3a4884fa',
ipad: 'ad9fcda2e679cf9229e37feae2cdcf80',
web: '0ed29744ed318fd28d2c07985d3ba633',
h5: 'fd4ad5fcfa0de589ef238c0e7331b585'
};
const formaData = (data, gender) => {
let build = [];
... ... @@ -61,7 +70,7 @@ const getContentData = (gender, type, channel, isRecommend) => {
if (result && result.code === 200) {
return formaData(result.data.data.list[0].data, gender);
} else {
logger.error('列表 list data return code is not 200');
logger.error('list data return code is not 200');
return {};
}
});
... ... @@ -69,19 +78,45 @@ const getContentData = (gender, type, channel, isRecommend) => {
const getListData = (gender, recom, all) => {
return Promise.all([getContentData(gender, recom), getContentData(gender, all)]).then((result) => {
return {
star: result[0],
plus: result[1]
};
let ps = [];
if (result[0]) {
ps.push({
focus: true,
name: '设计师',
list: result[0]
});
}
if (result[1]) {
ps.push({
name: '经典潮牌',
list: result[1]
});
}
return ps;
});
};
const getBrandsData = (gender, starBrand, originalBrand, channel, isRecommend) => {
return Promise.all([getContentData(gender, starBrand, isRecommend, channel), getContentData(gender, originalBrand, isRecommend, channel)]).then((result) => {
return {
star: result[0],
plus: result[1]
};
let ps = [];
if (result[1]) {
ps.push({
focus: true,
name: '原创潮牌',
list: result[1]
});
}
if (result[0]) {
ps.push({
name: '明星潮品',
list: result[0]
});
}
return ps;
});
};
... ... @@ -153,7 +188,7 @@ const getNewProduct = (brandId, gender, url) => {
studentPrice: list.sales_price * 0.9,
is_soon_sold_out: list.is_soon_sold_out === 'Y',
isShowSaleTagDis: list.sales_price * 2 < list.market_price,
url: '/product/pro_' + list.product_id + '_' +
url: '//m.yohobuy.com/product/pro_' + list.product_id + '_' +
list.goods_list[0].goods_id + '/' + list.cn_alphabet + '.html',
tags: tag
});
... ... @@ -179,14 +214,15 @@ const getNewProduct = (brandId, gender, url) => {
};
// 相关资讯
const getRelatedEditorial = (brandId, uid, udid, clientType) => {
const getRelatedEditorial = (brandId, uid, udid, clientType, isApp) => {
return serviceAPI.get('guang/service/v1/article/getArticleByBrand', {
brand_id: brandId,
uid: uid,
udid: udid,
client_type: clientType,
limit: 3
limit: 3,
private_key: privateKeyList[clientType]
}).then((result) => {
if (result && result.code === 200) {
... ... @@ -194,9 +230,13 @@ const getRelatedEditorial = (brandId, uid, udid, clientType) => {
let list = [];
_.forEach(result.data, function(data) {
if (isApp) {
data.url = data.url + '';
}
list.push({
id: data.id,
url: data.url,
url: isApp ? `${helpers.https(data.url)}&openby:yohobuy={"action":"go.h5","params":{"param":{"id":"${data.id}"},"shareparam":{"id":"${data.id}"},"share":"/guang/api/v1/share/guang","id":${data.id},"type":1,"url":"http:${helpers.urlFormat('/info/index', null, 'guang')}","islogin":"N"}}` : data.url,
title: data.title,
text: data.intro,
img: helpers.image(data.src, 640, 640),
... ... @@ -206,6 +246,8 @@ const getRelatedEditorial = (brandId, uid, udid, clientType) => {
});
});
return list;
} else {
logger.error('editorial data return code is not 200');
... ... @@ -219,7 +261,8 @@ const isCollection = (uid, brandId, clientType) => {
return serviceAPI.get('shops/service/v1/favorite/getUidBrandFav', {
uid: uid,
brandId: brandId,
client_type: clientType
client_type: clientType,
private_key: privateKeyList[clientType]
}).then((result) => {
if (result && result.code === 200) {
... ... @@ -245,6 +288,7 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => {
if (result && result.code === 200) {
let list = result.data || [];
let jumpToApp;
list = camelCase(list);
let url;
... ... @@ -259,12 +303,22 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => {
url = '//' + brandDomain + '.m.yohobuy.com';
}
return Promise.all([isCollection(uid, brandId, clientType), getRelatedEditorial(brandId, uid, udid, clientType), getNewProduct(brandId, gender, url)]).then((result) => {
if (isApp & !uid) {
jumpToApp = 1;
}
return Promise.all([isCollection(uid, brandId, clientType), getRelatedEditorial(brandId, uid, udid, clientType, isApp), getNewProduct(brandId, gender, url)]).then((resultData) => {
list = _.assign(list, {
isLike: result[0],
infos: result[1],
newArrival: result[2]
isLike: resultData[0],
infos: resultData[1],
newArrival: resultData[2],
jumpToApp: jumpToApp,
shareLink: '//guang.m.yohobuy.com/plustar/brandinfo?id=' + id,
shareTitle: list.brandName,
shareImg: list.brandIco,
shareDesc: htmlProcess.removeHtml(list.brandIntro)
});
return list;
... ...
<div class="ps-list-page ps-page yoho-page">
{{# ps}}
<ul id="nav-tab" class="nav-tab clearfix">
<li class="star-nav focus">{{sName}}</li>
<li class="plus-nav">{{pName}}</li>
</ul>
<div id="ps-content" class="ps-content">
<ul class="star-content content">
{{# star}}
{{> ps_item}}
{{/ star}}
<div class="ps-list-page ps-page yoho-page">
{{#if ps}}
<ul id="nav-tab" class="nav-tab clearfix">
{{# ps}}
<li {{#if focus}} class="focus" {{/if}} >{{name}}</li>
{{/ps}}
</ul>
<ul class="plus-content content hide">
{{# plus}}
{{> ps_item}}
{{/ plus}}
</ul>
</div>
{{/ ps}}
<div id="ps-content" class="ps-content">
{{# ps}}
<ul class="content{{#if focus}}{{^}} hide {{/if}}">
{{# list}}
{{> ps_item}}
{{/ list}}
</ul>
{{/ps}}
</div>
{{/if}}
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -327,8 +327,6 @@ function givePoint(parameter) {
window._yas.sendCustomInfo({
op: 'YB_CHOOSE_FOR_YOU_Y',
apf: (queryString().app_version || queryString().appVersion) ? true : false,
ts: new Date().getTime(),
param: JSON.stringify(parameter)
}, true);
}
... ...
... ... @@ -65,8 +65,6 @@ plusstar = {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_FASHION_TAB_C',
apf: isApp,
ts: new Date().getTime(),
param: JSON.stringify($.extend(speckParamApp, {
C_ID: CID,
TAB_ID: $liDom.index() + 1
... ... @@ -75,8 +73,6 @@ plusstar = {
window._yas.sendCustomInfo({
op: 'YB_FASHION_HOME_L',
apf: isApp,
ts: new Date().getTime(),
param: JSON.stringify($.extend(speckParamApp, {
C_ID: CID,
TAB_ID: that.ParentLiDom.index() + 1
... ... @@ -131,8 +127,6 @@ plusstar = {
index = $dom.index() + 1;
window._yas.sendCustomInfo({
op: 'YB_FASHION_FLR_C',
apf: isApp,
ts: new Date().getTime(),
param: JSON.stringify($.extend(speckParamApp, {
C_ID: CID,
TAB_ID: that.ParentLiDom.index() + 1,
... ... @@ -150,8 +144,6 @@ plusstar = {
window._yas.sendCustomInfo({
op: 'YB_FASHION_FLR_C',
apf: isApp,
ts: new Date().getTime(),
param: JSON.stringify($.extend(speckParamApp, {
C_ID: CID,
TAB_ID: that.ParentLiDom.index() + 1,
... ... @@ -168,8 +160,6 @@ plusstar = {
// 潮流优选首页加载时
window._yas.sendCustomInfo({
op: 'YB_FASHION_HOME_L',
apf: isApp,
ts: new Date().getTime(),
param: JSON.stringify($.extend(speckParamApp, {
C_ID: CID,
TAB_ID: that.ParentLiDom.index() + 1
... ...
... ... @@ -5,24 +5,14 @@ var $ = require('yoho-jquery'),
var $navs = $('#nav-tab > li'),
$contents = $('#ps-content > .content');
var mySwiper;
require('../common');
lazyLoad($('img.lazy'));
$('.star-content li').each(function(key, item) {
$(item).find('.swiper-container').addClass('swiper-' + key);
mySwiper = new Swiper('.swiper-' + key, {
lazyLoading: true,
pagination: '.swiper-' + key + ' .pagination-inner'
});
});
$('#nav-tab').bind('contextmenu', function(e) {
$('#nav-tab').bind('contextmenu', function() {
return false;
});
$('#nav-tab').on('touchend touchcancel', function(e) {
var $this = $(e.target).closest('li');
... ... @@ -30,11 +20,26 @@ $('#nav-tab').on('touchend touchcancel', function(e) {
return;
}
$navs.toggleClass('focus');
$contents.toggleClass('hide');
$navs.removeClass('focus');
$this.addClass('focus');
$contents.addClass('hide');
$contents.eq($this.index()).removeClass('hide');
if (typeof $this.swiper === 'undefined') { // 解决隐藏式,swiper不渲染
$this.swiper = false;
$contents.find('li').each(function(key, item) {
$(item).find('.swiper-container').addClass('swiper-' + key);
new Swiper('.swiper-' + key, {
lazyLoading: true,
pagination: '.swiper-' + key + ' .pagination-inner'
});
});
}
$(document).trigger('scroll'); // Trigger lazyLoad
});
$('#nav-tab').on('touchstart', function(e) {
var target = e.target || e.srcElement;
... ...
... ... @@ -26,7 +26,12 @@ var dateText = 0,
newHour = 0,
newMinus = 0;
var skuFlag;
var skuFlag,
hideNum,
hideIndex;
var oneIndex = 0,
twoIndex = 0;
require('../common');
... ... @@ -113,23 +118,29 @@ $(
// 如果秒杀库存为0
if (data.secKillSku[i].storageNum === 0) {
skuFlag = 0;
$(this).addClass('zero-stock');
oneIndex = $(this).index() + 1;
twoIndex = $(this).parent('ul').index() - 2;
$('.chose-panel .color-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').addClass('zero-stock');
}
} else {
// alert("没有匹配");
}
}
if (skuFlag === 0) {
$(this).addClass('zero-stock').attr('data-num', '1');
var oneIndex = $(this).index() + 1;
var twoIndex = $(this).parent('ul').index() - 2;
$(this).addClass('zero-stock').attr('data-num', '0').addClass('hide');
oneIndex = $(this).index() + 1;
twoIndex = $(this).parent('ul').index() - 2;
$('.chose-panel .color-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').addClass('zero-stock');
$('.chose-panel .color-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').addClass('zero-stock').addClass('hide');
}
}
);
seckHide();// 非秒杀库存置灰
$('.price-date').append(
'<div class="seckill-time seckill-time-border">' +
'<span>距结束&nbsp</span>' +
... ... @@ -200,3 +211,47 @@ $(
}
);
function seckHide() {
$('.chose-panel .size-list ul').each(
function() {
hideNum = 0;
$(this).find('li').each(
function() {
if ($(this).hasClass('hide')) {
oneIndex = $(this).index() + 1;
twoIndex = $(this).parent('ul').index() - 2;
$('.color-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').hide();
} else {
hideNum++;
}
}
);
if (hideNum === 0) {
hideIndex = $(this).index() - 2;
$('.color-list ul:first li:eq(' + hideIndex + ')').hide();
}
}
);
$('.chose-panel .color-list ul').each(
function() {
hideNum = 0;
$(this).find('li').each(
function() {
if ($(this).hasClass('hide')) {
oneIndex = $(this).index() + 1;
twoIndex = $(this).parent('ul').index() - 2;
$('.size-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').hide();
} else {
hideNum++;
}
}
);
if (hideNum === 0) {
hideIndex = $(this).index() - 2;
$('.size-list ul:first li:eq(' + hideIndex + ')').hide();
}
}
);
}
... ...
.ps-list-page {
background-color: #f0f0f0;
.nav-tab, .ps-content {
.nav-tab,
.ps-content {
width: 100%;
}
.nav-tab {
/*height: 60px;*/
height: 80px;
padding: 10px 0;
background-color: #fff;
}
.star-nav, .plus-nav {
box-sizing: border-box;
float: left;
width: 50%;
height: 60px;
line-height: 60px;
font-size: 16PX;
text-align: center;
color: #ccc;
li {
box-sizing: border-box;
float: left;
width: 50%;
height: 60px;
line-height: 60px;
font-size: 16PX;
text-align: center;
color: #ccc;
border-right: 1px solid #ccc;
&.focus {
color: #000;
&.focus {
color: #000;
}
&:last-child {
border-right: none;
}
}
}
.bytouch{
background:#eee;
}
.star-nav {
border-right: 1px solid #ccc;
.bytouch {
background: #eee;
}
.plus-star-row {
... ... @@ -42,15 +46,14 @@
> a {
display: block;
height: 310px;
> img {
width: 100%;
height: 100%;
width: 100%;
height: 100%;
}
}
}
.content.hide {
display: none;
}
... ... @@ -85,7 +88,8 @@
border-top: 1px solid #e0e0e0;
background-color: #fff;
&.header, &.related-infos {
&.header,
&.related-infos {
border-top: none;
}
... ... @@ -166,7 +170,7 @@
display: inline-block;
height: 100%;
width: 40px;
transition: transform .1s ease-in;
transition: transform 0.1s ease-in;
}
&.spread .icon {
... ... @@ -178,7 +182,7 @@
padding-left: 0 30px;
.new-arrival-content {
padding: 0 0 20px 0;
padding-bottom: 20px;
width: 614px;
margin: 0 auto;
}
... ... @@ -219,7 +223,6 @@
margin-right: 30px;
margin-top: 10px;
}
}
.new-arrival-header {
... ... @@ -234,7 +237,6 @@
}
}
.related-info-title {
margin: 0 29px;
border: 1px solid #e0e0e0;
... ...