Authored by biao

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

... ... @@ -15,13 +15,17 @@ const brand = require('../models/brand');
const index = (req, res, next) => {
let channel = req.cookies._Channel || 'men';
let contentCode = '';
let name = '';
if (channel === 'women') {
contentCode = '527079e6c46d0f125eb46b835968971b';
name = 'WOMEN首页';
} else if (channel === 'lifestyle') {
contentCode = '94b5ed607b6d565ffc29c2c04be121dc';
name = 'LIFT STYLE首页';
} else {
contentCode = '81886aaa5e82e3741bc1ba1e04ec7706';
name = 'MEN首页';
}
let appType = 1;
... ... @@ -34,9 +38,9 @@ const index = (req, res, next) => {
brand: {
nav: [
{
link: '//guang.yohobuy.com/index/index?type=0',
link: 'www.yohobuy.com',
pathTitle: '首页',
name: 'MEN首页'
name: name
},
{
link: '',
... ...
... ... @@ -37,6 +37,12 @@ const _processListData = (list) => {
} else {
listKey.push(index);
}
// listData.push({
// key: index,
// brands: value
// });
});
listKey.sort();
... ...
... ... @@ -19,7 +19,7 @@
<div class="brands-category">
<div class="category-nav">
{{#each category}}
<a href="#{{key}}">{{key}}</a>
<a href="#{{key}}" class="{{key}}">{{key}}</a>
{{/each}}
</div>
</div>
... ...
{{#each category}}
<dl class="clearfix" name="{{key}}">
<dt>{{key}}</dt>
<dd>
<dd class="brand-tabs">
<ul class="clearfix">
{{#each brands}}
<li>
... ...
... ... @@ -8,6 +8,7 @@
const editorialModel = require('../models/editorial');
const md5 = require('md5');
/**
* 资讯首页数据
* @param req
... ... @@ -17,12 +18,11 @@ const md5 = require('md5');
const index = (req, res, next) => {
let pageNum = req.query.page || 1;
let limit = req.query.limit || 20;
let type = req.query.type || 0;
let appType = 1;
// let gender = req.query.brand || 1;
editorialModel.getIndexData(type, pageNum, limit, appType).then((result) => {
editorialModel.getIndexData(pageNum, limit, appType).then((result) => {
// console.log(result.msg)
res.display('index', {
module: 'editorial',
... ... @@ -40,12 +40,11 @@ const index = (req, res, next) => {
name: 'Editorial资讯'
}
],
msgTypes: result.msgTypes,
msg: result.msg.tabs,
msg: result.tabs,
paginationOpts: {
page: pageNum,
limit: 20,
total: result.msg.total,
total: result.total,
queryParams: req.query
}
},
... ... @@ -117,7 +116,8 @@ const list = (req, res) => {
*/
const detail = (req, res, next) => {
let id = req.params.id;
let clientType = 'pc';
// let clientType = 'pc';
editorialModel.getDetailData(id).then((result) => {
res.display('detail', {
... ... @@ -127,7 +127,7 @@ const detail = (req, res, next) => {
editorialDetail: {
nav: [
{
link: '/editorial?type=0',
link: '#',
pathTitle: '首页',
name: 'MEN首页'
},
... ...
... ... @@ -16,27 +16,6 @@ const logger = global.yoho.logger;
// const helpers = global.yoho.helpers;
/**
* 资讯首页tab数据处理
* @param type
* @returns {*}
*/
const _processNavData = (list, type) => {
let formatData = [];
list = list || [];
list = camelCase(list);
_.forEach(list, (data, index) => {
data.url = `/editorial?type=${data.id}`;
data.isActive = index === parseInt(type, 10);
formatData.push(data);
});
return formatData;
};
/**
* 首页、列表页列表数据处理
* @param type
* @param pageNum
... ... @@ -74,27 +53,10 @@ const _processListData = (list) => {
});
listData.tabs = list.list.artList;
// console.log(listData)
return listData;
};
/**
* 资讯首页tab
* @param type
*/
const _getResources = (type, appType) => {
return serviceAPI.get('guang/api/v1/category/get', {
app_type: appType
}).then((result) => {
if (result && result.code === 200) {
return _processNavData(result.data, type);
} else {
logger.error('Information page navigation data return code is not 200');
return {};
}
});
};
/**
* 首页、列表页列表相关
... ... @@ -103,9 +65,8 @@ const _getResources = (type, appType) => {
* @param limit
* @returns {*}
*/
const _getBreakingSort = (type, pageNum, limit, appType) => {
const getIndexData = (pageNum, limit, appType) => {
return serviceAPI.get('guang/api/*/article/getList', {
sort_id: type,
page: pageNum,
limit: limit,
app_type: appType
... ... @@ -120,23 +81,6 @@ const _getBreakingSort = (type, pageNum, limit, appType) => {
};
/**
* 首页接口
* @param type
* @param pageNum
* @param limit
* @returns {*}
*/
const getIndexData = (type, pageNum, limit, appType) => {
return Promise.all([_getResources(type, appType), _getBreakingSort(type, pageNum, limit, appType)])
.then((result) => {
return {
msgTypes: result[0],
msg: result[1]
};
});
};
/**
* 列表页接口
* @param type
* @param pageNum
... ... @@ -266,10 +210,9 @@ const _processHeadData = (list) => {
* @param id
* @returns {*}
*/
const _getRelatedData = () => {
// console.log(idList);
const _getRelatedData = (idList) => {
return api.get('', {
qurey: '51162882',
query: idList,
method: 'app.search.li'
}).then((result) => {
let productList = [];
... ... @@ -277,17 +220,15 @@ const _getRelatedData = () => {
if (result && result.code === 200) {
_.forEach(result.data.product_list, function(data) {
console.log(data.product_name);
// productList.push({
// name: data.product_name,
// price: data.sales_price,
// id: data.product_id,
// cnAlphabet: data.cn_alphabet
// });
productList.push({
name: data.product_name,
price: data.sales_price,
id: data.product_id,
cnAlphabet: data.cn_alphabet
});
});
console.log(productList);
return productList;
} else {
logger.error('推荐商品 cood 不是 200');
... ... @@ -306,8 +247,7 @@ const _processContentData = (list) => {
list = camelCase(list);
let contentData = {
contents: [],
collecation: []
contents: []
};
_.forEach(list, function(value) {
... ... @@ -327,8 +267,13 @@ const _processContentData = (list) => {
contentData.contents = list;
let idList = '';
let sknList = '';
let formatData = [];
// let recoLength = '';
let related = {
relatedReco: [],
relatedGroup: []
};
_.forEach(contentData.contents, function(value) {
... ... @@ -337,45 +282,52 @@ const _processContentData = (list) => {
_.forEach(value.goods.data, function(data) {
idList += data.id + ',';
// idList = '51152761';
formatData.push(data);
related.relatedReco.push(data);
});
}
// console.log(idList)
// recoLength = idList.length / 9;
if (value.goodsGroup) {
// _.forEach(value.goodsGroup.data, function(data) {
// // console.log(data)
// // _.forEach(data.list, function(value) {
// // sknList += value.id + ',';
_.forEach(value.goodsGroup.data, function(data) {
_.forEach(data.list, function(obj) {
idList += obj.id + ',';
// // formatData.push(value);
related.relatedGroup.push(obj);
// // });
// });
});
});
}
});
// console.log(idList)
_getRelatedData(idList).then((result) => {
_getRelatedData().then((result) => {
// console.log(result)
if (related.relatedReco) {
_.forEach(related.relatedReco, function(data, index) {
_.forEach(formatData, function(data, index) {
// console.log(formatData)
data = _.assign(data, result[index]);
data[index] = _.assign(result[index]);
});
}
});
if (related.relatedGroup) {
_.forEach(related.relatedGroup, function(data, index) {
data = _.assign(data, result[index]);
});
}
// console.log(formatData)
return formatData;
return related;
}).then(() => {
contentData.contents.push({
related: related
});
return contentData;
});
return contentData;
... ... @@ -478,6 +430,20 @@ const _getRelateBrand = (id) => {
});
};
const _getArticlePre = (id) => {
return serviceAPI.get('guang/api/*/article/getArticlePre', {
id: id
}).then((result) => {
if (result && result.code === 200) {
console.log(result);
return result;
} else {
logger.error('上一篇不是200');
return {};
}
});
};
/**
* 资讯收藏
* @param uid
... ... @@ -572,7 +538,6 @@ const addComment = (id, uid, comment) => {
const shareData = () => {
return serviceAPI.get('/guang/api/*/share/guang', {}).then((result) => {
if (result && result.code === 200) {
console.log(34346);
return camelCase(result.data);
} else {
logger.error('Related brand return code is not 200');
... ... @@ -592,6 +557,7 @@ const getDetailData = (id) => {
_getArticleData(id),
_getContentData(id),
_getCommentsData(id),
_getArticlePre(id),
_getRelateBrand(id)]);
let res = yield _processHeadData([result[0], result[1], result[3]]);
... ...
... ... @@ -42,8 +42,8 @@
</div>
{{/ text}}
{{# goods}}
<div class="related-reco">
{{# related}}
<div class="related-reco related-collo">
<div class="article-title">
<div class="title-line"></div>
<div class="text-center">
... ... @@ -53,16 +53,17 @@
</div>
</div>
<div class="related-goods">
{{# data}}
<div class="related-goods collocation">
{{# relatedReco}}
{{> related-goods}}
{{/ data}}
{{/ relatedReco}}
</div>
</div>
{{/ goods}}
{{!-- {{# goodsGroup}}
<div class="related-reco">
{{!-- {{#if relatedGroup}} --}}
<div class="related-reco related-group">
<div class="article-title">
<div class="title-line"></div>
<div class="text-center">
... ... @@ -72,15 +73,13 @@
</div>
</div>
<div class="related-goods">
{{# data}}
{{# list}}
{{> related-goods}}
{{/ list}}
{{/ data}}
<div class="related-goods goods">
{{# relatedGroup}}
{{> related-goods}}
{{/ relatedGroup}}
</div>
</div>
{{/ goodsGroup}} --}}
{{/ related}}
{{/ content}}
{{#if brands}}
... ...
... ... @@ -3,13 +3,8 @@
{{> path-nav}}
<div class="index-content">
<ul class="msg-nav">
{{# msgTypes}}
<li data-type="{{id}}" {{#if isActive}}class="active"{{/if}}>
<a class="pjax-link" href="{{url}}">{{name}}</a>
</li>
{{/ msgTypes}}
</ul>
<span class="nav-title inline-block"><b>最新</b>资讯</span>
<div id="msg-list" class="msg-list">
{{# msg}}
... ...
<div class="article-title">
<div class="title-line"></div>
<div class="text-center">
<div class="text">
<span>{{relatedTitle}}</span>
</div>
</div>
</div>
\ No newline at end of file
<div class="content-msg clearfix" data-id="{{id}}">
<div class="msg-left">{{categoryName}}</div>
<div class="msg-left"><i class="iconfont">&#xe606;</i> <b class="time-word">{{publishTime}}</b></div>
<div class="msg-right">
<a class="msg-title" href="/editorial/{{id}}.html" target="_blank">{{title}}</a>
<a href="/editorial/{{id}}.html" target="_blank">
... ... @@ -7,10 +7,6 @@
</a>
<div class="content">{{intro}}</div>
<div class="msg-app">
<span class="time">
<i class="iconfont">&#xe606;</i>
<b class="time-word">{{publishTime}}</b>
</span>
<span class="like-comment">
<i class="iconfont like-icon{{#if isPraise}}liked{{/if}}">&#xe60e;</i>
<b class="like-num">{{praiseNum}}</b>
... ...
<div class="goods-info" data-skn="{{skn}}">
<div class="good-info" data-skn="{{skn}}">
<a href="{{link}}" target="_blank">
<img class="thumb" src="{{image src 219 295}}">
</a>
... ...
... ... @@ -185,7 +185,6 @@ const local = {
req.session.destroy();
const clearAll = (v, k) => {
console.log(k);
res.clearCookie(k, {
domain: config.cookieDomain
});
... ...
... ... @@ -127,8 +127,8 @@ passport.use('wechat', new WeixinStrategy({
// sina 登录
passport.use('sina', new SinaStrategy({
clientID: '3739328910',
clientSecret: '9d44cded26d048e23089e5e975c93df1',
clientID: config.thirdLogin.sina.appID,
clientSecret: config.thirdLogin.sina.appSecret,
callbackURL: `${siteUrl}/passport/login/sina/callback`,
requireState: false
}, (accessToken, refreshToken, profile, done) => {
... ... @@ -137,8 +137,8 @@ passport.use('sina', new SinaStrategy({
// qq 登录
passport.use('qq', new QQStrategy({
clientID: '100229394',
clientSecret: 'c0af9c29e0900813028c2ccb42021792',
clientID: config.thirdLogin.qq.appID,
clientSecret: config.thirdLogin.qq.appSecret,
callbackURL: `${siteUrl}/passport/login/qq/callback`,
requireState: false
}, (accessToken, refreshToken, profile, done) => {
... ... @@ -147,8 +147,8 @@ passport.use('qq', new QQStrategy({
// alipay 登录
passport.use('alipay', new AlipayStrategy({
partner: '2088701661478015',
key: 'kcxawi9bb07mzh0aq2wcirsf9znusobw',
partner: config.thirdLogin.alipay.partnerID,
key: config.thirdLogin.alipay.appSecret,
return_url: `${siteUrl}/passport/login/alipay/callback`
}, (profile, done) => {
done(null, profile);
... ...
... ... @@ -51,7 +51,7 @@ const helpers = {
let other = false;
_.forEach(brands, (b) => {
let name = b.brandNameEn || b.brandName;
let name = b.brandAlif || b.brandNameEn || b.brandName;
let char = name.toLowerCase().charAt(0);
if ((char >= 'a' && char <= 'z') || (char >= 'A' && char <= 'Z')) {
... ... @@ -240,6 +240,12 @@ const helpers = {
sorts[0].sub[0].checked = true;
}
if (q.misort) {
sorts[0].sub.forEach(s => {
s.checked = s.categoryId === q.misort;
});
}
sorts = sorts[0].sub;
}
... ...
... ... @@ -19,14 +19,18 @@ const _ = require('lodash');
* @param domain
* @returns {*[]}
*/
function shopMenu(domain) {
function shopMenu(domain, customMenu) {
let menus = [
{id: 'index', name: '店铺首页', href: `/product/shop/${domain}`},
{id: 'all', name: '全部商品', href: `/product/shop/${domain}/list`, icon: '&#xe60a;'},
{id: 'hot', name: '人气单品', href: `/product/shop/${domain}/list?order=s_n_desc`},
{id: 'new', name: '新品上架', href: `/product/shop/${domain}/list?order=s_t_desc`}
{id: 'index', name: '店铺首页', url: `/product/shop/${domain}`},
{id: 'all', name: '全部商品', url: `/product/shop/${domain}/list`, icon: '&#xe60a;'},
{id: 'hot', name: '人气单品', url: `/product/shop/${domain}/list?order=s_n_desc`},
{id: 'new', name: '新品上架', url: `/product/shop/${domain}/list?order=s_t_desc`}
];
if (customMenu && customMenu.length > 0) {
menus = _.concat(menus, customMenu);
}
return menus;
}
... ... @@ -134,10 +138,10 @@ const ShopService = {
info.sorts = sorts;
if (resources.shopTopBanner) { // eslint-disable-line
info.banner = resources.shopTopBanner.detailSrc; // eslint-disable-line
info.banner = resources.shopTopBanner.shopSrc; // eslint-disable-line
}
info.resources = resources;
info.menus = shopMenu(domain);
info.menus = shopMenu(domain, resources.navigationBar);
} else {
let brandId = domainInfo.id;
let brandInfo = yield BrandService.getBrandInfo(brandId, uid);
... ...
... ... @@ -42,7 +42,7 @@
<div class="goods-wrap">
{{#each newProducts}}
<div class="goods-info" data-skn="{{productSkn}}">
<a href="" target="_blank">
<a href="/product/pro_{{productId}}_{{goodsId}}/{{cnAlphabet}}.html" target="_blank">
<img class="lazy thumb" data-original="{{src}}" style="display: block;">
</a>
<div class="desc">
... ... @@ -66,7 +66,7 @@
<div class="goods-wrap">
{{#each hotProducts}}
<div class="goods-info" data-skn="{{productSkn}}">
<a href="" target="_blank">
<a href="/product/pro_{{productId}}_{{goodsId}}/{{cnAlphabet}}.html" target="_blank">
<img class="lazy thumb" data-original="{{src}}" style="display: block;">
</a>
<div class="desc">
... ...
... ... @@ -3,7 +3,7 @@
<ul class="shop-menu">
{{#each menus}}
<li>
<a href="{{href}}">
<a href="{{url}}">
{{name}}
{{#icon}}
<i class="iconfont">&#xe60a;</i>
... ...
... ... @@ -22,8 +22,8 @@ module.exports = {
},
cookieDomain: 'yohoblk.com',
domains: {
api: 'http://devapi.yoho.cn:58078/', // devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
service: 'http://devservice.yoho.cn:58077/', // testservice.yoho.cn:28077 devservice.yoho.cn:58077
api: 'http://dev-api.yohops.com:9999/', // devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
service: 'http://dev-service.yohops.com:9999/', // testservice.yoho.cn:28077 devservice.yoho.cn:58077
search: 'http://192.168.102.216:8080/yohosearch/'
},
useOneapm: false,
... ...
... ... @@ -45,3 +45,14 @@ $category.click(function() {
}, 200);
return false;
});
$('.brand-tabs').each(function() {
var tab;
if ($(this).find('li').length === 0) {
tab = $(this).siblings('dt').text();
$(this).parent('dl').hide();
$('.category-nav').find('.' + tab).hide();
}
});
... ...
... ... @@ -185,3 +185,11 @@ $('#comment-info').trigger('keyup');
if (tag === 0) {
$('.article-tag').hide();
}
if ($('.collocation').find('.good-info').length === 0) {
$('.related-collo').hide();
}
if ($('.goods').find('.good-info').length === 0) {
$('.related-group').hide();
}
... ...
var lazyload = require('yoho-jquery-lazyload');
var Dialog = require('../plugins/dialog').Dialog;
var tplFn = require('../../tpl/product/shop-goods.hbs');
require('../common/header');
... ... @@ -16,6 +17,11 @@ $(function() {
var total = parseInt($('.total-page', $order).text(), 10);
var page = 1;
var orderBy;
var infoDaialog = new Dialog({
className: 'brand-info-dialog',
content: $('.brand-info-wrapper').html(),
keep: true
});
function refreshProducts(data) {
$('.cur-page', $order).text(page);
... ... @@ -35,8 +41,9 @@ $(function() {
$($nextPage).click(function() {
if (!$(this).hasClass('disable') && page < total) {
page += 1;
$.get('/product/shop/query/all', {
page: page++,
page: page,
shopId: shopId
}, function(data) {
refreshProducts(data);
... ... @@ -46,8 +53,9 @@ $(function() {
$($prePage).click(function() {
if (!$(this).hasClass('disable') && page > 1) {
page -= 1;
$.get('/product/shop/query/all', {
page: page--,
page: page,
shopId: shopId
}, function(data) {
refreshProducts(data);
... ... @@ -88,5 +96,12 @@ $(function() {
refreshProducts(data);
});
});
$('#brand-info').click(function() {
infoDaialog.show();
$('.brand-info').addClass('nano');
$('.brand-info').nanoScroller();
});
});
... ...
... ... @@ -126,6 +126,9 @@
line-height: 60px;
text-align: center;
font-size: 16px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
}
}
... ...
div.blk-pagination {
width: 500px;
padding: 0;
text-align: center;
a {
display: inline-block;
... ...
... ... @@ -101,18 +101,35 @@
.related-goods {
padding-top: 60px;
}
.goods-info {
width: 219px;
margin-right: 0;
float: left;
margin-right: 20px;
img {
.good-info {
width: 219px;
height: 295px;
float: left;
margin: 0 20px 15px 0;
img {
width: 219px;
height: 295px;
}
.name {
font-size: 12px;
line-height: 30px;
height: 30px;
overflow: hidden;
display: block;
text-overflow: ellipsis;
white-space: nowrap;
}
.price {
display: block;
line-height: 30px;
height: 30px;
text-align: center;
}
}
}
.related-brand {
... ... @@ -431,7 +448,23 @@
}
}
.blk-pagination {
width: 400px;
.good-info {
width: 219px;
margin-right: 0;
float: left;
margin-right: 20px;
img {
width: 219px;
height: 295px;
}
.name {
font-size: 12px;
line-height: 30px;
height: 30px;
overflow: hidden;
display: block;
}
}
}
... ...
.editorial-index-page {
.msg-nav {
height: 40px;
.nav-title {
margin-top: 35px;
font-size: 14px;
font-weight: 700;
border-bottom: 1px solid #eee;
padding-left: 300px;
padding-bottom: 5px;
overflow: hidden;
li {
float: left;
height: 30px;
width: 120px;
line-height: 40px;
text-align: center;
font-size: 14px;
display: list-item;
list-style-type: none;
color: #999;
a {
display: block;
height: 100%;
width: 100%;
text-decoration: none;
color: #999;
}
width: 100%;
height: 30px;
&.active {
a {
color: #000;
}
}
b {
font-size: 18px;
margin-right: 5px;
}
}
... ... @@ -44,4 +24,5 @@
@import "msg";
@import "list";
@import "detail";
@import "related-goods";
@import "article-related";
... ...
... ... @@ -11,6 +11,7 @@
line-height: 30px;
text-align: center;
border-bottom: 1px solid #bbb;
color: #a0a0a0;
}
.msg-right {
... ... @@ -74,7 +75,6 @@
}
.like-comment {
margin-left: 40px;
color: #a6a6a6;
cursor: pointer;
font-size: 14px;
... ...
.good-info {
width: 219px;
margin-right: 0;
float: left;
margin-right: 20px;
img {
width: 219px;
height: 295px;
}
.name {
font-size: 12px;
line-height: 30px;
height: 30px;
overflow: hidden;
display: block;
}
}
... ...
... ... @@ -42,6 +42,9 @@
font-weight: 700;
margin-left: 10px;
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 200px;
}
.input-radio label.round-color {
margin-left: 0;
... ... @@ -281,6 +284,9 @@
.goods-brand {
font-weight: 700;
padding: 10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.goods-img {
... ...
... ... @@ -113,7 +113,7 @@
margin: 25px 10px;
border-width: 1px;
.name {
.desc {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
... ...
... ... @@ -5,7 +5,7 @@
</a>
<div class="desc">
<a class="name" href="{{this.url}}" target="_blank">{{productName}}</a>
<p class="price">{{salesPrice}}</p>
<p class="price">¥{{salesPrice}}</p>
</div>
</div>
{{/each}}
... ...