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
biao
9 years ago
Commit
0691b88b89370eea412011c970b2056a6dfede00
2 parents
71f9c647
1ea34225
Merge branch 'release/1.0' of
http://git.yoho.cn/fe/yoho-blk
into release/1.0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
41 deletions
apps/brand/controllers/brand.js
apps/brand/models/brand.js
apps/editorial/models/editorial.js
apps/product/controllers/list.js
apps/product/models/helpers.js
public/js/product/list/list-search.js
apps/brand/controllers/brand.js
View file @
0691b88
...
...
@@ -16,14 +16,14 @@ const index = (req, res, next) => {
let
channel
=
req
.
cookies
.
_Channel
||
'men'
;
let
contentCode
=
''
;
if
(
channel
===
'women'
)
{
if
(
channel
===
'women'
)
{
contentCode
=
'527079e6c46d0f125eb46b835968971b'
;
}
else
if
(
channel
===
'lifestyle'
){
}
else
if
(
channel
===
'lifestyle'
)
{
contentCode
=
'94b5ed607b6d565ffc29c2c04be121dc'
;
}
else
{
contentCode
=
'81886aaa5e82e3741bc1ba1e04ec7706'
;
}
let
appType
=
1
;
brand
.
getListData
(
contentCode
,
channel
,
appType
).
then
((
result
)
=>
{
...
...
apps/brand/models/brand.js
View file @
0691b88
...
...
@@ -27,7 +27,7 @@ const _processListData = (list) => {
let
listKey
=
[];
_
.
forEach
(
list
.
data
.
allList
,
function
(
value
,
index
)
{
_
.
forEach
(
value
,
function
(
data
)
{
data
.
brandDomain
=
`
$
{
config
.
siteUrl
}
/product/
shop
/
$
{
data
.
brandDomain
}
`
;
});
...
...
@@ -35,20 +35,20 @@ const _processListData = (list) => {
if
(
index
===
'0~9'
)
{
index
=
'0-9'
;
}
else
{
listKey
.
push
(
index
)
listKey
.
push
(
index
)
;
}
});
listKey
.
sort
();
listKey
.
push
(
'0-9'
);
_
.
forEach
(
listKey
,
function
(
key
)
{
listData
.
push
({
key
:
key
,
brands
:
list
.
data
.
allList
[
key
]
});
});
});
return
listData
;
};
...
...
apps/editorial/models/editorial.js
View file @
0691b88
...
...
@@ -73,6 +73,7 @@ const _processListData = (list) => {
});
listData
.
tabs
=
list
.
list
.
artList
;
// console.log(listData)
return
listData
;
...
...
@@ -276,7 +277,8 @@ const _getRelatedData = () => {
if
(
result
&&
result
.
code
===
200
)
{
_
.
forEach
(
result
.
data
.
product_list
,
function
(
data
)
{
console
.
log
(
data
.
product_name
)
console
.
log
(
data
.
product_name
);
// productList.push({
// name: data.product_name,
// price: data.sales_price,
...
...
@@ -285,7 +287,7 @@ const _getRelatedData = () => {
// });
});
console
.
log
(
productList
)
console
.
log
(
productList
)
;
return
productList
;
}
else
{
logger
.
error
(
'推荐商品 cood 不是 200'
);
...
...
@@ -335,11 +337,13 @@ const _processContentData = (list) => {
_
.
forEach
(
value
.
goods
.
data
,
function
(
data
)
{
idList
+=
data
.
id
+
','
;
// idList = '51152761';
formatData
.
push
(
data
);
});
}
//console.log(idList)
// console.log(idList)
if
(
value
.
goodsGroup
)
{
...
...
@@ -354,10 +358,11 @@ const _processContentData = (list) => {
// });
}
});
// console.log(idList)
_getRelatedData
().
then
((
result
)
=>
{
//console.log(result)
//
console.log(result)
_
.
forEach
(
formatData
,
function
(
data
,
index
)
{
// console.log(formatData)
...
...
apps/product/controllers/list.js
View file @
0691b88
...
...
@@ -17,9 +17,11 @@ const list = {
// 列表页
index
:
(
req
,
res
,
next
)
=>
{
let
q
=
req
.
query
;
let
channel
=
req
.
cookies
.
_Channel
||
'men'
;
q
.
page
=
parseInt
(
q
.
page
||
1
,
10
);
q
.
order
=
q
.
order
||
's_n_desc'
;
q
.
channel
=
channel
;
let
retData
=
{
module
:
'product'
,
...
...
@@ -33,7 +35,7 @@ const list = {
if
(
result
&&
result
.
code
===
200
&&
result
.
data
)
{
let
data
=
camelCase
(
result
.
data
);
let
nav
=
[
DataHelper
.
getChannelNav
()];
let
nav
=
[
DataHelper
.
getChannelNav
(
channel
)];
if
(
data
.
filter
)
{
data
.
filter
.
groupSort
=
DataHelper
.
sortConvert
(
allSort
.
data
.
sort
);
...
...
apps/product/models/helpers.js
View file @
0691b88
...
...
@@ -121,12 +121,26 @@ const helpers = {
* 根据频道获取导航栏
* @returns {{link: string, pathTitle: string, name: string}}
*/
getChannelNav
()
{
return
{
link
:
'#'
,
pathTitle
:
''
,
name
:
'MEN首页'
};
getChannelNav
(
channel
)
{
if
(
channel
===
'women'
)
{
return
{
link
:
'/women'
,
pathTitle
:
''
,
name
:
'WOMEN首页'
};
}
else
if
(
channel
===
'lifestyle'
)
{
return
{
link
:
'/lifestyle'
,
pathTitle
:
''
,
name
:
'LIFESTYLE首页'
};
}
else
{
return
{
link
:
'/'
,
pathTitle
:
''
,
name
:
'MEN首页'
};
}
},
/**
...
...
public/js/product/list/list-search.js
View file @
0691b88
...
...
@@ -20,8 +20,25 @@ var YohoListPage = {
require
(
'../../common/return-top'
);
require
(
'../../common/header'
);
lazyload
();
$
(
'.nano'
).
nanoScroller
();
YohoListPage
.
initAccordion
();
$
(
'.nano'
).
nanoScroller
({
disableResize
:
true
});
$
(
'.yoho-ui-accordion'
,
this
.
rootDoc
).
each
(
function
()
{
var
opts
=
{
collapsible
:
true
,
heightStyle
:
'content'
,
fillSpace
:
true
,
active
:
0
};
if
(
$
(
this
).
hasClass
(
'no-active'
))
{
opts
.
active
=
false
;
}
$
(
this
).
find
(
'h3'
).
each
(
function
(
index
)
{
if
(
$
(
this
).
hasClass
(
'active'
))
{
opts
.
active
=
index
;
}
});
$
(
this
).
accordion
(
opts
);
});
$
(
'.sex-body .input-radio'
,
this
.
rootDoc
).
check
({
type
:
'radio'
,
...
...
@@ -116,29 +133,8 @@ var YohoListPage = {
YohoListPage
.
eventBind
();
},
initAccordion
:
function
()
{
$
(
'.yoho-ui-accordion'
,
this
.
rootDoc
).
each
(
function
()
{
var
opts
=
{
collapsible
:
true
,
heightStyle
:
'content'
,
active
:
0
};
if
(
$
(
this
).
hasClass
(
'no-active'
))
{
opts
.
active
=
false
;
}
$
(
this
).
find
(
'h3'
).
each
(
function
(
index
)
{
if
(
$
(
this
).
hasClass
(
'active'
))
{
opts
.
active
=
index
;
}
});
$
(
this
).
accordion
(
opts
);
});
},
eventBind
:
function
()
{
$
(
window
).
resize
(
function
()
{
YohoListPage
.
initAccordion
();
});
$
(
'.mulit-choose'
,
this
.
rootDoc
).
click
(
function
()
{
YohoListPage
.
openBrandMulitChoose
();
});
...
...
Please
register
or
login
to post a comment