Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yyq
8 years ago
Commit
e341f25da6dbb51b93350dca8378105dadb61134
1 parent
9f572bbc
套餐结算页
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
89 additions
and
53 deletions
apps/product/controllers/list.js
apps/product/models/list.js
apps/product/models/search-api.js
apps/product/router.js
doraemon/views/partial/product/left-content.hbs
public/js/product/index/product.js
public/js/product/shop.page.js
public/scss/product/_left-content.css
apps/product/controllers/list.js
View file @
e341f25
...
...
@@ -25,7 +25,7 @@ const shop = (shopId, req, res, next, brandInfo) => {
let
pjax
=
params
.
_pjax
;
// 比较品牌域名与店铺域名是否一致,不一致跳转至店铺域名
if
(
!
pjax
&&
shopInfo
.
domain
&&
domain
&&
domain
!==
shopInfo
.
domain
)
{
if
(
!
pjax
&&
shopInfo
.
domain
&&
domain
&&
domain
!==
_
.
toLower
(
shopInfo
.
domain
)
)
{
res
.
redirect
(
helpers
.
urlFormat
(
''
,
params
,
shopInfo
.
domain
));
return
;
}
...
...
@@ -236,7 +236,7 @@ exports.getNodeContent = (req, res, next) => {
*/
exports
.
getAdnav
=
(
req
,
res
,
next
)
=>
{
if
(
!
req
.
xhr
||
!
req
.
body
.
brandId
)
{
if
(
!
req
.
xhr
)
{
return
next
();
}
...
...
apps/product/models/list.js
View file @
e341f25
...
...
@@ -19,6 +19,9 @@ const needParams = ['query', 'msort', 'misort', 'gender', 'shelveTime'];
// 品牌页folder名称
const
brandFolderSeries
=
'经典系列'
;
// 经典店铺list url
const
shopListUrl
=
'/product/shoplist'
;
// 搜索分类信息需要的参数
const
positionId
=
10
;
...
...
@@ -291,6 +294,7 @@ const getBrandData = (params, extra, channel) => {
brand
:
{
brandBanner
:
searchHandler
.
handleBrandBanner
(
extra
),
leftContent
:
{},
brandShopAd
:
true
,
node
:
extra
.
node
||
''
}
};
...
...
@@ -477,7 +481,7 @@ const getNodeContentData = (params) => {
*/
const
getAdnav
=
(
params
)
=>
{
return
Promise
.
all
([
searchApi
.
getBrand
Folder
(
params
),
searchApi
.
getBrand
Series
(
params
)]).
then
(
result
=>
{
return
Promise
.
all
([
searchApi
.
getBrand
ShopFolder
(
params
),
searchApi
.
getBrandShop
Series
(
params
)]).
then
(
result
=>
{
let
dest
=
{
picTitle
:
''
,
...
...
@@ -656,6 +660,8 @@ const getShopData = (shopId, channel, params, shopInfo) => {
finalResult
.
leftContent
=
searchHandler
.
handleSortData
(
groupSort
,
params
,
params
,
'/product/shoplist'
);
_
.
set
(
finalResult
,
'brandShopAd'
,
{
baseUrl
:
shopListUrl
});
if
(
finalResult
.
allGoods
)
{
Object
.
assign
(
finalResult
.
allGoods
,
searchHandler
.
setShopSort
(
groupSort
,
Object
.
assign
({},
params
,
{
page
:
1
})),
searchHandler
.
setGenderFilter
(
params
));
...
...
apps/product/models/search-api.js
View file @
e341f25
...
...
@@ -196,14 +196,21 @@ const getSortAds = (params) => {
* 获取品牌系列
* @return
*/
const
getBrandSeries
=
(
params
)
=>
{
const
getBrandShopSeries
=
(
params
)
=>
{
let
finalParams
=
{
method
:
'web.brand.series'
,
brand_id
:
params
.
brandId
,
status
:
params
.
status
||
1
};
if
(
params
.
brandId
)
{
finalParams
.
brand_id
=
params
.
brandId
;
}
else
if
(
params
.
shopId
)
{
Object
.
assign
(
finalParams
,
{
method
:
'web.shop.series'
,
shop_id
:
params
.
shopId
});
}
return
api
.
get
(
''
,
finalParams
,
config
.
apiCache
);
};
...
...
@@ -211,14 +218,21 @@ const getBrandSeries = (params) => {
* 获取品牌folder
* @return
*/
const
getBrandFolder
=
(
params
)
=>
{
const
getBrandShopFolder
=
(
params
)
=>
{
let
finalParams
=
{
method
:
'web.brand.folder'
,
brand_id
:
params
.
brandId
,
status
:
params
.
status
||
1
};
if
(
params
.
brandId
)
{
finalParams
.
brand_id
=
params
.
brandId
;
}
else
if
(
params
.
shopId
)
{
Object
.
assign
(
finalParams
,
{
method
:
'web.shop.folder'
,
shop_id
:
params
.
shopId
});
}
return
api
.
get
(
''
,
finalParams
,
config
.
apiCache
);
};
...
...
@@ -540,8 +554,8 @@ module.exports = {
getSortList
,
getSortIntro
,
getSortAds
,
getBrandFolder
,
getBrandSeries
,
getBrandShopFolder
,
getBrandShopSeries
,
getWeekNew
,
getBrandShop
,
getSuggest
,
...
...
apps/product/router.js
View file @
e341f25
...
...
@@ -66,35 +66,25 @@ router.get('/index/isfav', favorite.isFavoriteBrand);// 品牌收藏状态
// 搜索
router
.
get
(
'/search/index'
,
search
.
index
);
router
.
get
(
'/search/filter/brands'
,
search
.
serachFilterBrands
);
// 搜索提示
router
.
get
(
'/search/suggest'
,
search
.
suggest
);
router
.
get
(
'/search/suggest'
,
search
.
suggest
);
// 搜索提示
router
.
get
(
'/api/suggest'
,
search
.
suggest4Old
);
// 商品分类列表页
router
.
get
(
'/list/index'
,
list
.
index
);
// 新品到着
router
.
get
(
'/list/new'
,
list
.
new
);
// 品牌页
router
.
get
(
'/index/brand'
,
list
.
brand
);
router
.
get
(
'/index/about'
,
list
.
brandAbout
);
// 品牌店铺
router
.
get
(
'/index/brand'
,
list
.
brand
);
// 品牌店铺页
router
.
get
(
'/index/about'
,
list
.
brandAbout
);
// 品牌店铺介绍页
router
.
post
(
'/index/isFavoriteBrand'
,
list
.
isFavoriteBrand
);
// 判断用户是否收藏品牌
router
.
post
(
'/index/getNodeContent'
,
list
.
getNodeContent
);
// 品牌页水牌
router
.
post
(
'/index/getAdnav'
,
list
.
getAdnav
);
// 品牌页系列
router
.
get
(
'/shoplist'
,
list
.
shopList
);
// 店铺列表页
router
.
post
(
'/shop/togglecollect'
,
favorite
.
collectShop
);
// 店铺收藏
router
.
post
(
'/index/isFavoriteShop'
,
favorite
.
isFavShop
);
// 判断用户是否收藏品牌
// 品牌页水牌
router
.
post
(
'/index/getNodeContent'
,
list
.
getNodeContent
);
// 品牌页系列
router
.
post
(
'/index/getAdnav'
,
list
.
getAdnav
);
// 判断用户是否收藏品牌
router
.
post
(
'/index/isFavoriteBrand'
,
list
.
isFavoriteBrand
);
// 学生优惠routers
router
.
get
(
'/students'
,
students
.
index
);
// students 首页
...
...
doraemon/views/partial/product/left-content.hbs
View file @
e341f25
...
...
@@ -87,25 +87,25 @@
{{/
picLink
}}
{{/
leftContent
}}
{{#
if
brandBanner
.
dataI
d
}}
{{#
brandShopA
d
}}
<script
id=
"pic-link-tpl"
type=
"text/html"
>
\{{# picLink}}
\{{# picLink}}
\{{#if picTitle}}
<h2 class="nav-pic-title">\{{picTitle}}</h2>
<h2 class="nav-pic-title">\{{picTitle}}</h2>
\{{/if}}
<ul class="pic-nav">
\{{#each list}}
<li>
<a href="\{{href}}">
<img src="\{{src}}">
</a>
</li>
\{{/each}}
</ul>
\{{
/
picLink
}}
<ul class="pic-nav">
\{{#each list}}
<li>
<a href="\{{href}}">
<img src="
{{
baseUrl
}}
\{{src}}">
</a>
</li>
\{{/each}}
</ul>
\{{
/
picLink
}}
</script>
<div
id=
"brand-ad"
class=
"brand-ad"
></div>
{{/if}}
<div
id=
"brand-shop-ad"
class=
"brand-shop-ad"
></div>
{{/
brandShopAd
}}
{{!-- 水牌广告 --}}
{{#if
node
}}
...
...
public/js/product/index/product.js
View file @
e341f25
...
...
@@ -188,9 +188,10 @@ $productListNav.find('h3').click(function() {
// 左侧需要ajax内容
(
function
()
{
var
$brandCard
=
$
(
'#brand-card'
);
var
$brandFavor
=
$
(
'#brand-favor'
);
var
html
;
var
$brandCard
=
$
(
'#brand-card'
),
$brandFavor
=
$
(
'#brand-favor'
),
$shopFavor
=
$
(
'#shop-favor'
);
var
html
,
adData
;
if
(
$brandCard
.
length
)
{
$
.
ajax
({
...
...
@@ -204,19 +205,26 @@ $productListNav.find('h3').click(function() {
});
}
// 品牌页请求
if
(
$brandFavor
.
length
)
{
adData
=
{
brandId
:
$brandFavor
.
data
(
'id'
)};
}
if
(
$shopFavor
.
length
)
{
adData
=
{
shopId
:
$shopFavor
.
data
(
'id'
)};
}
// 款型系列异步请求
if
(
adData
)
{
html
=
$
(
'#pic-link-tpl'
).
html
()
||
''
;
$
.
ajax
({
type
:
'POST'
,
url
:
'/product/index/getAdnav'
,
data
:
{
brandId
:
$brandFavor
.
data
(
'id'
)
}
data
:
adData
}).
then
(
function
(
data
)
{
if
(
data
)
{
$
(
'#brand-ad'
).
html
(
Handlebars
.
compile
(
html
)({
$
(
'#brand-
shop-
ad'
).
html
(
Handlebars
.
compile
(
html
)({
picLink
:
data
}));
}
...
...
public/js/product/shop.page.js
View file @
e341f25
...
...
@@ -5,7 +5,8 @@
*/
var
$
=
require
(
'yoho-jquery'
),
lazyLoad
=
require
(
'yoho-jquery-lazyload'
);
lazyLoad
=
require
(
'yoho-jquery-lazyload'
),
Handlebars
=
require
(
'yoho-handlebars'
);
var
product
=
require
(
'./index/product'
);
...
...
@@ -74,6 +75,23 @@ $('.shop-query-submit').on('click', function() {
$searchForm
.
submit
();
});
(
function
()
{
var
$adBox
=
$
(
'#brand-shop-ad'
);
var
html
=
$
(
'#pic-link-tpl'
).
html
()
||
''
;
$
.
ajax
({
type
:
'POST'
,
url
:
'/product/index/getAdnav'
,
data
:
{
shopId
:
shopId
}
}).
then
(
function
(
data
)
{
if
(
data
)
{
$adBox
.
parent
().
append
(
$adBox
);
$adBox
.
html
(
Handlebars
.
compile
(
html
)({
picLink
:
data
}));
}
});
}());
// 收藏店铺
function
colloectAction
()
{
...
...
public/scss/product/_left-content.css
View file @
e341f25
...
...
@@ -118,7 +118,7 @@
}
.brand-card
img
,
.brand-ad
img
{
.brand-
shop-
ad
img
{
max-width
:
100%
;
}
...
...
Please
register
or
login
to post a comment