Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
zhangxiaoru
9 years ago
Commit
3540f99d89db15ce1301e1f25afcdd9213f1be8b
2 parents
16d15c67
416205d2
brand
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
334 additions
and
147 deletions
apps/channel/views/partial/ad-banner.hbs
apps/channel/views/partial/ad.hbs
apps/channel/views/partial/brand-img-box.hbs
apps/channel/views/partial/brand-text-box.hbs
apps/channel/views/partial/new-arrival.hbs
apps/passport/models/login-auth-service.js
apps/product/controllers/item.js
apps/product/controllers/list.js
apps/product/models/helpers.js
apps/product/models/item-api.js
apps/product/models/item-handler.js
apps/product/models/item.js
apps/product/models/resouces.js
apps/product/models/shop-service.js
apps/product/views/action/newList.hbs
apps/product/views/action/shop-index.hbs
apps/product/views/partial/brand-banner.hbs
apps/product/views/partial/list/shop-menu.hbs
apps/product/views/partial/list/shop-sort.hbs
config/common.js
doraemon/views/partial/nav-menu.hbs
public/js/product/shop.page.js
public/scss/channel/_ad.css
public/scss/channel/_brand-img-box.css
public/scss/channel/_brand-text-box.css
public/scss/channel/_home.css
public/scss/channel/_new-arrival.css
public/scss/product/_brand-banner.css
public/scss/product/_list.css
public/scss/product/_shop.css
public/tpl/product/shop-goods.hbs
apps/channel/views/partial/ad-banner.hbs
View file @
3540f99
<div
class=
"ad-banner"
>
{{#
adBanner
}}
<a
href=
"
{{
url
}}
"
>
<a
href=
"
{{
url
}}
"
target=
"_blank"
>
<img
class=
"lazy-img"
data-original=
"
{{
image
src
1150
160
}}
"
title=
"
{{
title
}}
"
alt=
"
{{
alt
}}
"
>
</a>
{{/
adBanner
}}
...
...
apps/channel/views/partial/ad.hbs
View file @
3540f99
<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>
...
...
apps/channel/views/partial/brand-img-box.hbs
View file @
3540f99
...
...
@@ -2,10 +2,10 @@
<div
class=
"brand-img-box
{{#if
right
}}
right
{{/if}}
{{#if
bottomSpace
}}
mb10
{{/if}}
"
>
<a
href=
"
{{
url
}}
"
>
{{#
big
}}
<img
class=
"big-img lazy-img"
data-original=
"
{{
image
src
5
56
333
}}
"
alt=
"big-img"
>
<img
class=
"big-img lazy-img"
data-original=
"
{{
image
src
5
65
340
}}
"
alt=
"big-img"
>
{{/
big
}}
{{#
small
}}
<img
class=
"small-img lazy-img
{{#if
@first
}}
first
{{/if}}
"
data-original=
"
{{
image
src
28
3
283
}}
"
alt=
"big-img"
>
<img
class=
"small-img lazy-img
{{#if
@first
}}
first
{{/if}}
"
data-original=
"
{{
image
src
28
1
285
}}
"
alt=
"big-img"
>
{{/
small
}}
</a>
</div>
...
...
apps/channel/views/partial/brand-text-box.hbs
View file @
3540f99
<div
class=
"brand-text-box"
>
<h4>
{{
productName
}}
</h4>
<p>
{{
productDesc
}}
</p>
<a
href=
"
{{
url
}}
"
>
<a
href=
"
{{
url
}}
"
target=
"_blank"
>
<button>
{{
btnText
}}
</button>
</a>
</div>
...
...
apps/channel/views/partial/new-arrival.hbs
View file @
3540f99
...
...
@@ -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>
...
...
apps/passport/models/login-auth-service.js
View file @
3540f99
...
...
@@ -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
);
...
...
apps/product/controllers/item.js
View file @
3540f99
...
...
@@ -19,6 +19,7 @@ const index = (req, res, next) => {
return
next
();
}
result
.
page
=
'item'
;
result
.
title
+=
`
|
$
{
res
.
locals
.
title
}
`
;
res
.
display
(
'item'
,
result
);
}).
catch
(
next
);
};
...
...
apps/product/controllers/list.js
View file @
3540f99
...
...
@@ -17,7 +17,7 @@ const list = {
// 列表页
index
:
(
req
,
res
,
next
)
=>
{
let
q
=
req
.
query
;
let
channel
=
req
.
cookies
.
_Channel
||
'men'
;
let
channel
=
req
.
cookies
.
_Channel
||
req
.
query
.
_Channel
||
'men'
;
q
.
page
=
parseInt
(
q
.
page
||
1
,
10
);
q
.
order
=
q
.
order
||
's_n_desc'
;
...
...
@@ -69,9 +69,11 @@ const list = {
// 新品到着
newPage
:
(
req
,
res
,
next
)
=>
{
let
q
=
req
.
query
;
let
channel
=
req
.
cookies
.
_Channel
||
req
.
query
.
_Channel
||
'men'
;
q
.
page
=
parseInt
(
q
.
page
||
1
,
10
);
q
.
order
=
q
.
order
||
's_n_desc'
;
q
.
channel
=
channel
;
let
retData
=
{
module
:
'product'
,
...
...
@@ -79,44 +81,45 @@ const list = {
title
:
'新品'
};
Promise
.
all
([
Resouces
.
newProductBanner
(),
Search
.
queryAllSort
(),
Search
.
queryNewProduct
(
q
)]).
then
(
result
=>
{
let
banner
=
result
[
0
];
let
sortData
=
camelCase
(
result
[
1
]);
let
listData
=
result
[
2
];
let
nav
=
[
DataHelper
.
getChannelNav
(),
{
name
:
'新品'
}];
retData
.
banner
=
banner
;
if
(
listData
&&
listData
.
code
===
200
&&
listData
.
data
)
{
let
data
=
camelCase
(
listData
.
data
);
if
(
data
.
filter
)
{
data
.
filter
.
groupSort
=
DataHelper
.
sortConvert
(
sortData
.
data
.
sort
);
retData
.
filter
=
DataHelper
.
filterHandle
(
data
.
filter
,
q
);
retData
.
filter
.
showPrice
=
data
.
total
>
10
;
Promise
.
all
([
Resouces
.
newProductBanner
(
channel
),
Search
.
queryAllSort
(),
Search
.
queryNewProduct
(
q
)]).
then
(
result
=>
{
let
banner
=
result
[
0
];
let
sortData
=
camelCase
(
result
[
1
]);
let
listData
=
result
[
2
];
let
nav
=
[
DataHelper
.
getChannelNav
(),
{
name
:
'新品'
}];
retData
.
banner
=
banner
;
if
(
listData
&&
listData
.
code
===
200
&&
listData
.
data
)
{
let
data
=
camelCase
(
listData
.
data
);
if
(
data
.
filter
)
{
data
.
filter
.
groupSort
=
DataHelper
.
sortConvert
(
sortData
.
data
.
sort
);
retData
.
filter
=
DataHelper
.
filterHandle
(
data
.
filter
,
q
);
retData
.
filter
.
showPrice
=
data
.
total
>
10
;
}
retData
.
navPath
=
{
nav
:
nav
};
retData
.
paginationData
=
{
page
:
q
.
page
,
limit
:
data
.
limit
||
45
,
total
:
data
.
total
,
pageTotal
:
data
.
pageTotal
,
queryParams
:
q
};
res
.
display
(
'newList'
,
_
.
assign
(
retData
,
{
products
:
DataHelper
.
handleProductList
(
data
.
productList
,
q
),
order
:
q
.
order
}));
}
else
{
return
Promise
.
reject
(
'query product error'
);
}
retData
.
navPath
=
{
nav
:
nav
};
retData
.
paginationData
=
{
page
:
q
.
page
,
limit
:
data
.
limit
||
45
,
total
:
data
.
total
,
pageTotal
:
data
.
pageTotal
,
queryParams
:
q
};
res
.
display
(
'newList'
,
_
.
assign
(
retData
,
{
products
:
DataHelper
.
handleProductList
(
data
.
productList
,
q
),
order
:
q
.
order
}));
}
else
{
return
Promise
.
reject
(
'query product error'
);
}
}).
catch
(
next
);
}).
catch
(
next
);
}
};
...
...
apps/product/models/helpers.js
View file @
3540f99
...
...
@@ -51,7 +51,7 @@ const helpers = {
let
other
=
false
;
_
.
forEach
(
brands
,
(
b
)
=>
{
let
name
=
b
.
brandNameEn
||
b
.
brandName
;
let
name
=
b
.
brand
Alif
||
b
.
brand
NameEn
||
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
;
...
...
apps/product/models/item-api.js
View file @
3540f99
...
...
@@ -93,10 +93,27 @@ const getModelTryAsync = skn => {
});
};
/**
* 获取品牌Banner API
* @function getBrandBannerAsync
* @param { number } brandId 品牌id
* @return { Object } banner信息
*/
const
getBrandBannerAsync
=
brandId
=>
{
return
api
.
get
(
''
,
{
method
:
'web.brand.banner'
,
brand_id
:
brandId
},
{
cache
:
true
,
code
:
200
});
};
module
.
exports
=
{
getProductBaseAsync
,
// 获取商品基本信息
getUserIsFav
,
// 获取商品用户收藏信息
getsizeInfoAsync
,
// 获取商品尺码信息
getComfortAsync
,
// 获取商品材质信息
getModelTryAsync
// 获取商品模特试穿信息
getModelTryAsync
,
// 获取商品模特试穿信息
getBrandBannerAsync
// 获取品牌Banner信息
};
...
...
apps/product/models/item-handler.js
View file @
3540f99
...
...
@@ -9,6 +9,23 @@ const _ = require('lodash');
const
helpers
=
global
.
yoho
.
helpers
;
/**
* 获取原图片路径
* @function _getForceSourceUrl
* @param { String } url 图片路径
* @return { String } 原图片路径
*/
const
_getForceSourceUrl
=
(
url
)
=>
{
const
str
=
[
'?imageView'
,
'?imageMogr2'
];
_
.
forEach
(
str
,
value
=>
{
url
=
_
.
split
(
url
,
value
,
1
)[
0
];
});
url
.
replace
(
'http:'
,
''
);
return
url
;
};
/**
* 使sizeBoList id以 sizeAttributeBos id顺序一样
* @function _sizeInfoBoSort
* @param { Object } sizeInfoBo 尺码数据对象
...
...
@@ -152,7 +169,7 @@ const setSeoInfo = (goodInfo, nav) => {
sortName
=
_
.
get
(
nav
,
'[1].name'
,
''
);
return
{
title
:
`
$
{
brandName
}
$
{
sortName
}
|
$
{
goodInfo
.
name
}
正品`
,
title
:
`
$
{
brandName
}
$
{
sortName
}
|
$
{
goodInfo
.
name
}
正品`
,
keywords
:
`
$
{
brandName
}
$
{
sortName
},
$
{
brandName
}
正品官网专卖店
,
$
{
brandName
}
官方授权店
,
$
{
brandName
}
正品
,
`
+
`
$
{
brandName
}
打折
,
$
{
brandName
}
折扣店
,
$
{
brandName
}
真品
,
$
{
brandName
}
代购`
,
description
:
_
.
get
(
goodInfo
,
'share.shareDesc'
,
goodInfo
.
name
)
...
...
@@ -232,22 +249,64 @@ const setPathNav = (data, name, channel) => {
* @param { Object } brand 品牌相关数据
* @return { Object } 品牌banner
*/
const
setBrandBanner
=
brand
=>
{
let
data
=
{
brandId
:
brand
.
id
,
bgColor
:
'#000'
,
brandLogo
:
{
link
:
`
/
product
/
shop
/
$
{
brand
.
brandDomain
}
`
,
// 品牌跳转链接 -- 待处理
img
:
brand
.
brandIco
},
brandHome
:
{
link
:
`
/
product
/
shop
/
$
{
brand
.
brandDomain
}
`
// 品牌跳转链接 -- 待处理
const
setBrandBanner
=
(
base
,
brand
,
shop
)
=>
{
let
resData
=
{},
banner
=
{};
if
(
base
.
brand
)
{
let
info
=
base
.
brand
;
// 基础品牌数据
banner
=
{
brandId
:
info
.
id
,
bgColor
:
'#000'
,
brandLogo
:
{
link
:
`
/
product
/
shop
/
$
{
info
.
brandDomain
}
`
,
// 品牌跳转链接
img
:
info
.
brandIco
},
brandHome
:
{
link
:
`
/
product
/
shop
/
$
{
info
.
brandDomain
}
`
// 品牌跳转链接
}
};
// 品牌banner数据
if
(
brand
)
{
if
(
brand
.
colorValue
)
{
banner
.
bgColor
=
brand
.
colorValue
;
}
if
(
brand
.
bannerUrl
)
{
banner
.
bgImg
=
brand
.
bannerUrl
;
}
if
(
brand
.
logo
)
{
_
.
set
(
banner
,
'brandLogo.img'
,
_getForceSourceUrl
(
brand
.
logo
));
}
}
}
;
}
return
{
brandBanner
:
data
};
switch
(
_
.
toNumber
(
shop
.
type
))
{
case
1
:
// 多品店不显示
banner
=
{};
break
;
case
2
:
// 单品店显示新版的店铺banner
_
.
forEach
(
shop
.
list
,
value
=>
{
if
(
value
.
resource_name
===
'shopTopBanner'
)
{
banner
.
bgImg
=
_
.
get
(
JSON
.
parse
(
value
.
resource_data
),
'detailSrc'
,
false
);
}
});
break
;
default
:
break
;
}
if
(
!
_
.
isEmpty
(
banner
))
{
resData
.
brandBanner
=
banner
;
}
return
resData
;
};
/**
...
...
apps/product/models/item.js
View file @
3540f99
...
...
@@ -8,6 +8,7 @@
const
_
=
require
(
'lodash'
);
const
itemApi
=
require
(
'./item-api'
);
const
brandApi
=
require
(
'./brand-api'
);
const
shopApi
=
require
(
'./shop-api'
);
const
itemFun
=
require
(
'./item-handler'
);
const
search
=
require
(
'./search-api'
);
...
...
@@ -20,31 +21,55 @@ const search = require('./search-api');
* @return { Object } 返回单个商品品牌、材质、尺码、描述、详情等信息
*/
const
_getMultiResourceByBaseInfo
=
(
base
)
=>
{
let
productId
=
base
.
id
;
let
skn
=
base
.
erpProductId
;
let
brandId
=
base
.
brand
.
id
?
base
.
brand
.
id
:
0
;
const
productId
=
base
.
id
;
const
skn
=
base
.
erpProductId
;
const
brandId
=
base
.
brandId
||
0
;
const
brandDomain
=
_
.
get
(
base
,
'brand.brandDomain'
,
false
);
const
shopId
=
base
.
shopId
||
0
;
let
apiIndex
=
{};
// 获取相关数据
let
promiseData
=
[
itemApi
.
getsizeInfoAsync
(
skn
),
itemApi
.
getComfortAsync
(
productId
),
itemApi
.
getModelTryAsync
(
skn
),
search
.
getSortAsync
({
sort
:
base
.
smallSortId
})
search
.
getSortAsync
({
sort
:
base
.
smallSortId
}),
itemApi
.
getBrandBannerAsync
(
brandId
)
];
if
(
base
.
uid
)
{
apiIndex
.
productFav
=
promiseData
.
length
;
promiseData
.
push
(
itemApi
.
getUserIsFav
(
base
.
uid
,
productId
));
apiIndex
.
brandFav
=
promiseData
.
length
;
promiseData
.
push
(
brandApi
.
getBrandInfo
(
brandId
,
base
.
uid
));
}
// 根据品牌名获取店铺信息
if
(
brandDomain
)
{
apiIndex
.
domainInfo
=
promiseData
.
length
;
promiseData
.
push
(
brandApi
.
getDomainInfo
(
brandDomain
));
}
// 根据店铺ID获取店铺装修信息
if
(
shopId
)
{
apiIndex
.
shopDecorator
=
promiseData
.
length
;
promiseData
.
push
(
shopApi
.
getShopDecorator
(
shopId
));
}
return
Promise
.
all
(
promiseData
).
then
(
result
=>
{
return
{
sizeInfo
:
result
[
0
],
comfort
:
result
[
1
].
data
,
modelTry
:
result
[
2
].
data
,
sort
:
result
[
3
].
data
,
productFav
:
(
result
[
4
]
&&
result
[
4
].
data
),
brandFav
:
(
result
[
5
]
&&
result
[
5
].
data
&&
result
[
5
].
data
.
is_favorite
===
'Y'
)
brandBanner
:
result
[
4
].
data
,
productFav
:
(
result
[
apiIndex
.
productFav
]
&&
result
[
apiIndex
.
productFav
].
data
),
brandFav
:
(
_
.
get
(
result
[
apiIndex
.
brandFav
],
'data.is_favorite'
,
'N'
)
===
'Y'
),
shopInfo
:
Object
.
assign
(
{},
{
type
:
_
.
get
(
result
[
apiIndex
.
domainInfo
],
'data.type'
,
0
)},
{
list
:
_
.
get
(
result
[
apiIndex
.
shopDecorator
],
'data.list'
,
[])}
)
};
});
};
...
...
@@ -78,27 +103,28 @@ const getProductItemData = (params, url, uid) => {
// 商品基本信息
data
.
goodInfo
=
itemFun
.
setProductData
(
result
);
// BRAND品牌简介
if
(
result
.
brand
)
{
Object
.
assign
(
data
,
itemFun
.
setBrandBanner
(
result
.
brand
),
// banner
itemFun
.
setBrandIntro
(
result
.
brand
)
// BRAND品牌简介
);
Object
.
assign
(
data
,
itemFun
.
setBrandIntro
(
result
.
brand
));
}
return
_getMultiResourceByBaseInfo
(
result
).
then
(
mulRes
=>
{
// 收藏状态
_
.
set
(
data
,
'brandBanner.brandFav'
,
mulRes
.
brandFav
);
_
.
set
(
data
,
'goodInfo.productFav'
,
mulRes
.
productFav
);
Object
.
assign
(
data
,
itemFun
.
setBrandBanner
(
result
,
mulRes
.
brandBanner
,
mulRes
.
shopInfo
),
// banner
itemFun
.
setPathNav
(
mulRes
.
sort
,
result
.
productName
,
params
.
channel
),
// 面包屑导航
itemFun
.
setDescriptionData
(
mulRes
.
sizeInfo
,
mulRes
.
comfort
),
// DESCRIPTION商品描述
itemFun
.
setMaterialData
(
mulRes
.
sizeInfo
),
// MATERIALS材料洗涤
itemFun
.
setSizeData
(
mulRes
.
sizeInfo
,
mulRes
.
modelTry
),
// SIZEINFO尺码信息
itemFun
.
setDetailData
(
mulRes
.
sizeInfo
)
// DETAILS商品详情
);
// 收藏状态
_
.
set
(
data
,
'goodInfo.productFav'
,
mulRes
.
productFav
);
if
(
data
.
brandBanner
)
{
_
.
set
(
data
,
'brandBanner.brandFav'
,
mulRes
.
brandFav
);
}
resData
.
content
=
data
;
// 商品详情SEO
...
...
apps/product/models/resouces.js
View file @
3540f99
...
...
@@ -14,10 +14,16 @@ const Resources = {
* 获取新品到着-列表页-banner 资源位
* @returns {Promise.<T>}
*/
newProductBanner
()
{
newProductBanner
(
channel
)
{
let
codes
=
{
men
:
'3d3127b220073fbcda738c8ba26561e5'
,
women
:
'2aaf9519b31d1f21c537032f496e7450'
,
lifestyle
:
'422bfdb9b410598e11c3e72bd4ee664e'
};
let
params
=
{
content_code
:
'a7989369aa86681c678bc40f171b8f1d'
content_code
:
codes
[
channel
]
};
return
api
.
get
(
'/operations/api/v5/resource/get'
,
params
).
then
(
result
=>
{
...
...
apps/product/models/shop-service.js
View file @
3540f99
...
...
@@ -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: ''}
,
{
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: ''}
,
{
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
.
detail
Src
;
// eslint-disable-line
info
.
banner
=
resources
.
shopTopBanner
.
shop
Src
;
// 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
);
...
...
apps/product/views/action/newList.hbs
View file @
3540f99
...
...
@@ -16,10 +16,10 @@
</div>
<div
class=
"right"
>
{{!-- 新品banner --}}
{{#
banner
}}
{{#
if
banner
.
src
}}
<div
class=
"banner-img"
style=
"height: 200px;margin-bottom:30px; background:url(
{{
image
src
850
200
2
}}
) no-repeat top center;"
></div>
{{/
banner
}}
style=
"height: 200px;margin-bottom:30px; background:url(
{{
image
banner
.
src
850
200
2
}}
) no-repeat top center;"
></div>
{{/if}}
{{!-- 已选中条件 --}}
{{#
filter
}}
{{>
list
/
filter-area
}}
...
...
apps/product/views/action/shop-index.hbs
View file @
3540f99
...
...
@@ -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>
...
...
apps/product/views/partial/brand-banner.hbs
View file @
3540f99
...
...
@@ -5,7 +5,7 @@
<div
class=
"center-content clearfix"
>
{{#
brandLogo
}}
<a
href=
"
{{
link
}}
"
class=
"brand-logo"
>
<img
src=
"
{{
image
img
108
4
4
}}
"
>
<img
src=
"
{{
image
img
108
4
5
}}
"
>
</a>
{{/
brandLogo
}}
<p
class=
"opt right"
>
...
...
apps/product/views/partial/list/shop-menu.hbs
View file @
3540f99
...
...
@@ -3,7 +3,7 @@
<ul
class=
"shop-menu"
>
{{#
each
menus
}}
<li>
<a
href=
"
{{
href
}}
"
>
<a
href=
"
{{
url
}}
"
>
{{
name
}}
{{#
icon
}}
<i
class=
"iconfont"
>

</i>
...
...
apps/product/views/partial/list/shop-sort.hbs
View file @
3540f99
<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
}}
"
>
{{
category
Name
}}
</a></div>
<div><a
href=
"
{{
@root
.
mores
.
all
.
url
}}
?misort=
{{
sortId
}}
"
>
{{
sort
Name
}}
</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>
...
...
config/common.js
View file @
3540f99
...
...
@@ -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
:
{
...
...
doraemon/views/partial/nav-menu.hbs
View file @
3540f99
...
...
@@ -5,7 +5,7 @@
<ul
class=
"main-nav-list"
>
{{#
navbars
}}
<li
class=
"nav-item
{{#if
cur
}}
cur
{{/if}}
"
>
<a
href=
"
{{
link
}}
"
>
<a
href=
"
{{
link
}}
"
{{#if
isNewPage
}}
target=
"_blank"
{{/if}}
>
<span
class=
"nav-en"
>
{{
en
}}
</span>
<span
class=
"nav-cn"
>
{{
cn
}}
</span>
</a>
...
...
public/js/product/shop.page.js
View file @
3540f99
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
();
});
});
...
...
public/scss/channel/_ad.css
View file @
3540f99
...
...
@@ -18,7 +18,7 @@
img
{
float
:
left
;
width
:
50%
;
width
:
298px
;
height
:
100%
;
box-sizing
:
border-box
;
padding
:
25px
;
...
...
public/scss/channel/_brand-img-box.css
View file @
3540f99
.brand-img-box
{
width
:
56
6
px
;
width
:
56
5
px
;
box-sizing
:
border-box
;
display
:
inline-block
;
...
...
@@ -17,14 +17,14 @@
.big-img
{
width
:
100%
;
height
:
3
33
px
;
height
:
3
40
px
;
}
.small-img
{
width
:
50%
;
height
:
283px
;
width
:
281px
;
height
:
285px
;
display
:
inline-block
;
box-sizing
:
border
-box
;
box-sizing
:
content
-box
;
border
:
1px
solid
$
grayBorder
;
border-top
:
none
;
...
...
public/scss/channel/_brand-text-box.css
View file @
3540f99
...
...
@@ -5,7 +5,7 @@
float
:
left
;
height
:
100%
;
width
:
50%
;
width
:
275px
;
box-sizing
:
border-box
;
padding
:
34px
0
;
position
:
relative
;
...
...
public/scss/channel/_home.css
View file @
3540f99
.home-page
{
$
sliderHeight
:
57
0px
;
$
sliderHeight
:
60
0px
;
margin
:
10px
auto
0
;
...
...
public/scss/channel/_new-arrival.css
View file @
3540f99
...
...
@@ -12,7 +12,7 @@
}
.arrival-item
{
width
:
32
5
px
;
width
:
32
7
px
;
display
:
inline-block
;
.brand-name
{
...
...
@@ -48,7 +48,7 @@
&
.normal
{
float
:
left
;
margin-right
:
18
px
;
margin-right
:
20
px
;
}
&
.last
{
...
...
@@ -56,7 +56,7 @@
}
&
.small-img
{
width
:
2
23
px
;
width
:
2
18
px
;
}
}
}
...
...
public/scss/product/_brand-banner.css
View file @
3540f99
...
...
@@ -2,18 +2,17 @@
position
:
relative
;
.banner-img
{
min-height
:
4
4
px
;
min-height
:
4
5
px
;
}
.opt-wrap
{
width
:
100%
;
height
:
4
4
px
;
height
:
4
5
px
;
position
:
absolute
;
top
:
50%
;
margin-top
:
-2
2
px
;
margin-top
:
-2
3
px
;
.brand-logo
{
width
:
108px
;
display
:
inline-block
;
}
...
...
public/scss/product/_list.css
View file @
3540f99
...
...
@@ -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
{
...
...
public/scss/product/_shop.css
View file @
3540f99
...
...
@@ -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
;
}
}
...
...
public/tpl/product/shop-goods.hbs
View file @
3540f99
...
...
@@ -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
}}
...
...
Please
register
or
login
to post a comment