🐞 fix(图片问题):修改部分商品图片展示

This commit is contained in:
Haiyi
2022-12-08 19:54:34 +08:00
parent dcf76ab611
commit e68b97e104
4 changed files with 31 additions and 7 deletions
+8 -2
View File
@@ -33,7 +33,7 @@ import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format
import IconFont from '@/components/iconfont/iconfont'
import { PAY_H5_CODE_URL } from '@/common/constant'
import SaleCodeList from '@/components/SaleCodeList'
import LabAndImg from '@/components/LabAndImg'
// 卡片盒子元素
interface Obs {
title?: string
@@ -79,6 +79,9 @@ interface PropGoods {
}
const GoodsItem = (porps: PropGoods) => {
const { list = [], obj = {} } = porps
const labAndImgObj = useCallback((item) => {
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
}, [])
return (
<>
{
@@ -91,7 +94,10 @@ const GoodsItem = (porps: PropGoods) => {
item.product_colors.map((it, inx) => {
return (
<View className={styles.itemGoods} key={inx}>
<View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View>
<View className={styles.itemPic}>
<LabAndImg value={labAndImgObj(it)} />
</View>
{/* <View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View> */}
<View className={styles.itemRight}>
<View className={styles.item_right_top}>
<View className={styles.itemName}>{it.code}# {it.name}</View>
+9 -2
View File
@@ -16,7 +16,7 @@ import { alert } from '@/common/common'
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
import IconFont from '@/components/iconfont/iconfont'
import { MpPurchaserAddressList } from '@/api/addressList'
import LabAndImg from '@/components/LabAndImg'
// 卡片盒子元素
interface Obs {
title?: string
@@ -62,6 +62,10 @@ interface PropGoods {
}
const GoodsItem = (porps: PropGoods) => {
const { list = [], obj = {} } = porps
const labAndImgObj = useCallback((item) => {
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
}, [])
return (
<>
{
@@ -74,7 +78,10 @@ const GoodsItem = (porps: PropGoods) => {
item.product_colors.map((it, inx) => {
return (
<View className={styles.itemGoods} key={inx}>
<View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View>
<View className={styles.itemPic}>
<LabAndImg value={labAndImgObj(item)} />
</View>
{/* <View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View> */}
<View className={styles.itemRight}>
<View className={styles.item_right_top}>
<View className={styles.itemName}>{it.code} {it.name}</View>