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
Plain Diff
Browse Files
Authored by
刘传洋
9 years ago
Commit
9d2617047d9226a7adb2ed2151bd11a8b12ee819
2 parents
901475cb
dd025e1a
merge camelcase
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
221 additions
and
309 deletions
apps/passport/auth.js
apps/passport/controllers/login.js
apps/product/controllers/detail.js
apps/product/controllers/outlets.js
apps/product/controllers/sale.js
apps/product/models/detail-service.js
apps/product/models/outlets-handler.js
apps/product/models/sale.js
apps/product/models/students-handler.js
apps/product/models/students.js
doraemon/models/header.js
doraemon/views/partial/footer.hbs
doraemon/views/partial/header.hbs
doraemon/views/partial/product/good.hbs
package.json
public/dist/yohobuy-node/assets/img/sprite.passport.png
public/img/layout/ebsIcon.png
public/js/home/QRcode.page.js
public/js/passport/back-index.page.js
public/js/passport/back-reset-pwd.page.js
public/js/passport/back-reset-success.js
public/js/passport/back-send-email-ok.page.js
public/js/passport/back-verify-mobile-code.page.js
public/js/passport/bind-success.page.js
public/js/passport/bind.page.js
public/js/passport/login.page.js
public/js/passport/noregist.page.js
public/js/passport/reg.page.js
public/js/passport/relate.page.js
public/js/product/detail.page.js
public/scss/common/_footer.css
utils/product-process.js
utils/resources-process.js
apps/passport/auth.js
View file @
9d26170
...
...
@@ -52,12 +52,6 @@ passport.use('local', new LocalStrategy({
return
done
({
message
:
'登录账号格式错误'
},
null
);
}
let
expire
=
req
.
cookies
[
'LE'
+
md5
(
'_LOGIN_EXPIRE'
)];
if
(
_
.
isEmpty
(
expire
)
||
expire
<
(
new
Date
()).
getTime
()
/
1000
)
{
return
done
({
message
:
'页面停留时间过长,请刷新页面'
},
null
);
}
let
verifyCode
=
req
.
body
.
captcha
;
if
(
verifyCode
&&
verifyCode
!==
req
.
session
.
captcha
)
{
...
...
apps/passport/controllers/login.js
View file @
9d26170
...
...
@@ -102,14 +102,6 @@ const common = {
const
local
=
{
loginPage
:
(
req
,
res
)
=>
{
// 先清除cookie
res
.
clearCookie
(
'LE'
+
md5
(
'_LOGIN_EXPIRE'
),
{
domain
:
'yohobuy.com'
});
// 设置登录有效时间30分钟, 防机器刷,cache不稳定,改为cookie
res
.
cookie
(
'LE'
+
md5
(
'_LOGIN_EXPIRE'
),
(
new
Date
()).
getTime
()
/
1000
+
1800
);
// 清除cookie
res
.
clearCookie
(
'_UID'
,
{
domain
:
'yohobuy.com'
...
...
apps/product/controllers/detail.js
View file @
9d26170
...
...
@@ -14,7 +14,6 @@ const detailHelper = require(`${mRoot}/detail-helper`);
const
Actions
=
require
(
'./lib/actions'
);
const
YohoAction
=
require
(
'./lib/yoho-action'
);
const
moment
=
require
(
'moment'
);
const
camelCase
=
global
.
yoho
.
camelCase
;
const
DEFAULT_AVATAR_ICO
=
'http://static.yohobuy.com/images/v3/boy.jpg'
;
const
_
=
require
(
'lodash'
);
...
...
@@ -94,7 +93,7 @@ class CommentAction extends YohoAction {
this
.
response
.
json
({
code
:
result
.
code
,
data
:
camelCase
(
_
.
get
(
pageResponse
,
'list'
,
[])
).
map
((
item
)
=>
{
data
:
_
.
get
(
pageResponse
,
'list'
,
[]
).
map
((
item
)
=>
{
return
{
avatar
:
_
.
get
(
item
,
'userInfo.headIco'
,
''
)
?
...
...
@@ -102,8 +101,8 @@ class CommentAction extends YohoAction {
DEFAULT_AVATAR_ICO
,
userName
:
_
.
get
(
item
,
'userInfo.nickName'
,
''
),
date
:
moment
(
item
.
createTime
,
'X'
).
format
(
'YYYY-MM-DD HH:mm:ss'
),
color
:
_
.
get
(
item
,
'goods.colorName'
,
''
),
size
:
_
.
get
(
item
,
'goods.sizeName'
,
''
),
color
:
_
.
get
(
item
,
'goods.color_name'
,
''
),
size
:
_
.
get
(
item
,
'goods.size_name'
,
''
),
comment
:
item
.
content
,
total
:
pageResponse
.
totalCount
};
...
...
apps/product/controllers/outlets.js
View file @
9d26170
...
...
@@ -17,18 +17,14 @@ const _ = require('lodash');
* @return {[type]} [description]
*/
exports
.
index
=
(
req
,
res
,
next
)
=>
{
let
resData
=
{
module
:
'product'
,
page
:
'outlets'
};
let
channel
=
req
.
query
.
channel
||
req
.
cookies
.
_Channel
||
'otltIdxDflt'
;
outlets
.
getOutletsIndexData
(
req
.
query
,
channel
).
then
(
result
=>
{
Object
.
assign
(
resData
,
result
);
res
.
render
(
'outlets/index'
,
resData
);
outlets
.
getOutletsIndexData
(
req
.
query
,
channel
).
then
((
result
)
=>
{
res
.
render
(
'outlets/index'
,
Object
.
assign
({
module
:
'product'
,
page
:
'outlets'
},
result
));
}).
catch
(
next
);
};
/**
...
...
@@ -38,14 +34,13 @@ exports.index = (req, res, next) => {
* @return {[type]} [description]
*/
exports
.
channel
=
(
req
,
res
,
next
)
=>
{
let
resData
=
{
module
:
'product'
,
page
:
'outlets'
};
let
channel
=
req
.
params
.
channel
||
req
.
query
.
channel
||
req
.
cookies
.
_Channel
||
'boys'
;
outlets
.
getOutletsChannelData
(
req
.
query
,
channel
).
then
(
result
=>
{
res
.
render
(
'outlets/channel'
,
Object
.
assign
(
resData
,
result
));
outlets
.
getOutletsChannelData
(
req
.
query
,
channel
).
then
((
result
)
=>
{
res
.
render
(
'outlets/channel'
,
Object
.
assign
({
module
:
'product'
,
page
:
'outlets'
},
result
));
}).
catch
(
next
);
};
...
...
@@ -58,10 +53,6 @@ exports.channel = (req, res, next) => {
exports
.
special
=
(
req
,
res
,
next
)
=>
{
let
params
=
req
.
query
;
let
channel
=
req
.
query
.
channel
||
req
.
cookies
.
_Channel
||
'boys'
;
let
resData
=
{
module
:
'product'
,
page
:
'outlets'
};
// 判断活动id是否合法
if
(
!
params
.
id
||
!+
params
.
id
||
!
_
.
isNumber
(
+
params
.
id
))
{
...
...
@@ -69,7 +60,10 @@ exports.special = (req, res, next) => {
}
outlets
.
getOutletsSpecialData
(
params
,
channel
).
then
(
result
=>
{
res
.
render
(
'outlets/special'
,
Object
.
assign
(
resData
,
result
));
res
.
render
(
'outlets/special'
,
Object
.
assign
({
module
:
'product'
,
page
:
'outlets'
},
result
));
}).
catch
(
next
);
};
...
...
@@ -81,18 +75,15 @@ exports.special = (req, res, next) => {
*/
exports
.
list
=
(
req
,
res
,
next
)
=>
{
let
params
=
req
.
query
;
let
channel
=
req
.
query
.
channel
||
req
.
cookies
.
_Channel
||
'boys'
;
params
.
uid
=
req
.
user
.
uid
||
0
;
let
responseData
=
{
module
:
'product'
,
page
:
'outlets'
};
outlets
.
getOutletsCategoryData
(
params
,
channel
).
then
((
result
)
=>
{
res
.
render
(
'sale/other'
,
Object
.
assign
(
responseData
,
result
));
res
.
render
(
'sale/other'
,
Object
.
assign
({
module
:
'product'
,
page
:
'outlets'
},
result
));
}).
catch
(
next
);
};
...
...
apps/product/controllers/sale.js
View file @
9d26170
...
...
@@ -18,20 +18,16 @@ const sale = require(`${mRoot}/sale`); // sale 页 model
exports
.
index
=
(
req
,
res
,
next
)
=>
{
let
channel
=
req
.
query
.
channel
||
req
.
cookies
.
_Channel
||
'boys'
;
let
responseData
=
{
module
:
'product'
,
page
:
'sale'
};
// 真实数据输出
sale
.
getSaleIndexData
(
channel
).
then
(
result
=>
{
responseData
.
result
=
result
;
if
(
result
)
{
responseData
.
headerData
=
result
.
headerData
;
}
res
.
render
(
'sale/index'
,
responseData
);
res
.
render
(
'sale/index'
,
Object
.
assign
({
module
:
'product'
,
page
:
'sale'
},
{
result
:
result
,
headerData
:
result
.
headerData
}));
}).
catch
(
next
);
};
/**
...
...
@@ -76,17 +72,14 @@ exports.vip = (req, res, next) => {
params
.
uid
=
req
.
user
.
uid
||
0
;
let
responseData
=
{
module
:
'product'
,
page
:
'sale'
};
sale
.
getSaleOthersData
(
params
,
channel
).
then
((
result
)
=>
{
responseData
.
saleList
=
result
;
if
(
result
)
{
responseData
.
headerData
=
result
.
headerData
;
}
res
.
render
(
'sale/other'
,
responseData
);
res
.
render
(
'sale/other'
,
Object
.
assign
({
module
:
'product'
,
page
:
'sale'
},
{
saleList
:
result
,
headerData
:
result
.
headerData
}));
}).
catch
(
next
);
};
...
...
@@ -104,17 +97,14 @@ exports.newSale = (req, res, next) => {
let
channel
=
req
.
query
.
channel
||
req
.
cookies
.
_Channel
||
'boys'
;
let
responseData
=
{
module
:
'product'
,
page
:
'sale'
};
sale
.
getSaleOthersData
(
params
,
channel
).
then
((
result
)
=>
{
responseData
.
saleList
=
result
;
if
(
result
)
{
responseData
.
headerData
=
result
.
headerData
;
}
res
.
render
(
'sale/other'
,
responseData
);
res
.
render
(
'sale/other'
,
Object
.
assign
({
module
:
'product'
,
page
:
'sale'
},
{
saleList
:
result
,
headerData
:
result
.
headerData
}));
}).
catch
(
next
);
};
...
...
@@ -176,7 +166,7 @@ exports.getGoodsList = (req, res, next) => {
params
.
uid
=
req
.
user
.
uid
||
0
;
return
sale
.
getSaleGoodsData
(
params
).
then
(
result
=>
{
sale
.
getSaleGoodsData
(
params
).
then
(
result
=>
{
let
responseData
=
{};
responseData
.
footerTop
=
false
;
...
...
apps/product/models/detail-service.js
View file @
9d26170
...
...
@@ -896,8 +896,6 @@ const _sizeInfoBoSort = (sizeInfoBo) => {
return
{};
}
// TODO: 这里的排序代码很乱
_
.
get
(
sizeInfoBo
,
'sizeBoList'
,
[]).
forEach
((
sizeBoList
,
sizek
)
=>
{
let
sortAttr
=
{};
...
...
apps/product/models/outlets-handler.js
View file @
9d26170
...
...
@@ -8,7 +8,6 @@
const
utils
=
'../../../utils'
;
const
helpers
=
global
.
yoho
.
helpers
;
const
_
=
require
(
'lodash'
);
const
camelCase
=
global
.
yoho
.
camelCase
;
const
productProcess
=
require
(
`
$
{
utils
}
/product-process`
)
;
const
url
=
require
(
'url'
);
const
queryString
=
require
(
'querystring'
);
...
...
@@ -110,15 +109,14 @@ const categoryNavigation = (data, params) => {
* @return {[array]}
*/
exports
.
processFloor
=
(
list
,
params
)
=>
{
const
formatData
=
[]
;
const
formatData
=
{}
;
let
floorData
;
list
=
list
||
[];
list
=
camelCase
(
list
);
// 格式化数据
_
.
forEach
(
list
,
(
floor
)
=>
{
switch
(
floor
.
template
N
ame
)
{
switch
(
floor
.
template
_n
ame
)
{
case
'NL2R'
:
floorData
=
{
topBanner
:
floor
.
data
};
break
;
...
...
apps/product/models/sale.js
View file @
9d26170
...
...
@@ -6,9 +6,9 @@
*/
'use strict'
;
const
logger
=
global
.
yoho
.
logger
;
const
camelCase
=
global
.
yoho
.
camelCase
;
const
utils
=
'../../../utils'
;
const
api
=
global
.
yoho
.
API
;
const
Promise
=
require
(
'bluebird'
);
const
saleApi
=
require
(
'./sale-api'
);
const
searchApi
=
require
(
'./search-api'
);
const
publicHandler
=
require
(
'./public-handler'
);
...
...
@@ -75,37 +75,31 @@ exports.getSaleGoodsData = (params) => {
delete
finalResult
.
goods
[
key
].
tags
.
isSale
;
// 屏蔽 sale 标签
delete
finalResult
.
goods
[
key
].
discount
;
// 屏蔽折扣信息
});
}
else
{
logger
.
error
(
'search sale api code no 200'
);
}
// 处理 VIP 商品数据
if
(
result
[
1
].
code
===
200
)
{
let
userInfo
=
result
[
1
].
data
.
vip_info
?
camelCase
(
result
[
1
].
data
.
vip_info
)
:
{};
if
(
_
.
isEmpty
(
userInfo
))
{
logger
.
info
(
'no user info'
);
}
let
vipInfo
=
_
.
get
(
result
,
'[1].data.vip_info'
,
{});
if
(
params
.
saleType
===
'2'
)
{
_
.
forEach
(
finalResult
.
goods
,
(
value
,
key
)
=>
{
switch
(
userInfo
.
curL
evel
)
{
switch
(
vipInfo
.
cur_l
evel
)
{
case
'1'
:
finalResult
.
goods
[
key
].
sales
Price
=
value
.
vip1P
rice
;
finalResult
.
goods
[
key
].
sales
_price
=
value
.
vip1_p
rice
;
finalResult
.
goods
[
key
].
vip1
=
true
;
break
;
case
'2'
:
finalResult
.
goods
[
key
].
sales
Price
=
value
.
vip2P
rice
;
finalResult
.
goods
[
key
].
sales
_price
=
value
.
vip2_p
rice
;
finalResult
.
goods
[
key
].
vip2
=
true
;
break
;
case
'3'
:
finalResult
.
goods
[
key
].
sales
Price
=
value
.
vip3P
rice
;
finalResult
.
goods
[
key
].
sales
_price
=
value
.
vip3_p
rice
;
finalResult
.
goods
[
key
].
vip3
=
true
;
break
;
default
:
finalResult
.
goods
[
key
].
vip
=
true
;
delete
finalResult
.
goods
[
key
].
sales
P
rice
;
delete
finalResult
.
goods
[
key
].
sales
_p
rice
;
break
;
}
...
...
@@ -168,16 +162,12 @@ exports.getSaleIndexData = (channel) => {
if
(
result
[
1
].
data
.
length
>
0
)
{
finalResult
.
brandSale
=
saleHandler
.
handleSaleActivityData
(
result
[
1
].
data
,
channel
);
}
}
else
{
logger
.
error
(
'discount activities api code no 200'
);
}
// 资源位数据处理
if
(
result
[
2
].
code
===
200
&&
!
_
.
isEmpty
(
result
[
2
].
data
))
{
finalResult
.
topBanner
=
saleHandler
.
handleSaleBannerData
(
result
[
2
].
data
);
finalResult
.
activityEnter
=
saleHandler
.
handleSaleBannerSmallData
(
result
[
2
].
data
);
}
else
{
logger
.
error
(
'content code api code no 200 or no data'
);
}
// 分类处理
...
...
@@ -192,21 +182,21 @@ exports.getSaleIndexData = (channel) => {
{
forVip
:
true
}
)
);
}
else
{
logger
.
error
(
'index vip category api code no 200'
);
}
// 断码区分类处理
if
(
result
[
4
].
code
===
200
)
{
let
breakingSizeSort
=
saleHandler
.
handleSaleBreakingSizeData
(
result
[
4
].
data
);
return
api
.
all
([
saleApi
.
getSaleGoodsList
({
channel
:
channel
,
saleType
:
'5'
,
// app 与 pc 有冲突,为 PC 加一个 5 的选项
limit
:
'1'
,
breakSize
:
breakingSizeSort
.
breakSize
,
breakSort
:
breakingSizeSort
.
breakSort
})]).
then
(
subResult
=>
{
return
api
.
all
([
saleApi
.
getSaleGoodsList
({
channel
:
channel
,
saleType
:
'5'
,
// app 与 pc 有冲突,为 PC 加一个 5 的选项
limit
:
'1'
,
breakSize
:
breakingSizeSort
.
breakSize
,
breakSort
:
breakingSizeSort
.
breakSort
})
]).
then
(
subResult
=>
{
if
(
subResult
[
0
].
code
===
200
)
{
finalResult
.
saleCategory
.
push
(
saleHandler
.
handleSaleCategoryData
(
...
...
@@ -224,14 +214,10 @@ exports.getSaleIndexData = (channel) => {
finalResult
.
saleCategory
.
push
(
saleHandler
.
handleSaleCategoryData
(
result
[
5
].
data
.
filter
.
group_sort
,
'3'
,
channel
)
);
}
else
{
logger
.
error
(
'newSale category api code no 200'
);
}
return
finalResult
;
});
}
else
{
logger
.
error
(
'breakYards category api code no 200'
);
}
return
finalResult
;
});
...
...
@@ -275,8 +261,6 @@ exports.getSaleOthersData = (params, channel) => {
if
(
!
_
.
isEmpty
(
result
[
1
].
data
.
filter
))
{
// 顶部筛选条件
finalResult
.
filters
=
publicHandler
.
handleSaleFilterData
(
result
[
1
].
data
.
filter
,
params
);
}
else
{
logger
.
error
(
'data filter is empty'
);
}
// 处理排序数据
...
...
@@ -291,12 +275,10 @@ exports.getSaleOthersData = (params, channel) => {
};
_
.
forEach
(
finalResult
.
goods
,
(
value
,
key
)
=>
{
delete
finalResult
.
goods
[
key
].
tags
.
isNew
;
// 屏蔽 new 标签
delete
finalResult
.
goods
[
key
].
tags
.
isSale
;
// 屏蔽 sale 标签
delete
finalResult
.
goods
[
key
].
tags
.
is_new
;
// 屏蔽 new 标签
delete
finalResult
.
goods
[
key
].
tags
.
is_sale
;
// 屏蔽 sale 标签
delete
finalResult
.
goods
[
key
].
discount
;
// 屏蔽折扣信息
});
}
else
{
logger
.
error
(
'goods list api code no 200'
);
}
// 获取焦点图数据
...
...
@@ -307,8 +289,6 @@ exports.getSaleOthersData = (params, channel) => {
delete
finalResult
.
topBanner
.
list
[
key
].
href
;
});
}
}
else
{
logger
.
error
(
'content code api code no 200'
);
}
// 获取分类筛选数据
...
...
@@ -317,46 +297,36 @@ exports.getSaleOthersData = (params, channel) => {
// 获取左侧类目数据
finalResult
.
leftContent
=
publicHandler
.
handleSaleSortData
(
result
[
3
].
data
.
filter
.
group_sort
,
params
);
}
else
{
logger
.
error
(
'left content category api code no 200'
);
}
if
(
!
_
.
isEmpty
(
result
[
4
]))
{
// 处理 VIP 商品数据
if
(
result
[
4
].
code
===
200
&&
parseInt
(
params
.
saleType
,
10
)
===
2
)
{
let
userInfo
=
result
[
4
].
data
.
vip_info
?
camelCase
(
result
[
4
].
data
.
vip_info
)
:
{};
if
(
_
.
isEmpty
(
userInfo
))
{
logger
.
info
(
'no user info'
);
}
let
vipInfo
=
_
.
get
(
result
,
'[4].data.vip_info'
,
{});
_
.
forEach
(
finalResult
.
goods
,
(
value
,
key
)
=>
{
switch
(
userInfo
.
curL
evel
)
{
switch
(
vipInfo
.
cur_l
evel
)
{
case
'1'
:
finalResult
.
goods
[
key
].
sales
Price
=
value
.
vip1P
rice
;
finalResult
.
goods
[
key
].
sales
_price
=
value
.
vip1_p
rice
;
finalResult
.
goods
[
key
].
vip1
=
true
;
break
;
case
'2'
:
finalResult
.
goods
[
key
].
sales
Price
=
value
.
vip2P
rice
;
finalResult
.
goods
[
key
].
sales
_price
=
value
.
vip2_p
rice
;
finalResult
.
goods
[
key
].
vip2
=
true
;
break
;
case
'3'
:
finalResult
.
goods
[
key
].
sales
Price
=
value
.
vip3P
rice
;
finalResult
.
goods
[
key
].
sales
_price
=
value
.
vip3_p
rice
;
finalResult
.
goods
[
key
].
vip3
=
true
;
break
;
default
:
finalResult
.
goods
[
key
].
vip
=
true
;
delete
finalResult
.
goods
[
key
].
sales
P
rice
;
delete
finalResult
.
goods
[
key
].
sales
_p
rice
;
break
;
}
});
}
else
{
logger
.
error
(
'user api code no 200 or no vip category'
);
}
}
else
{
logger
.
info
(
'no user info get from api'
);
}
return
finalResult
;
...
...
@@ -386,13 +356,15 @@ exports.getSaleDiscountData = (params, channel) => {
}
]
};
}
else
{
logger
.
error
(
'discount activity data[0] web_url empty'
);
}
}
return
api
.
all
([
saleApi
.
getSaleGoodsList
({
channel
:
channel
,
saleType
:
'3'
,
limit
:
'1'
,
productPool
:
result
[
1
].
data
[
0
].
product_pool
}),
saleApi
.
getSaleGoodsList
({
channel
:
channel
,
saleType
:
'3'
,
limit
:
'1'
,
productPool
:
result
[
1
].
data
[
0
].
product_pool
}),
saleApi
.
getSaleGoodsList
(
Object
.
assign
(
params
,
{
productPool
:
result
[
1
].
data
[
0
].
product_pool
}))
]).
then
(
subResult
=>
{
...
...
@@ -406,8 +378,6 @@ exports.getSaleDiscountData = (params, channel) => {
opts
:
publicHandler
.
handleSaleOptsData
(
params
,
subResult
[
0
].
data
.
total
)
}
});
}
else
{
logger
.
error
(
'category api no 200'
);
}
...
...
@@ -416,18 +386,14 @@ exports.getSaleDiscountData = (params, channel) => {
finalResult
.
saleList
.
goods
=
productProcess
.
processProductList
(
subResult
[
1
].
data
.
product_list
);
finalResult
.
saleList
.
totalCount
=
subResult
[
1
].
data
.
total
;
_
.
forEach
(
finalResult
.
saleList
.
goods
,
(
value
,
key
)
=>
{
delete
finalResult
.
saleList
.
goods
[
key
].
tags
.
isNew
;
// 屏蔽 new 标签
delete
finalResult
.
saleList
.
goods
[
key
].
tags
.
isSale
;
// 屏蔽 sale 标签
delete
finalResult
.
saleList
.
goods
[
key
].
tags
.
is_new
;
// 屏蔽 new 标签
delete
finalResult
.
saleList
.
goods
[
key
].
tags
.
is_sale
;
// 屏蔽 sale 标签
delete
finalResult
.
saleList
.
goods
[
key
].
discount
;
// 屏蔽折扣信息
});
}
else
{
logger
.
error
(
'discount goods list api code no 200'
);
}
return
finalResult
;
});
}
else
{
logger
.
error
(
'discount activity api code no 200'
);
}
return
finalResult
;
});
...
...
@@ -453,8 +419,6 @@ exports.getSalebreakingYardsData = (params, channel) => {
_
.
forEach
(
finalResult
.
topBanner
.
list
,
(
value
,
key
)
=>
{
delete
finalResult
.
topBanner
.
list
[
key
].
href
;
});
}
else
{
logger
.
error
(
'content code api code no 200'
);
}
// 断码区产品筛选需要断码区尺码数据,改为串行处理
...
...
@@ -485,8 +449,6 @@ exports.getSalebreakingYardsData = (params, channel) => {
if
(
subResult
[
0
].
code
===
200
)
{
finalResult
.
leftContent
=
publicHandler
.
handleSaleSortData
(
subResult
[
0
].
data
.
filter
.
group_sort
,
params
);
}
else
{
logger
.
error
(
'breakYards left content api code no 200'
);
}
// 处理商品数据
...
...
@@ -511,17 +473,15 @@ exports.getSalebreakingYardsData = (params, channel) => {
};
_
.
forEach
(
finalResult
.
goods
,
(
value
,
key
)
=>
{
delete
finalResult
.
goods
[
key
].
tags
.
isNew
;
// 屏蔽 new 标签
delete
finalResult
.
goods
[
key
].
tags
.
isSale
;
// 屏蔽 sale 标签
delete
finalResult
.
goods
[
key
].
tags
.
is_new
;
// 屏蔽 new 标签
delete
finalResult
.
goods
[
key
].
tags
.
is_sale
;
// 屏蔽 sale 标签
delete
finalResult
.
goods
[
key
].
discount
;
// 屏蔽折扣信息
});
}
else
{
logger
.
error
(
'breakYards goods list code no 200'
);
}
return
finalResult
;
});
}
else
{
logger
.
error
(
'breakYards size api code no 200'
);
return
Promise
.
reject
(
);
}
});
};
...
...
apps/product/models/students-handler.js
View file @
9d26170
...
...
@@ -35,7 +35,7 @@ const getCoupon = (data) => {
* @params data array
* @return Object
*/
const
pad
=
(
num
,
n
)
=>
{
const
pad
=
(
num
,
n
)
=>
{
let
len
=
num
.
toString
().
length
;
while
(
len
<
n
)
{
...
...
@@ -110,9 +110,9 @@ exports.stuProducts = (data) => {
_
.
forEach
(
data
,
(
value
,
key
)
=>
{
delete
data
[
key
].
discount
;
data
[
key
].
marketPrice
=
data
[
key
].
salesPrice
;
delete
data
[
key
].
salesPrice
;
if
(
value
.
studentPrice
)
{
data
[
key
].
market_price
=
data
[
key
].
sales_price
;
delete
data
[
key
].
sales_price
;
if
(
value
.
student_price
)
{
Object
.
assign
(
data
[
key
],
{
forStu
:
true
});
}
...
...
@@ -122,7 +122,7 @@ exports.stuProducts = (data) => {
exports
.
stuVerify
=
(
result
)
=>
{
let
data
=
{};
if
(
result
.
code
===
200
)
{
data
.
isError
=
false
;
data
=
result
.
data
;
...
...
apps/product/models/students.js
View file @
9d26170
...
...
@@ -6,10 +6,6 @@
'use strict'
;
// const utils = '../../../utils';
// const logger = global.yoho.logger;
// const camelCase = global.yoho.camelCase;
const
api
=
global
.
yoho
.
API
;
const
queryString
=
require
(
'querystring'
);
const
_
=
require
(
'lodash'
);
...
...
@@ -59,8 +55,12 @@ exports.getStudentsData = (channel, req) => {
module
:
'product'
,
page
:
'students'
,
realData
:
{
sortItem
:
[{
title
:
'学生权益介绍'
,
href
:
'stu-rights'
},
{
title
:
'我要验证身份'
,
href
:
'stu-identity'
},
{
title
:
'学生热门单品'
,
href
:
'stu-good'
},
{
title
:
'更多活动推荐'
,
href
:
'stu-activity'
}],
sortItem
:
[
{
title
:
'学生权益介绍'
,
href
:
'stu-rights'
},
{
title
:
'我要验证身份'
,
href
:
'stu-identity'
},
{
title
:
'学生热门单品'
,
href
:
'stu-good'
},
{
title
:
'更多活动推荐'
,
href
:
'stu-activity'
}
],
identityItem
:
{
stuNum
:
[]
}
...
...
@@ -97,33 +97,21 @@ exports.getStudentsData = (channel, req) => {
* 获取学校地区数据
* @return Object 接口数据
*/
exports
.
getSchoolArea
=
()
=>
{
return
studentsApi
.
getArea
().
then
(
result
=>
{
return
result
;
});
};
exports
.
getSchoolArea
=
studentsApi
.
getArea
;
/**
* 根据地区码查询学校列表
* @params areaCode int 地区码
* @return Object 接口数据
*/
exports
.
getSchoolList
=
(
areaCode
)
=>
{
return
studentsApi
.
getSchool
(
areaCode
).
then
(
result
=>
{
return
result
;
});
};
exports
.
getSchoolList
=
studentsApi
.
getSchool
;
/**
* 学历层次
* @params areaCode int 地区码
* @return Object 接口数据
*/
exports
.
getEduLevel
=
()
=>
{
return
studentsApi
.
getEduLevelList
().
then
(
result
=>
{
return
result
;
});
};
exports
.
getEduLevel
=
studentsApi
.
getEduLevelList
;
/**
* 身份验证
...
...
@@ -131,13 +119,13 @@ exports.getEduLevel = () => {
* @return Object 接口数据
*/
exports
.
verifyIdentity
=
(
uid
,
params
)
=>
{
let
pageUrl
=
helpers
.
urlFormat
(
'/product/students?'
)
+
queryString
.
stringify
({
collegeName
:
params
.
collegeName
,
educationDegree
:
params
.
educationDegree
,
enrollmentYear
:
params
.
enrollmentYear
})
+
'&'
;
let
pageUrl
=
helpers
.
urlFormat
(
'/product/students'
,
{
collegeName
:
params
.
collegeName
,
educationDegree
:
params
.
educationDegree
,
enrollmentYear
:
params
.
enrollmentYear
})
+
'&'
;
return
studentsApi
.
verifyIdentity
(
uid
,
params
.
certNo
,
params
.
name
,
pageUrl
).
then
(
result
=>
{
return
result
;
});
return
studentsApi
.
verifyIdentity
(
uid
,
params
.
certNo
,
params
.
name
,
pageUrl
);
};
/**
...
...
@@ -146,10 +134,7 @@ exports.verifyIdentity = (uid, params) => {
* @return Object 接口数据
*/
exports
.
verifyStudents
=
(
params
)
=>
{
return
studentsApi
.
verifyStudent
(
params
.
uid
,
params
.
collegeName
,
params
.
educationDegree
,
params
.
enrollmentYear
).
then
(
result
=>
{
return
result
;
});
return
studentsApi
.
verifyStudent
(
params
.
uid
,
params
.
collegeName
,
params
.
educationDegree
,
params
.
enrollmentYear
);
};
/**
...
...
@@ -158,24 +143,12 @@ exports.verifyStudents = (params) => {
* @return
*/
exports
.
userAcquireStatus
=
(
uid
,
couponIds
)
=>
{
let
ids
=
''
;
let
ids
=
couponIds
.
map
(
coupon
=>
crypto
.
decrypt
(
null
,
coupon
)).
join
(
','
)
;
for
(
let
i
=
0
;
i
<
couponIds
.
length
;
i
++
)
{
if
(
i
===
couponIds
.
length
-
1
)
{
ids
+=
crypto
.
decrypt
(
'yoho9646abcdefgh'
,
couponIds
[
i
]);
}
else
{
ids
+=
crypto
.
decrypt
(
'yoho9646abcdefgh'
,
couponIds
[
i
])
+
','
;
}
}
return
studentsApi
.
userAcquireStatus
(
uid
,
ids
).
then
(
result
=>
{
return
studentsApi
.
userAcquireStatus
(
uid
,
ids
).
then
(
result
=>
{
if
(
result
.
code
===
200
)
{
_
.
forEach
(
result
.
data
,
(
value
)
=>
{
let
couponId
=
value
.
couponId
.
toString
(),
cryptoId
=
crypto
.
encryption
(
'yoho9646abcdefgh'
,
couponId
);
value
.
couponId
=
cryptoId
;
value
.
couponId
=
crypto
.
encryption
(
null
,
value
.
couponId
+
''
);
});
}
return
result
;
...
...
doraemon/models/header.js
View file @
9d26170
...
...
@@ -49,9 +49,8 @@ const getNavBar = (data, type) => {
let
navBars
=
[];
_
.
forEach
(
data
,
item
=>
{
let
obj
=
{},
lowEn
=
_
.
camelCase
(
item
.
sort_name_en
).
toLowerCase
();
let
obj
=
{};
let
lowEn
=
_
.
camelCase
(
item
.
sort_name_en
).
toLowerCase
();
obj
.
link
=
item
.
sort_url
;
obj
.
cn
=
item
.
sort_name
;
...
...
doraemon/views/partial/footer.hbs
View file @
9d26170
...
...
@@ -330,6 +330,9 @@
<div
class=
"footer-link"
>
<div
class=
"center-content clearfix"
>
<div
class=
"left right-flag"
>
<a
class=
'govicon'
href=
"http://odr.jsdsgsxt.gov.cn:8081/mbm/entweb/elec/certView?siteId=f2b6e3b8d18241afb8dd6cadf7f15406"
target=
"_blank"
rel=
"nofollow"
>
<div
class=
"govimg"
></div>
</a>
<a
href=
"https://ss.knet.cn/verifyseal.dll?sn=e14021832010046477dka7000000&ct=df&a=1&pa=0.5902942178957805"
target=
"_blank"
rel=
"nofollow"
>
<img
src=
"//static.yohobuy.com/images/v3/icon/credit-flag3.png"
>
</a>
...
...
doraemon/views/partial/header.hbs
View file @
9d26170
...
...
@@ -253,7 +253,7 @@
</div>
<div class="go-full-cart">
<div>
<a href="/shopping/cart">去购物车结算</a>
<a href="/
/www.yohobuy.com/
shopping/cart">去购物车结算</a>
</div>
</div>
</div>
...
...
doraemon/views/partial/product/good.hbs
View file @
9d26170
<div
class=
"good-info"
data-skn=
"
{{
skn
}}
"
data-from=
"
{{
from
}}
"
>
<div
class=
"tag-container clearfix"
>
{{#
tags
}}
{{#
is
N
ew
}}
{{#
is
_n
ew
}}
<span
class=
"good-tag new-tag"
>
NEW
</span>
{{/
isNew
}}
{{#
isReNew
}}
{{/
is_new
}}
{{#
is_re_new
}}
<span
class=
"good-tag renew-tag"
>
再到着
</span>
{{/
isReNew
}}
{{#
isSale
}}
{{/
is_re_new
}}
{{#
is_sale
}}
<span
class=
"good-tag sale-tag"
>
SALE
</span>
{{/
isSale
}}
{{#
isNewFestival
}}
{{/
is_sale
}}
{{#
is_new_festival
}}
<span
class=
"good-tag new-festival-tag"
>
新品节
</span>
{{/
isNewFestival
}}
{{#
isLimit
}}
{{/
is_new_festival
}}
{{#
is_limit
}}
<span
class=
"good-tag limit-tag"
>
限量商品
</span>
{{/
isLimit
}}
{{#
isYearEndPromotion
}}
{{/
is_limit
}}
{{#
is_year_end_promotion
}}
<span
class=
"good-tag yep-tag"
>
年终大促
</span>
{{/
isYearEndPromotion
}}
{{#
isYearMidPromotion
}}
{{/
is_year_end_promotion
}}
{{#
is_year_mid_promotion
}}
<span
class=
"good-tag ymp-tag"
>
年中热促
</span>
{{/
is
YearMidP
romotion
}}
{{/
is
_year_mid_p
romotion
}}
{{/
tags
}}
</div>
<div
class=
"good-detail-img"
>
<a
class=
"good-thumb"
href=
"
{{
url
}}
"
target=
"_blank"
>
<img
class=
"lazy"
data-original=
"
{{
image
thumb
235
314
}}
"
>
</a>
{{#
is
F
ew
}}
{{#
is
_f
ew
}}
<p
class=
"few-tag"
>
即将售罄
</p>
{{/
is
F
ew
}}
{{/
is
_f
ew
}}
{{#if
is
SaleO
ut
}}
{{#if
is
_sale_o
ut
}}
<a
class=
"sale-out"
href=
"
{{
url
}}
"
>
<span
class=
"sale-out-tip"
>
已抢光
</span>
</a>
{{/if}}
{{#if
show
ColB
tn
}}
{{#if
show
_col_b
tn
}}
<span
class=
"col-btn iconfont
{{#if
coled
}}
coled
{{/if}}
"
>

</span>
{{/if}}
</div>
<div
class=
"good-detail-text
{{#
forStu
}}
stu-good-detail
{{/
forStu
}}
"
>
<a
href=
"
{{
url
}}
"
target=
"_blank"
>
{{{
productName
}}}
</a>
<div
class=
"good-detail-text
{{#
for_stu
}}
stu-good-detail
{{/
for_stu
}}
"
>
<a
href=
"
{{
url
}}
"
target=
"_blank"
>
{{{
product_name
}}}
</a>
<p
class=
"brand"
>
<a
href=
"
{{
brand
Url
}}
"
>
{{
brandN
ame
}}
</a>
<a
href=
"
{{
brand
_url
}}
"
>
{{
brand_n
ame
}}
</a>
</p>
<p
class=
"price
{{#if
vip
}}
vip-center
{{/if}}
"
>
{{#
market
P
rice
}}
{{#
market
_p
rice
}}
<span
class=
"market-price"
>
¥
{{
round
.
2
}}
</span>
{{/
marketPrice
}}
{{#
salesPrice
}}
<span
class=
"sale-price
{{#
unless
marketPrice
}}
prime-cost
{{/
unless
}}
"
>
{{/
market_price
}}
{{#
sales_price
}}
<span
class=
"sale-price
{{#
unless
market_price
}}
prime-cost
{{/
unless
}}
"
>
¥
{{
round
.
2
}}
</span>
{{/
sales
P
rice
}}
{{/
sales
_p
rice
}}
{{#
student
P
rice
}}
{{#
student
_p
rice
}}
<span
class=
"sale-price"
>
¥
{{
round
.
2
}}
</span>
{{/
student
P
rice
}}
{{/
student
_p
rice
}}
{{#
discount
}}
<span
class=
"discount"
>
{{
.
}}
折
</span>
...
...
@@ -71,12 +71,12 @@
{{#
vip1
}}
<span
class=
"vip-1 vip-span"
></span>
{{/
vip1
}}
{{#
vip2
}}
<span
class=
"vip-2 vip-span"
></span>
{{/
vip2
}}
{{#
vip3
}}
<span
class=
"vip-3 vip-span"
></span>
{{/
vip3
}}
{{#
for
Stu
}}
<span
class=
"stu-tag"
>
学生价
</span>
{{/
forS
tu
}}
{{#
for
_stu
}}
<span
class=
"stu-tag"
>
学生价
</span>
{{/
for_s
tu
}}
</p>
<div
class=
"hideList hide"
>
{{#
goodsList
}}
<li
data-src=
"
{{
image
imagesUrl
235
314
}}
"
data-url=
"
{{
..
/
url
}}
"
></li>
{{/
goodsList
}}
{{#
goods_list
}}
<li
data-src=
"
{{
image
images_url
235
314
}}
"
data-url=
"
{{
..
/
url
}}
"
></li>
{{/
goods_list
}}
</div>
</div>
</div>
...
...
package.json
View file @
9d26170
{
"name"
:
"yohobuy-node"
,
"version"
:
"4.9.
2
"
,
"version"
:
"4.9.
4
"
,
"private"
:
true
,
"description"
:
"A New Yohobuy Project With Express"
,
"repository"
:
{
...
...
public/dist/yohobuy-node/assets/img/sprite.passport.png
View file @
9d26170
8.64 KB
|
W:
|
H:
10 KB
|
W:
|
H:
2-up
Swipe
Onion skin
public/img/layout/ebsIcon.png
0 → 100644
View file @
9d26170
17 KB
public/js/home/QRcode.page.js
View file @
9d26170
...
...
@@ -7,6 +7,8 @@ var len = $item.length, slide;
var
src
=
/url
\(
"
([^
'"
]
*
)
"
\)
/g
.
exec
(
$
(
'.print_qrcode'
).
css
(
'background'
))[
1
];
$
(
'.print_qrcode'
).
find
(
'img'
).
attr
(
'src'
,
src
);
require
(
'../common'
);
function
slideDo
(
to
)
{
$item
.
each
(
function
(
index
)
{
index
===
to
?
$
(
this
).
stop
().
animate
({
...
...
public/js/passport/back-index.page.js
View file @
9d26170
...
...
@@ -3,3 +3,4 @@
*/
require
(
'./back/back'
);
require
(
'../common'
);
\ No newline at end of file
...
...
public/js/passport/back-reset-pwd.page.js
View file @
9d26170
...
...
@@ -3,3 +3,4 @@
*/
require
(
'./back/reset'
);
require
(
'../common'
);
\ No newline at end of file
...
...
public/js/passport/back-reset-success.js
View file @
9d26170
/**
* Created by TaoHuang on 2016/6/21.
*/
require
(
'../common'
);
\ No newline at end of file
...
...
public/js/passport/back-send-email-ok.page.js
View file @
9d26170
/**
* Created by TaoHuang on 2016/6/21.
*/
require
(
'../common'
);
\ No newline at end of file
...
...
public/js/passport/back-verify-mobile-code.page.js
View file @
9d26170
...
...
@@ -3,3 +3,4 @@
*/
require
(
'./back/verification'
);
require
(
'../common'
);
\ No newline at end of file
...
...
public/js/passport/bind-success.page.js
View file @
9d26170
...
...
@@ -2,3 +2,4 @@
* 绑定成功页面
**/
require
(
'../simple-header'
);
require
(
'../common'
);
\ No newline at end of file
...
...
public/js/passport/bind.page.js
View file @
9d26170
require
(
'./bind/thirdlogin'
);
require
(
'../common'
);
\ No newline at end of file
...
...
public/js/passport/login.page.js
View file @
9d26170
require
(
'./login/index'
);
require
(
'../common'
);
\ No newline at end of file
...
...
public/js/passport/noregist.page.js
View file @
9d26170
require
(
'./bind/bind-info'
);
require
(
'../common'
);
\ No newline at end of file
...
...
public/js/passport/reg.page.js
View file @
9d26170
var
reg
=
require
(
'./reg/reg'
);
reg
.
init
(
'reg'
);
require
(
'../common'
);
\ No newline at end of file
...
...
public/js/passport/relate.page.js
View file @
9d26170
require
(
'./bind/relate'
);
require
(
'../common'
);
\ No newline at end of file
...
...
public/js/product/detail.page.js
View file @
9d26170
...
...
@@ -324,20 +324,12 @@ $addToCart.click(function() {
}
}).
then
(
function
(
data
)
{
var
code
=
data
.
code
;
var
strK
;
if
(
code
===
200
)
{
$
(
'#type-chose'
).
slideUp
(
SLIDETIME
);
$
(
'#balance'
).
slideDown
(
SLIDETIME
);
$
(
'#cart-num'
).
text
(
data
.
data
.
goods_count
);
// 更新数目
strK
=
'{"_k":"'
+
data
.
data
.
_k
+
'","_nac":0'
+
',"_ac":0,"_r":0}'
;
//eslint-disable-line
window
.
setCookie
(
'_g'
,
strK
,
{
path
:
'/'
,
domain
:
'.yohobuy.com'
});
}
});
});
...
...
public/scss/common/_footer.css
View file @
9d26170
...
...
@@ -298,6 +298,21 @@
a
{
margin-right
:
5px
;
}
.govicon
{
display
:
inline-block
;
float
:
left
;
border-radius
:
2px
;
margin-right
:
8px
;
background
:
#fff
;
width
:
26px
;
height
:
34px
;
}
.govimg
{
width
:
100%
;
height
:
100%
;
background
:
resolve
(
layout
/
ebsIcon
.
png
)
no-repeat
;
}
}
.about-us
{
...
...
utils/product-process.js
View file @
9d26170
...
...
@@ -14,14 +14,14 @@ const images = require(`${global.utils}/images`);
*/
const
procProductImg
=
(
product
,
gender
,
newSort
)
=>
{
if
(
gender
===
'2,3'
)
{
return
product
.
cover
2
||
product
.
cover1
||
product
.
imagesU
rl
||
''
;
return
product
.
cover
_2
||
product
.
cover_1
||
product
.
images_u
rl
||
''
;
}
if
(
newSort
&&
gender
===
'1,2,3'
)
{
return
product
.
images
U
rl
||
''
;
return
product
.
images
_u
rl
||
''
;
}
return
product
.
cover
1
||
product
.
cover2
||
product
.
imagesU
rl
||
''
;
return
product
.
cover
_1
||
product
.
cover_2
||
product
.
images_u
rl
||
''
;
};
...
...
@@ -32,10 +32,10 @@ const procProductImg = (product, gender, newSort) => {
*/
const
handleGoodsListData
=
(
origin
)
=>
{
_
.
forEach
(
origin
,
(
value
,
key
)
=>
{
if
(
!
_
.
isEmpty
(
value
.
goodsList
))
{
_
.
forEach
(
value
.
goodsList
,
(
subValue
,
subKey
)
=>
{
origin
[
key
].
goodsList
[
subKey
].
url
=
helpers
.
urlFormat
(
`
/
product
/
pro_$
{
value
.
productId
}
_$
{
subValue
.
goodsId
}
/${value.cnAlphabet}.html`
)
;
if
(
!
_
.
isEmpty
(
value
.
goods_list
))
{
_
.
forEach
(
value
.
goods_list
,
(
subValue
,
subKey
)
=>
{
origin
[
key
].
goods_list
[
subKey
].
url
=
helpers
.
urlFormat
(
`
/
product
/
pro_$
{
value
.
product_id
}
_$
{
subValue
.
goods_id
}
/${value.cn_alphabet}.html`
)
;
});
}
});
...
...
@@ -113,93 +113,87 @@ exports.processProductList = (list, options) => {
gender
:
'2,3'
},
options
);
list
=
camelCase
(
list
);
_
.
forEach
(
list
,
(
product
)
=>
{
// 商品信息有问题,则不显示
if
(
!
product
.
product
Skn
||
!
product
.
goodsL
ist
.
length
)
{
if
(
!
product
.
product
_skn
||
!
product
.
goods_l
ist
.
length
)
{
return
;
}
// 如果库存为0,显示已抢完
if
(
product
.
storageNum
===
0
&&
product
.
status
===
1
)
{
product
.
isSaleOut
=
true
;
if
(
product
.
storage_num
===
0
&&
product
.
status
===
1
)
{
product
.
is_sale_out
=
true
;
}
// 市场价和售价一样,则不显示市场价, 不显示折扣信息
if
(
product
.
marketPrice
===
product
.
salesPrice
)
{
delete
product
.
marketPrice
;
if
(
product
.
market_price
===
product
.
sales_price
)
{
delete
product
.
market_price
;
}
else
if
(
options
.
showDiscount
)
{
product
.
discount
=
(
product
.
sales
Price
/
product
.
marketP
rice
*
10
).
toFixed
(
1
);
product
.
discount
=
(
product
.
sales
_price
/
product
.
market_p
rice
*
10
).
toFixed
(
1
);
}
// 如果设置了默认图片,就取默认的图片
_
.
forEach
(
procGoodsList
(
product
.
goodsList
),
(
goods
)
=>
{
// 判别默认的商品是否将默认的图片URL赋值到skn
let
flag
=
false
;
// (颜色优先)
if
(
options
.
color
)
{
if
(
goods
.
colorId
===
options
.
color
)
{
product
.
defaultImages
=
procProductImg
(
goods
,
options
.
gender
,
options
.
newCoverSort
);
return
;
}
}
else
{
if
(
goods
.
isDefault
===
'Y'
)
{
product
.
defaultImages
=
procProductImg
(
goods
,
options
.
gender
,
options
.
newCoverSort
);
return
;
}
// 如果设置了默认图片,就取默认的图片
_
.
forEach
(
product
.
goods_list
,
(
goods
)
=>
{
if
(
flag
)
{
return
;
}
if
(
goods
.
is_default
===
'Y'
)
{
product
.
default_images
=
procProductImg
(
goods
);
flag
=
true
;
}
});
// 如果还未赋值,则取第一个skc产品的默认图片
if
(
!
product
.
defaultImages
)
{
product
.
defaultImages
=
procProductImg
(
product
.
goodsList
[
0
],
options
.
gender
,
options
.
newCoverSort
);
if
(
!
flag
)
{
product
.
default_images
=
procProductImg
(
product
.
goods_list
[
0
]);
}
product
=
Object
.
assign
(
product
,
{
id
:
product
.
productSkn
,
thumb
:
product
.
defaultImages
id
:
product
.
product_skn
,
thumb
:
product
.
default_images
});
product
.
isFew
=
product
.
isSoonSoldOut
===
'Y'
;
product
.
url
=
helpers
.
urlFormat
(
`
/
product
/
pro_$
{
product
.
productId
}
_$
{
product
.
goodsList
[
0
].
goodsId
}
/${product.cnAlphabet}.html`
)
; // eslint-disable-lin
e
product
.
is_few
=
product
.
is_soon_sold_out
===
'Y'
;
product
.
url
=
helpers
.
urlFormat
(
`
/
product
/
pro_$
{
product
.
product_id
}
_$
{
product
.
goods_list
[
0
].
goods_id
}
/${product.cn_alphabet}.html`
)
; // eslint-disable-lin
e
// tar add 1606071146 品牌链接处理
product
.
brandUrl
=
helpers
.
urlFormat
(
''
,
''
,
product
.
brand
D
omain
);
product
.
brandUrl
=
helpers
.
urlFormat
(
''
,
''
,
product
.
brand
_d
omain
);
// APP访问需要加附加的参数
// 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护
if
(
options
.
isApp
)
{
product
.
url
+=
`
?
openby
:
yohobuy
=
{
"action"
:
"go.productDetail"
,
"params"
:{
"product_skn"
:
'${product.product
I
d}'
}}
`
;
// eslint-disable-line
product
.
url
+=
`
?
openby
:
yohobuy
=
{
"action"
:
"go.productDetail"
,
"params"
:{
"product_skn"
:
'${product.product
_i
d}'
}}
`
;
// eslint-disable-line
}
if
(
options
.
showTags
)
{
product
.
tags
=
{};
product
.
tags
.
isNew
=
options
.
showNew
&&
product
.
isNew
===
'Y'
;
// 新品
//product.tags.isDiscount = options.showSale && product.isDiscount === 'Y'; // 在售
product
.
tags
.
isSale
=
options
.
showSale
&&
product
.
isDiscount
===
'Y'
&&
product
.
salesPrice
&&
(
product
.
marketPrice
/
product
.
salesPrice
>
2
);
product
.
tags
.
isLimited
=
product
.
isLimited
===
'Y'
;
// 限量
product
.
tags
.
isYohood
=
product
.
isYohood
===
'Y'
;
// YOHOOD
product
.
tags
.
midYear
=
product
.
midYear
===
'Y'
;
// 年中
product
.
tags
.
yearEnd
=
product
.
yearEnd
===
'Y'
;
// 年末
product
.
tags
.
isAdvance
=
product
.
isAdvance
===
'Y'
;
// 再到着
product
.
tags
.
is_new
=
options
.
showNew
&&
product
.
is_new
===
'Y'
;
// 新品
product
.
tags
.
is_sale
=
options
.
showSale
&&
product
.
is_discount
===
'Y'
;
// 在售
product
.
tags
.
is_limited
=
product
.
is_limited
===
'Y'
;
// 限量
product
.
tags
.
is_yohood
=
product
.
is_yohood
===
'Y'
;
// YOHOOD
product
.
tags
.
mid_year
=
product
.
mid_year
===
'Y'
;
// 年中
product
.
tags
.
year_end
=
product
.
year_end
===
'Y'
;
// 年末
product
.
tags
.
is_advance
=
product
.
is_advance
===
'Y'
;
// 再到着
// 打折与即将售完组合显示打折
/*if (product.isFew && product.tags.isDiscount) {
product.isFew = false;
} else*/
if
(
product
.
tags
.
isNew
)
{
product
.
tags
.
isSale
=
false
;
/*if (product.is_soon_sold_out && product.tags.is_discount) {
product.tags.is_few = false;
} else*/
if
(
product
.
tags
.
is_new
)
{
product
.
tags
.
is_sale
=
false
;
}
if
(
product
.
tags
.
isSale
&&
(
product
.
isFew
||
product
.
tags
.
isLimited
||
product
.
tags
.
isYohood
||
product
.
tags
.
isAdvance
))
{
if
(
product
.
tags
.
is_sale
&&
(
product
.
is_few
||
product
.
tags
.
is_limited
||
product
.
tags
.
is_yohood
||
product
.
tags
.
is_advance
))
{
// 打折与其它组合则隐藏打折
product
.
tags
.
isSale
=
false
;
}
else
if
(
product
.
tags
.
isYohood
&&
product
.
isFew
)
{
product
.
tags
.
is_sale
=
false
;
}
else
if
(
product
.
tags
.
is_yohood
&&
product
.
is_few
)
{
// YOHOOD和新品组合显示YOHOOD
product
.
is
F
ew
=
false
;
product
.
is
_f
ew
=
false
;
}
}
...
...
utils/resources-process.js
View file @
9d26170
...
...
@@ -10,6 +10,7 @@ module.exports = (list) => {
const
formatData
=
[];
list
=
list
||
[];
// TODO:
list
=
camelCase
(
list
);
_
.
forEach
(
list
,
(
floor
)
=>
{
...
...
Please
register
or
login
to post a comment