Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-community-web
·
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
htoooth
6 years ago
Commit
124a758d789577a3b48137b43a6c607e95641a0f
1 parent
f6f3dec8
fix error
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
18 deletions
apps/store/article/actions.js
apps/store/article/guangProcess.js
apps/store/article/actions.js
View file @
124a758
...
...
@@ -121,12 +121,12 @@ export default {
// 插入商品
const
[
goodsList
,
favsList
]
=
await
Promise
.
all
([
this
.
$api
.
post
(
'/api/guang/article/queryGoods'
,
{
query
:
processContents
.
allgoods
.
join
(
','
),
query
:
processContents
.
allgoods
.
skn
.
join
(
','
),
order
:
's_t_desc'
,
limit
:
processContents
.
allgoods
.
length
||
1
limit
:
processContents
.
allgoods
.
skn
.
length
||
1
}),
this
.
$api
.
post
(
'/api/favorite/batchCheckIsFavorite'
,
{
favIds
:
processContents
.
allgoods
.
join
(
','
),
favIds
:
processContents
.
allgoods
.
id
.
join
(
','
),
type
:
'product'
})
]).
then
(([
res1
,
res2
])
=>
{
...
...
apps/store/article/guangProcess.js
View file @
124a758
...
...
@@ -81,7 +81,7 @@ function productGlobalUrl(skn) {
export
function
processArticleDetail
(
articleContent
)
{
let
finalDetail
=
[];
let
allgoods
=
[]
;
let
allgoods
=
{
id
:
[],
skn
:
[]}
;
let
recommends
=
[];
for
(
let
value
of
articleContent
)
{
...
...
@@ -160,18 +160,21 @@ export function processArticleDetail(articleContent) {
// 普通商品
forEach
(
goodsData
,
(
item
)
=>
{
allgoods
.
push
(
get
(
item
,
'productId'
,
0
));
allgoods
.
id
.
push
(
get
(
item
,
'productId'
,
0
));
allgoods
.
skn
.
push
(
get
(
item
,
'id'
,
0
));
});
// 全球购商品
forEach
(
goodsDataGlobal
,
(
item
)
=>
{
allgoods
.
push
(
get
(
item
,
'productId'
,
0
));
allgoods
.
id
.
push
(
get
(
item
,
'productId'
,
0
));
allgoods
.
skn
.
push
(
get
(
item
,
'id'
,
0
));
goodsData
.
push
(
item
);
});
// 限定商品
forEach
(
goodsDataLimit
,
(
item
)
=>
{
allgoods
.
push
(
get
(
item
,
'productId'
,
0
));
allgoods
.
id
.
push
(
get
(
item
,
'productId'
,
0
));
allgoods
.
skn
.
push
(
get
(
item
,
'id'
,
0
));
goodsData
.
push
(
item
);
});
...
...
@@ -337,30 +340,34 @@ export function pushGoodsInfo(finalDetail, goodsList, favsList) {
forEach
(
finalDetail
,
(
value
,
key
)
=>
{
if
(
value
.
relatedReco
)
{
let
goods
Ids
=
[];
let
goods
Skn
=
[];
forEach
(
value
.
relatedReco
.
goods
,
relatedGoods
=>
{
goods
Ids
.
push
(
relatedGoods
.
id
);
goods
Skn
.
push
(
relatedGoods
.
id
);
});
goods
Ids
=
uniq
(
goodsIds
);
goods
Skn
=
uniq
(
goodsSkn
);
finalDetail
[
key
].
relatedReco
.
goods
=
[];
forEach
(
goodsIds
,
(
item
,
subKey
)
=>
{
forEach
(
goodsSkn
,
(
item
,
subKey
)
=>
{
console
.
log
(
goodsObj
,
item
)
if
(
goodsObj
[
item
])
{
console
.
log
(
goodsObj
[
item
])
finalDetail
[
key
].
relatedReco
.
goods
[
subKey
]
=
goodsObj
[
item
];
}
else
{
console
.
log
(
'delete'
);
delete
finalDetail
[
key
].
relatedReco
.
goods
[
subKey
];
}
});
finalDetail
[
key
].
relatedReco
.
goods
=
remove
(
finalDetail
[
key
].
relatedReco
.
goods
,
(
obj
)
=>
{
return
obj
;
});
let
moreNum
=
get
(
finalDetail
[
key
],
'relatedReco.goods.length'
,
0
);
finalDetail
[
key
].
relatedReco
.
moreNum
=
moreNum
-
4
>
0
?
moreNum
-
4
:
0
;
// 改成第一屏幕最多展示4个
//
// finalDetail[key].relatedReco.goods = remove(finalDetail[key].relatedReco.goods, (obj) => {
// return obj;
// });
//
// let moreNum = get(finalDetail[key], 'relatedReco.goods.length', 0);
//
// finalDetail[key].relatedReco.moreNum = moreNum - 4 > 0 ? moreNum - 4 : 0; // 改成第一屏幕最多展示4个
}
if
(
value
.
collocation
)
{
...
...
Please
register
or
login
to post a comment