Authored by 姜枫

Merge branch 'release/1.0' of http://git.yoho.cn/fe/yoho-blk into release/1.0

... ... @@ -69,23 +69,19 @@ const _processTabData = (list) => {
list = list || [];
list = camelCase(list);
_.forEach(list, function(value, index) {
if (index === 1) {
_.forEach(value.data, function(data) {
tabData.push(
{
url: data.url,
name: data.title,
src: data.src
}
);
});
}
_.forEach(list, function(value) {
_.forEach(value.data, function(data) {
tabData.push(
{
url: data.url,
src: data.src
}
);
});
});
return tabData;
};
/**
... ... @@ -95,7 +91,9 @@ const _processTabData = (list) => {
*/
const _getResources = (contentCode) => {
return serviceAPI.get('operations/api/v5/resource/get', {content_code: contentCode}).then((result) => {
if (result && result.code === 200) {
// console.log(result)
return _processTabData(result.data);
} else {
logger.error('The data of brand resources return code is not 200');
... ...
... ... @@ -8,6 +8,7 @@
const editorialModel = require('../models/editorial');
const md5 = require('md5');
const config = global.yoho.config;
/**
* 资讯首页数据
... ... @@ -105,6 +106,12 @@ const list = (req, res) => {
link = 'http://www.yohoblk.com/lifestyle';
}
if (tag) {
res.cookie('tag', tag, {
domain: config.cookieDomain
});
}
editorialModel.getListData(appType, pageNum, limit, udid, gender, tag, authorId).then((result) => {
res.display('list', {
... ... @@ -159,19 +166,24 @@ const detail = (req, res, next) => {
let channel = req.cookies._Channel || 'men';
let name = '';
let link = '';
let gender = '';
let tag = req.cookies.tag;
if (channel === 'men') {
name = 'MEN首页';
link = 'http://www.yohoblk.com';
gender = '1,3';
} else if (channel === 'women') {
name = 'WOMEN首页';
link = 'http://www.yohoblk.com/women';
gender = '2,3';
} else {
name = 'LIFESTYLE首页';
link = 'http://www.yohoblk.com/lifestyle';
gender = '3,3';
}
editorialModel.getDetailData(id, appType, uid, udid).then((result) => {
editorialModel.getDetailData(id, appType, gender, tag, uid, udid).then((result) => {
res.display('detail', {
module: 'editorial',
page: 'detail',
... ...
... ... @@ -160,7 +160,7 @@ const _processHeadData = (list) => {
isLike: data.isPraise,
isCollected: data.isFavor,
likeNum: data.praiseNum,
weixinUrl: `http://guang.m.yohobuy.com/info/index?id=${data.id}`
weixinUrl: `http://m.yohoblk.com/${data.id}.html`
};
}
... ... @@ -214,7 +214,7 @@ const _getRelatedData = (idList) => {
productSkn: idList,
method: 'h5.product.batch'
}).then((result) => {
// console.log(result)
let productList = [];
if (result && result.code === 200) {
... ... @@ -229,6 +229,7 @@ const _getRelatedData = (idList) => {
productSkn: data.product_skn
});
});
return productList;
} else {
logger.error('推荐商品 cood 不是 200');
... ... @@ -358,7 +359,6 @@ const _processContentData = (list) => {
delete related.relatedGroup[key];
}
});
}
... ... @@ -495,11 +495,18 @@ const _getRelateBrand = (id, appType) => {
* @param id
* @returns {*}
*/
const _getArticlePre = (id, appType) => {
return serviceAPI.get('guang/api/*/article/getArticlePre', {
const _getArticlePre = (id, appType, gender, tag) => {
let per = {
id: id,
app_type: appType
}).then((result) => {
app_type: appType,
gender: gender
};
if (tag) {
per.tag = tag;
}
return serviceAPI.get('guang/api/*/article/getArticlePre', per).then((result) => {
if (result && result.code === 200) {
let perArticle = {};
... ... @@ -524,11 +531,18 @@ const _getArticlePre = (id, appType) => {
* @param id
* @returns {*}
*/
const _getArticleNext = (id, appType) => {
return serviceAPI.get('guang/api/*/article/getArticleNext', {
const _getArticleNext = (id, appType, gender, tag) => {
let per = {
id: id,
app_type: appType
}).then((result) => {
app_type: appType,
gender: gender
};
if (tag) {
per.tag = tag;
}
return serviceAPI.get('guang/api/*/article/getArticleNext', per).then((result) => {
if (result && result.code === 200) {
... ... @@ -656,14 +670,14 @@ const shareData = () => {
* @param id
* @returns {*}
*/
const getDetailData = (id, appType, uid, udid) => {
const getDetailData = (id, appType, gender, tag, uid, udid) => {
return co(function *() {
let result = yield Promise.all([_getHeadData(id, appType, uid, udid),
_getArticleData(id, appType),
_getContentData(id, appType),
_getCommentsData(id, appType),
_getArticlePre(id, appType),
_getArticleNext(id, appType),
_getArticlePre(id, appType, gender, tag),
_getArticleNext(id, appType, gender, tag),
_getRelateBrand(id, appType)]);
let res = yield _processHeadData([result[0], result[1], result[3]]);
... ...
... ... @@ -28,9 +28,11 @@
<div class="article-main">
{{# content}}
{{# singleImage}}
<span class="article-pic">
{{# data}}
<img src="{{image src 930 660 1}}">
{{/ data}}
</span>
{{/ singleImage}}
{{# smallPic}}
<span class="article-pictwo">
... ... @@ -82,8 +84,8 @@
{{/ relatedGroup}}
</div>
</div>
<span class="left iconfont hide">&#xe62c;</span>
<span class="right iconfont">&#xe629;</span>
<span class="btn-left iconfont hide">&#xe62c;</span>
<span class="btn-right iconfont">&#xe629;</span>
</div>
{{/ related}}
{{/ content}}
... ...
... ... @@ -498,13 +498,14 @@ const setBrandIntro = brand => {
if (brand) {
let text = _.replace(brand.brandIntro, /<\/?[^>]*>|\s*|(\n)|(\t)|(\r)/g, ''),
more = `... <a href="/product/shop/${brand.brandDomain}?brandIntro=true" class="blue">了解更多>></a>`;
more = '... <a href="javascript:;" class="more-brand-intro blue">了解更多>></a>';
barndIntro = {
brand: {
titleEn: 'BRAND',
titleCn: '品牌介绍',
logo: brand.brandIco,
fullIntro: brand.brandIntro,
intro: _.truncate(text, {
length: 300,
omission: more
... ...
... ... @@ -175,6 +175,17 @@
<img src="{{image logo 250 84}}">
<div class="intro-text">{{{intro}}}</div>
</div>
<div id="intro-full-hide" class="hide">
<div class="full-intro-title">
<h2>{{titleEn}}</h2>
<h5>{{titleCn}}</h5>
</div>
<div class="full-intro-text nano">
<div class="nano-content">
{{{fullIntro}}}
</div>
</div>
</div>
</div>
{{/ brand}}
... ...
... ... @@ -8,6 +8,7 @@
const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';
const isUseOneapm = process.env.USE_ONEAPM === 'true';
module.exports = {
app: 'web',
... ... @@ -47,7 +48,8 @@ module.exports = {
name: 'error',
level: 'error',
filename: 'logs/error.log',
handleExceptions: true
handleExceptions: true,
maxFiles: 7
},
udp: { // send by udp
measurement: 'yohoblk_pc_log',
... ... @@ -99,7 +101,7 @@ if (isProduction) {
session: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
timeout: 3000
},
useOneapm: true,
useOneapm: isUseOneapm,
useCache: true,
pay: {
serviceNotify: 'http://service.yoho.cn/'
... ... @@ -109,10 +111,10 @@ if (isProduction) {
Object.assign(module.exports, {
appName: 'www.yohoblk.com for test',
domains: {
singleApi: 'http://192.168.102.31:8092/brower',
api: 'http://testapi.yoho.cn:28078/',
service: 'http://testservice.yoho.cn:28077/',
search: 'http://192.168.102.216:8080/yohosearch/'
singleApi: process.env.TEST_SINGLEAPI || 'http://192.168.102.31:8092/brower',
api: process.env.TEST_API || 'http://testapi.yoho.cn:28078/',
service: process.env.TEST_SERVICE || 'http://testservice.yoho.cn:28077/',
search: process.env.TEST_SEARCH || 'http://192.168.102.216:8080/yohosearch/'
},
useOneapm: true,
useCache: true,
... ...
... ... @@ -203,35 +203,35 @@ if ($('.collocation').find('.good-info').length === 0) {
if ($('.goods').find('.good-info').length === 0) {
$('.related-group').hide();
} else if ($('.goods').find('.good-info').length < 5) {
$('.left').hide();
$('.right').hide();
$('.btn-left').hide();
$('.btn-right').hide();
}
$('.right').click(function() {
$('.btn-right').click(function() {
pag = pag + 1;
if (pag === leng - 1) {
$('.right').addClass('hide');
$('.btn-right').addClass('hide');
}
if (pag !== 0) {
$('.left').removeClass('hide');
$('.btn-left').removeClass('hide');
}
$('.goods').animate({left: '+=-930px'});
});
$('.left').click(function() {
$('.btn-left').click(function() {
var $goods = $('.goods');
pag = pag - 1;
if (pag === 0) {
$('.left').addClass('hide');
$('.btn-left').addClass('hide');
}
if (pag !== leng - 1) {
$('.right').removeClass('hide');
$('.btn-right').removeClass('hide');
}
$goods.animate({left: '+=930px'});
... ... @@ -254,3 +254,12 @@ if ($('.chapter-right').find('a').text() === '') {
}
$('.comments-list').find('li:last').css('border-bottom', 'none');
// $('.good-info').find('.price')
$('.good-info').each(function() {
var $this = $(this).find('.price');
if ($this.text().indexOf('.') < 0) {
$this.html($this.text() + '.00');
}
});
... ...
... ... @@ -189,7 +189,7 @@ $(function() {
if (len === 2) {
new _alert('修改成功!').show();
} else {
new _alert('修改失败!').show();
new _alert(data[0].message).show();
}
}
});
... ...
... ... @@ -115,11 +115,14 @@ $('.share-wrapper').on('click', 'i', function() {
share(type);
});
$('.weixin').hover(function() {
$('.weixin').mouseenter(function() {
var $el = $(this),
type = $el.data('type');
share(type, $el);
}, function() {
});
$('.weixin').mouseleave(function() {
console.log(2);
$('.weixin-share-box').hide();
});
... ...
... ... @@ -36,8 +36,10 @@ var noticeFn = handlebars.compile($('#arrival-notice-tpl').html() || ''),
noticeSuccFn = handlebars.compile($('#arrival-notice-success-tpl').html() || '');
var thumbsLoaded = [],
id = $main.data('id');
id = $main.data('id'),
introHtml;
require('yoho-jquery-nanoscroller');
require('../plugins/share');
require('../common/header');
require('../common/return-top');
... ... @@ -324,6 +326,15 @@ $('#collect-product').click(function() {
});
});
$('.more-brand-intro').click(function() {
new Dialog({
className: 'item-more-intro-dialog',
content: introHtml,
btns: []
}).show();
$('.full-intro-text').nanoScroller();
});
$sizeInfo.on('click', '.show-img', function() {
var img = $sizeInfo.data('img');
... ... @@ -334,4 +345,10 @@ $sizeInfo.on('click', '.show-img', function() {
}).show();
});
if ($(window).height() < 800) {
$('.full-intro-text').addClass('min-height');
}
introHtml = $('#intro-full-hide').html();
chooseDefaultSize(); // 如果size只有一个则默认选中
... ...
... ... @@ -37,6 +37,8 @@ var balanceTpl = require('../../tpl/shopping/balance.hbs');
var pkgCache = {};
var suredCoin = 0;
var $pkgList;
require('yoho-jquery-placeholder');
... ... @@ -218,8 +220,10 @@ $coinSure.click(function() {
return;
}
suredCoin = getCoinUsed();
// 切换显示
compute(getCoinUsed());
compute(suredCoin);
toggleCoinPanel();
});
... ... @@ -257,7 +261,7 @@ $('.print-price-radio').check({
$('#balance-list').on('click', '#submit-order', function() {
var reqParam = {
address_id: $('.address.focus').data('id'),
use_yoho_coin: getCoinUsed(),
use_yoho_coin: suredCoin,
remark: $('#remark-content').val(),
isPrintPrice: $printPrice.printPrice
};
... ...
... ... @@ -11,23 +11,16 @@
.share-wrapper {
i {
display: block;
float: left;
width: 20px;
height: 20px;
margin-right: 15px;
cursor: pointer;
font-size: 20px;
}
.weixin {
height: 30px;
}
}
.weixin-share-box {
position: absolute;
padding-top: 9px;
margin-top: 9px;
text-align: center;
top: 15px;
left: 26px;
... ... @@ -56,7 +49,7 @@
height: 12px;
display: block;
background-image: resolve("layout/up.png");
top: 17px;
top: 9px;
}
}
... ...
... ... @@ -77,6 +77,13 @@
.article-main {
text-align: center;
margin: 0 auto;
}
.article-pict {
max-width: 930px;
margin: 0 auto;
overflow: hidden;
display: block;
img {
max-width: 930px;
... ... @@ -126,7 +133,7 @@
position: relative;
}
.left {
.btn-left {
position: absolute;
display: block;
width: 30px;
... ... @@ -148,7 +155,7 @@
background: #7f7f7f;
}
.right {
.btn-right {
position: absolute;
display: block;
width: 30px;
... ...
... ... @@ -14,6 +14,11 @@
.brand-logo {
display: inline-block;
height: 45px;
> img {
height: 100%;
}
}
.opt > * {
... ...
... ... @@ -523,3 +523,35 @@
width: 600px;
}
}
.item-more-intro-dialog {
.content {
width: 850px;
text-align: left;
}
.full-intro-title {
margin: 0 0 50px;
h2 {
font-size: 18px;
font-weight: 700;
padding: 10px 0;
}
}
.full-intro-text {
height: 500px;
font-size: 14px !important;
line-height: 1.5;
overflow-x: hidden;
.nano-content {
padding: 0 4px;
}
}
.min-height {
height: 250px;
}
}
... ...