🦄 refactor:85%

This commit is contained in:
Haiyi 2022-09-02 11:24:22 +08:00
parent 83d6b1c9d5
commit 671b94b961
3 changed files with 21 additions and 4 deletions

View File

@ -46,6 +46,12 @@
position: relative; position: relative;
margin-right: 24px; margin-right: 24px;
.pic {
width: 144px;
height: 144px;
border-radius: 8px;
}
.posBox { .posBox {
position: absolute; position: absolute;
bottom: 0px; bottom: 0px;

View File

@ -1,13 +1,17 @@
import { View, Image } from '@tarojs/components' import { View, Image } from '@tarojs/components'
import React, { useCallback, memo, useEffect, useMemo, useRef, useState } from 'react' import React, { useCallback, memo, useEffect, useMemo, useRef, useState } from 'react'
import styles from "../goods/index.module.scss" import styles from "../goods/index.module.scss"
import LabAndImg from "@/components/LabAndImg"
export default memo((props: any) => { export default memo((props: any) => {
const labAndImgObj = useCallback((item) => {
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
}, [])
return ( return (
<View className={styles.itemBox}> <View className={styles.itemBox}>
{ {
!props.lab && <> props.data?.texture_url === '' && <>
<View className={styles.picBox}> <View className={styles.picBox}>
<Image className={styles.pic} mode={'aspectFill'} src={'https://test.cdn.zzfzyc.com/mall/no_img.png'}></Image> <Image className={styles.pic} mode={'aspectFill'} src={'https://test.cdn.zzfzyc.com/mall/no_img.png'}></Image>
@ -16,9 +20,11 @@ export default memo((props: any) => {
</> </>
} }
{ {
props.lab && props.data?.texture_url !== '' &&
<> <>
<View className={styles.leftBox}> <View className={styles.leftBox}>
<LabAndImg value={labAndImgObj(props.data)} />
{/* <Image className={styles.pic} mode={'aspectFill'} src={props.data?.picUrl}></Image> */}
<View className={styles.posBox}>{props.data?.product_color_count}</View> <View className={styles.posBox}>{props.data?.product_color_count}</View>
</View> </View>
</> </>

View File

@ -33,6 +33,11 @@ export default memo(() => {
const { fetchData: productFetch } = mpproductlist() const { fetchData: productFetch } = mpproductlist()
const getProduct = async (e) => { const getProduct = async (e) => {
const res = await productFetch({ code_or_name: e }) const res = await productFetch({ code_or_name: e })
// res.data.list.map(item=>{
// if(item.texture_url !==''){
// }
// })
setSearchList([...res.data.list]) setSearchList([...res.data.list])
} }
//返回 //返回