🐞 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

View File

@ -5,7 +5,7 @@ export const BASE_URL = CURRENT_BASE_URL
// export const BASE_URL = `http://192.168.0.89:40001/lymarket` // export const BASE_URL = `http://192.168.0.89:40001/lymarket`
// export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞 // export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞
// export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境 // export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境
// export const BASE_URL = `https://pre.zzfzyc.com/lymarket` // 预发布 // export const BASE_URL = 'https://pre.zzfzyc.com/lymarket' // 预发布
// export const BASE_URL = `http://192.168.1.9:40001/lymarket` // 发 // export const BASE_URL = `http://192.168.1.9:40001/lymarket` // 发
// export const BASE_URL = `http://192.168.1.9:50005/lymarket` // 发 // export const BASE_URL = `http://192.168.1.9:50005/lymarket` // 发
// export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发 // export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发

View File

@ -2,6 +2,7 @@ import { Image, Input, ScrollView, View } from '@tarojs/components'
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react' import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
import classnames from 'classnames' import classnames from 'classnames'
import styles from './index.module.scss' import styles from './index.module.scss'
import LabAndImg from '@/components/LabAndImg'
interface props { interface props {
clickAdd: (any) => void clickAdd: (any) => void
@ -17,6 +18,8 @@ interface props {
weight_cut_price?: Number weight_cut_price?: Number
code?: string code?: string
rgb?: { r: number; g: number; b: number } rgb?: { r: number; g: number; b: number }
lab?: { l: number; a: number; b: number }
texture_url: string
name?: string name?: string
roll?: number | string roll?: number | string
buyNums?: number | string buyNums?: number | string
@ -56,15 +59,23 @@ const GoodsItem = (props: props) => {
return 'digit' return 'digit'
} }
}, [props.modeFont]) }, [props.modeFont])
const labAndImgObj = useCallback((item) => {
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
}, [])
return ( return (
<View className={styles.goodsBox}> <View className={styles.goodsBox}>
{
{/* {
props?.value?.rgb?.r == 0 && props?.value?.rgb?.g == 0 && props?.value?.rgb?.b == 0 && <Image className={styles.pic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image> props?.value?.rgb?.r == 0 && props?.value?.rgb?.g == 0 && props?.value?.rgb?.b == 0 && <Image className={styles.pic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
} }
{ {
(props?.value?.rgb?.r != 0 || props?.value?.rgb?.g != 0 || props?.value?.rgb?.b != 0) (props?.value?.rgb?.r != 0 || props?.value?.rgb?.g != 0 || props?.value?.rgb?.b != 0)
&& <View className={styles.pic} style={{ backgroundColor: `rgb(${props?.value?.rgb?.r} ${props?.value?.rgb?.g} ${props?.value.rgb?.b})` }}></View> && <View className={styles.pic} style={{ backgroundColor: `rgb(${props?.value?.rgb?.r} ${props?.value?.rgb?.g} ${props?.value.rgb?.b})` }}></View>
} } */}
<View className={styles.pic}>
<LabAndImg value={labAndImgObj(props.value)} />
</View>
<View className={styles.rightGoodbox}> <View className={styles.rightGoodbox}>
<View className={styles.leftFontsbox}> <View className={styles.leftFontsbox}>
<View className={styles.title}>{props.value?.code} {props.value?.name}</View> <View className={styles.title}>{props.value?.code} {props.value?.name}</View>

View File

@ -33,7 +33,7 @@ import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format
import IconFont from '@/components/iconfont/iconfont' import IconFont from '@/components/iconfont/iconfont'
import { PAY_H5_CODE_URL } from '@/common/constant' import { PAY_H5_CODE_URL } from '@/common/constant'
import SaleCodeList from '@/components/SaleCodeList' import SaleCodeList from '@/components/SaleCodeList'
import LabAndImg from '@/components/LabAndImg'
// 卡片盒子元素 // 卡片盒子元素
interface Obs { interface Obs {
title?: string title?: string
@ -79,6 +79,9 @@ interface PropGoods {
} }
const GoodsItem = (porps: PropGoods) => { const GoodsItem = (porps: PropGoods) => {
const { list = [], obj = {} } = porps const { list = [], obj = {} } = porps
const labAndImgObj = useCallback((item) => {
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
}, [])
return ( return (
<> <>
{ {
@ -91,7 +94,10 @@ const GoodsItem = (porps: PropGoods) => {
item.product_colors.map((it, inx) => { item.product_colors.map((it, inx) => {
return ( return (
<View className={styles.itemGoods} key={inx}> <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.itemRight}>
<View className={styles.item_right_top}> <View className={styles.item_right_top}>
<View className={styles.itemName}>{it.code}# {it.name}</View> <View className={styles.itemName}>{it.code}# {it.name}</View>

View File

@ -16,7 +16,7 @@ import { alert } from '@/common/common'
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format' import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
import IconFont from '@/components/iconfont/iconfont' import IconFont from '@/components/iconfont/iconfont'
import { MpPurchaserAddressList } from '@/api/addressList' import { MpPurchaserAddressList } from '@/api/addressList'
import LabAndImg from '@/components/LabAndImg'
// 卡片盒子元素 // 卡片盒子元素
interface Obs { interface Obs {
title?: string title?: string
@ -62,6 +62,10 @@ interface PropGoods {
} }
const GoodsItem = (porps: PropGoods) => { const GoodsItem = (porps: PropGoods) => {
const { list = [], obj = {} } = porps const { list = [], obj = {} } = porps
const labAndImgObj = useCallback((item) => {
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
}, [])
return ( return (
<> <>
{ {
@ -74,7 +78,10 @@ const GoodsItem = (porps: PropGoods) => {
item.product_colors.map((it, inx) => { item.product_colors.map((it, inx) => {
return ( return (
<View className={styles.itemGoods} key={inx}> <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.itemRight}>
<View className={styles.item_right_top}> <View className={styles.item_right_top}>
<View className={styles.itemName}>{it.code} {it.name}</View> <View className={styles.itemName}>{it.code} {it.name}</View>