Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohoblk-wap
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yyq
7 years ago
Commit
02b539aca0f6498b6ebc0869d3b8aadda6eec9eb
1 parent
0933463b
list
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
43 deletions
apps/me/models/index.js
apps/me/models/prefer.js
apps/product/controllers/product-list.js
public/js/common/vue-directive.js
utils/beautify/product.js
apps/me/models/index.js
View file @
02b539a
...
...
@@ -94,15 +94,7 @@ const _processProduct = (list) => {
list
=
list
||
[];
list
.
forEach
(
item
=>
{
let
defaultGoods
=
_
.
find
(
item
.
goods_list
,
{
is_default
:
'Y'
});
// 无默认商品取商品列表第一个
if
(
!
defaultGoods
)
{
defaultGoods
=
item
.
goods_list
[
0
];
}
item
.
default_images
=
_procProductImg
(
defaultGoods
);
item
.
goodsUrl
=
`
$
{
config
.
siteUrl
}
/product/
pro_$
{
item
.
product_id
}
_$
{
defaultGoods
.
goods_id
}
/${item.cn_alphabet}.html`; // eslint-disable-lin
e
item
.
goodsUrl
=
`
$
{
config
.
siteUrl
}
/product/
pro_$
{
item
.
product_id
}
_$
{
_
.
get
(
item
,
'goods_list[0].goods_id'
,
''
)}
/${item.cn_alphabet}.html`; // eslint-disable-lin
e
});
_
.
chunk
(
list
,
5
).
forEach
(
item
=>
{
...
...
@@ -246,7 +238,7 @@ exports.getSknUrl = (skn, originArr) => {
let
urls
=
data
.
data
.
product_list
.
map
((
item
)
=>
{
return
{
skn
:
item
.
product_skn
,
url
:
`
/
product
/
pro_$
{
item
.
product_id
}
_$
{
item
.
goods_list
[
0
].
goods_id
}
/${item.cn_alphabet}.html
`
url
:
`
/
product
/
pro_$
{
item
.
product_id
}
_$
{
_
.
get
(
item
,
'goods_list[0].goods_id'
,
''
)
}
/${item.cn_alphabet}.html
`
};
});
//eslint-disable-line
...
...
apps/me/models/prefer.js
View file @
02b539a
...
...
@@ -22,15 +22,7 @@ const _processProduct = (list) => {
list
=
list
||
[];
list
.
forEach
(
item
=>
{
let
defaultGoods
=
_
.
find
(
item
.
goods_list
,
{
is_default
:
'Y'
});
// 无默认商品取商品列表第一个
if
(
!
defaultGoods
)
{
defaultGoods
=
item
.
goods_list
[
0
];
}
item
.
default_images
=
_procProductImg
(
defaultGoods
);
item
.
goodsUrl
=
`
$
{
config
.
siteUrl
}
/product/
pro_$
{
item
.
product_id
}
_$
{
defaultGoods
.
goods_id
}
/${item.cn_alphabet}.html`; // eslint-disable-lin
e
item
.
goodsUrl
=
`
$
{
config
.
siteUrl
}
/product/
pro_$
{
item
.
product_id
}
_$
{
_
.
get
(
item
,
'goods_list[0].goods_id'
,
''
)}
/${item.cn_alphabet}.html`; // eslint-disable-lin
e
});
_
.
chunk
(
list
,
5
).
forEach
(
item
=>
{
...
...
apps/product/controllers/product-list.js
View file @
02b539a
...
...
@@ -19,7 +19,7 @@ exports.index = (req, res, next) => {
let
list
=
result
&&
result
.
data
?
result
.
data
.
product_list
:
[];
_
.
forEach
(
list
,
d
=>
{
d
.
goodsList
=
d
.
goods_list
;
d
.
goodsList
=
d
.
goods_list
||
[]
;
d
.
productId
=
d
.
product_id
;
d
.
goodsId
=
d
.
goods_id
;
d
.
cnAlphabet
=
d
.
cn_alphabet
;
...
...
public/js/common/vue-directive.js
View file @
02b539a
...
...
@@ -80,10 +80,10 @@ function GoodHrefBinding(el, binding) {
}
let
{
product_id
,
goods_id
,
cn_alphabet
,
product_skn
,
from_page_name
,
from_page_param
}
=
binding
.
value
;
if
(
!
binding
.
modifiers
.
collect
)
{
if
(
!
binding
.
modifiers
.
collect
&&
binding
.
value
.
goods_list
)
{
goods_id
=
binding
.
value
.
goods_list
.
length
?
binding
.
value
.
goods_list
[
0
].
goods_id
:
''
;
}
let
href
=
`
/
product
/
pro_$
{
product_id
}
_$
{
goods_id
}
/${cn_alphabet || 'item'}.html`
;
let
href
=
`
/
product
/
pro_$
{
product_id
}
_$
{
goods_id
||
''
}
/${cn_alphabet || 'item'}.html`
;
const
prefix
=
yoho
.
isiOS
?
'i'
:
(
yoho
.
isAndroid
?
'a'
:
''
);
if
(
yoho
.
isYohoBuy
)
{
...
...
utils/beautify/product.js
View file @
02b539a
...
...
@@ -66,7 +66,7 @@ module.exports = (list, options) => {
_
.
forEach
(
list
,
(
product
)
=>
{
// 商品信息有问题,则不显示
if
(
!
product
||
!
product
.
product_id
||
!
product
.
goods_list
||
!
product
.
goods_list
.
length
)
{
if
(
!
product
||
!
product
.
product_id
)
{
return
;
}
...
...
@@ -80,27 +80,8 @@ module.exports = (list, options) => {
product
.
market_price
=
false
;
}
// 判别默认的商品是否将默认的图片URL赋值到skn
let
flag
=
false
;
// 如果设置了默认图片,就取默认的图片
_
.
forEach
(
product
.
goods_list
,
(
goods
)
=>
{
if
(
flag
)
{
return
false
;
}
if
(
goods
.
is_default
===
'Y'
)
{
product
.
default_images
=
_procProductImg
(
goods
,
genderVal
);
flag
=
true
;
}
});
// 如果还未赋值,则取第一个skc产品的默认图片
if
(
!
flag
)
{
product
.
default_images
=
_procProductImg
(
product
.
goods_list
[
0
],
genderVal
);
}
product
.
is_soon_sold_out
=
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
product
.
url
=
helpers
.
urlFormat
(
`
/
product
/
pro_$
{
product
.
product_id
}
_$
{
_
.
get
(
product
,
'goods_list[0].goods_id'
,
''
)
}
/${product.cn_alphabet}.html`
)
; // eslint-disable-lin
e
// APP访问需要加附加的参数
// 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护
...
...
Please
register
or
login
to post a comment