✨ feat(颜色取样|取色查找|样品对比): 移植内部版相关功能
This commit is contained in:
@@ -1,40 +1,47 @@
|
||||
import { Image, View } from "@tarojs/components"
|
||||
import Taro from "@tarojs/taro"
|
||||
import { goLink } from "@/common/common"
|
||||
import { Image, View } from '@tarojs/components'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { goLink } from '@/common/common'
|
||||
import styles from './index.module.scss'
|
||||
import { formatHashTag, formatImgUrl } from "@/common/fotmat"
|
||||
import LabAndImg from "../LabAndImg"
|
||||
import { useCallback, useMemo } from "react"
|
||||
import { formatHashTag, formatImgUrl } from '@/common/format'
|
||||
import LabAndImg from '../LabAndImg'
|
||||
import { useCallback, useMemo } from 'react'
|
||||
|
||||
type Params = {
|
||||
desStatus?: true | false,
|
||||
productList?: any[],
|
||||
popupShow?: (any) => void
|
||||
desStatus?: true | false
|
||||
productList?: any[]
|
||||
popupShow?: (any) => void
|
||||
}
|
||||
export default ({ desStatus = true, productList = [], popupShow }: Params) => {
|
||||
|
||||
const labAndImgObj = useCallback((item) => {
|
||||
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
|
||||
}, [productList])
|
||||
return (
|
||||
<View className={styles.products_list}>
|
||||
{productList?.map(item => {
|
||||
return <View className={styles.products_item} onClick={() => popupShow?.(item)}>
|
||||
<View className={styles.item_img}>
|
||||
<LabAndImg value={labAndImgObj(item)} />
|
||||
<View className={styles.num}>{item.product_color_count}色</View>
|
||||
</View>
|
||||
<View className={styles.item_con}>
|
||||
<View className={styles.title}><text>{formatHashTag(item.code, '')} </text>{item.name}</View>
|
||||
<View className={styles.tag_list}>
|
||||
<View className={styles.tag}>{item.width}</View>
|
||||
<View className={styles.tag_g}>{item.weight_density}</View>
|
||||
</View>
|
||||
<View className={styles.introduce}>{item.component}</View>
|
||||
{desStatus && <View className={styles.des}>{item.describe}</View>}
|
||||
</View>
|
||||
</View>
|
||||
})}
|
||||
</View >
|
||||
)
|
||||
const labAndImgObj = useCallback(
|
||||
(item) => {
|
||||
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
|
||||
},
|
||||
[productList],
|
||||
)
|
||||
return (
|
||||
<View className={styles.products_list}>
|
||||
{productList?.map((item) => {
|
||||
return (
|
||||
<View className={styles.products_item} onClick={() => popupShow?.(item)}>
|
||||
<View className={styles.item_img}>
|
||||
<LabAndImg value={labAndImgObj(item)} />
|
||||
<View className={styles.num}>{item.product_color_count}色</View>
|
||||
</View>
|
||||
<View className={styles.item_con}>
|
||||
<View className={styles.title}>
|
||||
<text>{formatHashTag(item.code, '')} </text>
|
||||
{item.name}
|
||||
</View>
|
||||
<View className={styles.tag_list}>
|
||||
<View className={styles.tag}>{item.width}</View>
|
||||
<View className={styles.tag_g}>{item.weight_density}</View>
|
||||
</View>
|
||||
<View className={styles.introduce}>{item.component}</View>
|
||||
{desStatus && <View className={styles.des}>{item.describe}</View>}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user