Authored by yyq

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

... ... @@ -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>
... ...
<div class="ad-container clearfix">
{{# brandsAd}}
<div class="ad {{#if @first}}first{{/if}}">
<a href="{{url}}">
<img class="lazy-img" data-original="{{image src 240 240}}" alt="">
<a href="{{url}}" target="_blank">
<img class="lazy-img" data-original="{{image src 298 298}}" alt="">
</a>
{{> brand-text-box}}
</div>
... ...
<div class="brand-text-box">
<h4>{{productName}}</h4>
<p>{{productDesc}}</p>
<a href="{{url}}">
<a href="{{url}}" target="_blank">
<button>{{btnText}}</button>
</a>
</div>
... ...
... ... @@ -4,8 +4,8 @@
{{# newArrivals}}
<div class="arrival-item {{#if smallImg}}small-img{{/if}} {{#if @last}}last{{^}}normal{{/if}}">
{{#if even}}
<a href="{{url}}">
<img class="lazy-img" data-original="{{#if smallImg}}{{image src 223 490}}{{^}}{{image src 325 490}}{{/if}}" alt="{{alt}}">
<a href="{{url}}" target="_blank">
<img class="lazy-img" data-original="{{#if smallImg}}{{image src 218 490}}{{^}}{{image src 327 490}}{{/if}}" alt="{{alt}}">
</a>
<div class="brand-name">
<a href="{{url}}">
... ... @@ -18,8 +18,8 @@
<span class="top">{{title}}</span>
</a>
</div>
<a href="{{url}}">
<img class="lazy-img" data-original="{{#if smallImg}}{{image src 223 490}}{{^}}{{image src 325 490}}{{/if}}" alt="{{alt}}">
<a href="{{url}}" target="_blank">
<img class="lazy-img" data-original="{{#if smallImg}}{{image src 218 490}}{{^}}{{image src 327 490}}{{/if}}" alt="{{alt}}">
</a>
{{/if}}
</div>
... ...
... ... @@ -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,7 +240,23 @@ 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;
} else if (sorts && sorts.length > 1) {
_.forEach(sorts, s => {
_.forEach(s.sub, ss => {
if (q.misort && q.misort === ss.categoryId) {
ss.checked = true;
s.checked = true;
}
});
});
}
let matchPrice = false;
... ...
... ... @@ -12,6 +12,7 @@ const co = Promise.coroutine;
const camelCase = global.yoho.camelCase;
const BrandService = require('./brand-service');
const ShopApi = require('./shop-api');
const Search = require('../models/search');
const _ = require('lodash');
/**
... ... @@ -19,14 +20,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;
}
... ... @@ -86,19 +91,27 @@ const ShopService = {
* 获取店铺二级分类
* @param shopId
*/
getShopSecondSorts(shopId) {
getShopSecondSorts(brandId, shopId) {
return co(function*() {
let data = yield ShopApi.getShopSorts(shopId);
if (data && data.code === 200) {
let sorts = camelCase(data.data);
let data = yield Search.queryAllSort({
brand: brandId,
shop: shopId,
small_sort: 0
});
let sortArray = [];
if (data && data.data) {
let sorts = camelCase(data.data.sort);
sorts.forEach(s => {
sortArray = sortArray.concat(s.sub);
});
return sorts.sort((a, b) => {
return a.sub.length >= b.sub.length;
sortArray = sortArray.sort((s1, s2) => {
return s2.count - s1.count;
});
} else {
return [];
}
return sortArray;
})();
},
... ... @@ -126,7 +139,7 @@ const ShopService = {
info.isFavorite = shopIntro.isFavorite === 'Y';
let shopData = yield Promise.all([ShopService.getShopDecorator(shopId),
ShopService.getShopSecondSorts(shopId)]);
ShopService.getShopSecondSorts(domainInfo.id, shopId)]);
let shopList = shopData[0];
let sorts = shopData[1];
let resources = resourceDataHandle(shopList.list);
... ... @@ -134,10 +147,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);
... ...
... ... @@ -36,13 +36,13 @@
<div class="floor-header clearfix">
<h2 class="floor-title en-size">NEW ARRIVALS</h2>
<p class="floor-title zh-size">最新上架</p>
<a class="floor-more" href="{{@root.mores.new.href}}">MORE</a>
<a class="floor-more" href="{{@root.mores.new.url}}">MORE</a>
</div>
<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">
... ... @@ -60,15 +60,16 @@
<div class="floor-header clearfix">
<h2 class="floor-title en-size">HOT</h2>
<p class="floor-title zh-size">人气单品</p>
<a class="floor-more" href="{{@root.mores.hot.href}}">MORE</a>
<a class="floor-more" href="{{@root.mores.hot.url}}">MORE</a>
</div>
<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-cover"></div>
<div class="desc">
<a class="name" href="" target="_blank">{{productName}}</a>
<p class="price">¥{{round salesPrice 2}}</p>
... ...
... ... @@ -3,7 +3,7 @@
<ul class="shop-menu">
{{#each menus}}
<li>
<a href="{{href}}">
<a href="{{url}}">
{{name}}
{{#icon}}
<i class="iconfont">&#xe60a;</i>
... ...
<div class="shop-sort">
<div class="all">所有商品</div>
<div class="sort-list">
<div><a href="{{@root.mores.all.href}}?gender=2,3">女装</a></div>
<div><a href="{{@root.mores.all.href}}?gender=1,3">男装</a></div>
<div><a href="{{@root.mores.all.url}}?gender=2,3">女装</a></div>
<div><a href="{{@root.mores.all.url}}?gender=1,3">男装</a></div>
{{# each banner.sorts}}
<div><a href="{{@root.mores.all.href}}?sort={{relationParameter.sort}}">{{categoryName}}</a></div>
<div><a href="{{@root.mores.all.url}}?misort={{sortId}}">{{sortName}}</a></div>
{{/ each}}
</div>
<div class="more"><a href="{{@root.mores.all.href}}">MORE</a></div>
<div class="more"><a href="{{@root.mores.all.url}}">MORE</a></div>
</div>
... ...
... ... @@ -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,
... ... @@ -61,9 +61,21 @@ module.exports = {
}
},
thirdLogin: {
wechat: {
appID: 'wx3ae21dcbb82ad672',
appSecret: 'e78afb2321e6a19085767e1a0f0d52c1'
wechat: { // OK
appID: 'wx179ea6ff85adc828',
appSecret: '19533c8674c1382aa9869bf5bc8d2fe7'
},
qq: { // OK
appID: '100229394',
appSecret: 'c0af9c29e0900813028c2ccb42021792'
},
alipay: { // OK
partnerID: '2088701661478015',
appSecret: 'e3i54meghrac3qhryzhw1h5yzeijik7e'
},
sina: { // 还未申请
appID: '3739328910',
appSecret: '9d44cded26d048e23089e5e975c93df1'
}
},
pay: {
... ...
... ... @@ -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();
}
});
... ...
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;
}
}
}
... ...
... ... @@ -18,7 +18,7 @@
img {
float: left;
width: 50%;
width: 298px;
height: 100%;
box-sizing: border-box;
padding: 25px;
... ...
.brand-img-box {
width: 566px;
width: 565px;
box-sizing: border-box;
display: inline-block;
... ... @@ -17,12 +17,12 @@
.big-img {
width: 100%;
height: 333px;
height: 340px;
}
.small-img {
width: 50%;
height: 283px;
height: 285px;
display: inline-block;
box-sizing: border-box;
border: 1px solid $grayBorder;
... ...
... ... @@ -5,7 +5,7 @@
float: left;
height: 100%;
width: 50%;
width: 275px;
box-sizing: border-box;
padding: 34px 0;
position: relative;
... ...
.home-page {
$sliderHeight: 570px;
$sliderHeight: 600px;
margin: 10px auto 0;
... ...
... ... @@ -12,7 +12,7 @@
}
.arrival-item {
width: 325px;
width: 327px;
display: inline-block;
.brand-name {
... ... @@ -48,7 +48,7 @@
&.normal {
float: left;
margin-right: 18px;
margin-right: 20px;
}
&.last {
... ... @@ -56,7 +56,7 @@
}
&.small-img {
width: 223px;
width: 218px;
}
}
}
... ...
... ... @@ -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;
... ... @@ -131,17 +131,30 @@
display: inline-block;
width: 369px;
height: 495px;
margin: 0 9px;
margin: 10px 9px;
border-width: 1px;
.desc {
img {
height: 495px;
}
.desc-cover {
position: absolute;
bottom: 0;
width: 100%;
background-color: #000;
opacity: 0.6;
padding: 20px 0;
opacity: 0.2;
height: 100px;
z-index: 1;
}
.desc {
position: absolute;
bottom: 0;
width: 100%;
padding: 17px 0;
color: #fff;
z-index: 2;
}
}
... ...
... ... @@ -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}}
... ...