Commit dad373bf authored by GuanHua's avatar GuanHua

feat:去除商品详情重复的图片

parent 9984e307
......@@ -371,9 +371,19 @@ const CommodityDetail = (props) => {
}
}
const judegeImageExist = (list, pic) => {
return list.every(item => item.commodityPic !== pic.commodityPic)
/**
* 去除重复的图片
* @param list
* @param addList
*/
const deleteRepeatImg = (list, addList) => {
let result = [...list]
for (let addItem of addList) {
if (list.every(item => item.commodityPic !== addItem.commodityPic)) {
result.push(addItem)
}
}
return result
}
/**
......@@ -399,12 +409,9 @@ const CommodityDetail = (props) => {
commodityPic: picItem
}
})
// if (judegeImageExist(tempImgList, tempCommodityPic)) {
// }
tempImgList = [...tempImgList, ...tempCommodityPic]
tempImgList = deleteRepeatImg(tempImgList, tempCommodityPic)
}
console.log(tempImgList, "")
for (let attrListItem of item.attributeAndValueList) {
if (judgeAttrInList(tempAttrList, attrListItem.customerAttribute.id)) {
let tempAttrListIndex = 0
......
......@@ -68,10 +68,10 @@
margin-top: 4px;
&_item {
flex: 1;
// flex: 1;
display: flex;
align-items: center;
margin-right: 8px;
margin-right: 16px;
&>span {
font-size: 14px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment